激情五月天婷婷,亚洲愉拍一区二区三区,日韩视频一区,a√天堂中文官网8

<ul id="buwfs"><strike id="buwfs"><strong id="buwfs"></strong></strike></ul>
    <output id="buwfs"></output>
  • <dfn id="buwfs"><source id="buwfs"></source></dfn>
      <dfn id="buwfs"><td id="buwfs"></td></dfn>
      <div id="buwfs"><small id="buwfs"></small></div>
      <dfn id="buwfs"><source id="buwfs"></source></dfn>
      1. <dfn id="buwfs"><td id="buwfs"></td></dfn>
        始創(chuàng)于2000年 股票代碼:831685
        咨詢熱線:0371-60135900 注冊(cè)有禮 登錄
        • 掛牌上市企業(yè)
        • 60秒人工響應(yīng)
        • 99.99%連通率
        • 7*24h人工
        • 故障100倍補(bǔ)償
        全部產(chǎn)品
        您的位置: 網(wǎng)站首頁(yè) > 幫助中心>文章內(nèi)容

        CentOS 5.5 安裝 mysql-5.1.53-linux-x86_64 及主從復(fù)制集群配置

        發(fā)布時(shí)間:  2012/8/26 16:00:37

        設(shè)置Mysql的主從復(fù)制的主要用途:
        1 做備份機(jī)器,一旦主服務(wù)器崩潰,可以直接啟用從服務(wù)器作為主服務(wù)器
        2 可以直接鎖定從服務(wù)器的表只讀,然后做備份數(shù)據(jù),這樣不會(huì)影響主服務(wù)器的服務(wù)
        3 可以處理讀寫數(shù)據(jù)庫(kù)的負(fù)載均衡

        要點(diǎn):
        從服務(wù)器一般需要設(shè)置只讀,否則容易產(chǎn)生錯(cuò)誤導(dǎo)致同步失敗
        wget http://dev.mysql.com/get/Downloads/MySQL-5.1/mysql-5.1.53-linux-x86_64-glibc23.tar.gz/from/http://mysql.mirror.tw/
        -
         

        tar -C /usr/local -xzf mysql-5.1.53-linux-i686-glibc23.tar.gz
        cd /usr/local
        ln -s  mysql-5.1.53-linux-i686-glibc23 mysql

        tar -C /usr/local -xzf  mysql-5.1.53-linux-x86_64-glibc23.tar.gz
        cd /usr/local
        ln -s mysql-5.1.53-linux-x86_64-glibc23 mysql

        cd /usr/local/mysql
        cp support-files/my-huge.cnf my.cnf

        mv /etc/my.cnf ~/
        mv /etc/rc.d/init.d/mysqld ~/

        修改server-id = 1為服務(wù)器ip地址最后幾位,或者其它數(shù)值:
        vim  my.cnf

        server-id = 8108

        max_allowed_packet = 64M
        max_connections=800
        character-set-server=utf8
        expire_logs_days = 60
        binlog_format=mixed

        innodb_log_files_in_group=2
        default_table_type = INNODB
        innodb_data_home_dir = /opt/data/mysql/
        innodb_data_file_path = ibdata1:2000M;ibdata2:2000M;ibdata3:20M:autoextend
        innodb_log_group_home_dir = /opt/data/mysql/

        # 4G RAM
        innodb_buffer_pool_size = 1G
        innodb_log_file_size = 256M
        innodb_log_buffer_size = 4M
        innodb_flush_log_at_trx_commit=0
        innodb_thread_concurrency=8
        innodb_flush_method=O_DIRECT

        # perform
        tmp_table_size = 512M
        max_heap_table_size=128M

        slow_query_log
        #slow_query_log_file=mysql-slow.log
        long_query_time=1
        log-error=mysqld.log

        [mysqld_safe]
        log-error=/var/log/mysqld.log
        pid-file=/var/run/mysqld/mysqld.pid

        #————————————–
        # 32G RAM
        max_allowed_packet = 64M
        innodb_buffer_pool_size = 24G
        #————————————-

        /usr/sbin/groupadd -g 502 mysql
        /usr/sbin/useradd -u 502 -g mysql mysql

        mkdir -p /opt/data/mysql/
        chown mysql.mysql /opt/data/mysql/

        cd /usr/local/mysql/
        scripts/mysql_install_db –user=mysql
        chown -R root .
        chown -R mysql data
        chgrp -R mysql .
        #chmod -R u+rw data
        cd /opt/data/mysql/
        chown mysql.mysql /opt/data/mysql/

        cd /usr/local/mysql/
        cp support-files/mysql.server /etc/rc.d/init.d/mysqld
        chmod +x /etc/rc.d/init.d/mysqld

        #/sbin/chkconfig –del mysqld
        /sbin/chkconfig –add mysqld
        /sbin/chkconfig –level 345 mysqld on
        /sbin/chkconfig –list mysqld

        echo "/usr/local/mysql/lib" >> /etc/ld.so.conf
        cat /etc/ld.so.conf
        ldconfig

        /etc/rc.d/init.d/mysqld stop
        /etc/rc.d/init.d/mysqld start

        mkdir -p /var/lib/mysql/
        ln -s /tmp/mysql.sock /var/lib/mysql/mysql.sock

        #/usr/local/mysql/bin/mysqld_safe &
        mkdir -p /var/run/mysqld/
        chown mysql /var/run/mysqld/

        #加入mysql到路徑
        echo pathmunge /usr/local/mysql/bin after > /etc/profile.d/mysql.sh

        #執(zhí)行一下,保證mysql在路徑環(huán)境變量中
        . /etc/profile

        或者
        vim /etc/profile
        PATH=$PATH:/usr/local/mysql/bin
        PATH=/usr/local/mysql/bin:$PATH

        tail -50 /opt/data/mysql/*.err

        slave上的配置

        修改server-id = 1為服務(wù)器ip地址最后幾位,或者其它數(shù)值,必須保證唯一性:
        vim  my.cnf

        server-id = 8168

        max_connections=600
        character-set-server=utf8
        binlog_format = "ROW"
        default_table_type = innodb
        relay-log-purge=1
        #slave-skip-errors=1062,1053
        skip-slave-start
        replicate-ignore-db=mysql
        innodb_data_home_dir = /opt/data/mysql/
        innodb_data_file_path = ibdata1:2000M;ibdata2:2000M:autoextend
        innodb_log_group_home_dir = /opt/data/mysql/

        在master服務(wù)器上配置復(fù)制賬號(hào)權(quán)限:
        GRANT REPLICATION SLAVE ON *.* TO 'replication'@'%' IDENTIFIED BY 'slavepass';
        flush privileges;

        在slave服務(wù)器上配置master服務(wù)器信息:
        CHANGE MASTER TO MASTER_HOST='10.8.8.108', MASTER_USER='replication', MASTER_PASSWORD='slavepass';
        start slave;


        本文出自:億恩科技【mszdt.com】

        服務(wù)器租用/服務(wù)器托管中國(guó)五強(qiáng)!虛擬主機(jī)域名注冊(cè)頂級(jí)提供商!15年品質(zhì)保障!--億恩科技[ENKJ.COM]

      2. 您可能在找
      3. 億恩北京公司:
      4. 經(jīng)營(yíng)性ICP/ISP證:京B2-20150015
      5. 億恩鄭州公司:
      6. 經(jīng)營(yíng)性ICP/ISP/IDC證:豫B1.B2-20060070
      7. 億恩南昌公司:
      8. 經(jīng)營(yíng)性ICP/ISP證:贛B2-20080012
      9. 服務(wù)器/云主機(jī) 24小時(shí)售后服務(wù)電話:0371-60135900
      10. 虛擬主機(jī)/智能建站 24小時(shí)售后服務(wù)電話:0371-60135900
      11. 專注服務(wù)器托管17年
        掃掃關(guān)注-微信公眾號(hào)
        0371-60135900
        Copyright© 1999-2019 ENKJ All Rights Reserved 億恩科技 版權(quán)所有  地址:鄭州市高新區(qū)翠竹街1號(hào)總部企業(yè)基地億恩大廈  法律顧問(wèn):河南亞太人律師事務(wù)所郝建鋒、杜慧月律師   京公網(wǎng)安備41019702002023號(hào)
          0
         
         
         
         

        0371-60135900
        7*24小時(shí)客服服務(wù)熱線