rpm 安裝5.6 MySql主從搭建

urgel_babay發表於2016-02-29
<p> <span>&nbsp;2015.07.21<br /> <br /> </span> </p> <p> <b>一、</b><b>MySQL</b><b>伺服器安裝</b> </p> <p style="margin-left:18.0pt;text-indent:-18.0pt;"> <b><span>1.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></b><b>新增使用者</b>: </p> <p> <span>groupadd mysql</span> </p> <p> <span>useradd -r -g mysql mysql</span> </p> <p style="margin-left:18.0pt;text-indent:-18.0pt;"> <b><span>2.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></b><b>上傳<span>rpm</span></b><b>包</b><br /> <span style="color:#E53333;">注:Oracle</span><span style="color:#E53333;">官方提供的最新MySQL安裝包,目前沒有更高版本的,有可能其他版本還夠穩定,所以Oracle沒有提供</span> </p> <p> <span>MySQL-client-advanced-5.6.25-1.el6.x86_64.rpm&nbsp;&nbsp;&nbsp; </span> </p> <p> <span>MySQL-server-advanced-5.6.25-1.el6.x86_64.rpm&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span> </p> <p> <span>MySQL-test-advanced-5.6.25-1.el6.x86_64.rpm</span> </p> <p> <span>MySQL-devel-advanced-5.6.25-1.el6.x86_64.rpm&nbsp;&nbsp;&nbsp;&nbsp; </span> </p> <p> <span>MySQL-shared-advanced-5.6.25-1.el6.x86_64.rpm</span> </p> <p> <span>MySQL-embedded-advanced-5.6.25-1.el6.x86_64.rpm&nbsp; <br /> MySQL-shared-compat-advanced-5.6.25-1.el6.x86_64.rpm</span> </p> <p style="margin-left:18.0pt;text-indent:-18.0pt;"> <b><span>3.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></b><b>安裝<span>rpm</span></b><b>包<span></span></b> </p> <p> <span style="color:#E53333;">注:安裝rpm 包的時候,要按照順序,shared-compat 需要再server前安裝,不然會報錯</span> </p> <p> <span>rpm –ivh&nbsp; MySQL-shared-compat-advanced-5.6.25-1.el6.x86_64.rpm</span> </p> <p> <span>rpm –ivh&nbsp; MySQL-client-advanced-5.6.25-1.el6.x86_64.rpm&nbsp;&nbsp;&nbsp; </span> </p> <p> <span>rpm –ivh&nbsp; MySQL-test-advanced-5.6.25-1.el6.x86_64.rpm &nbsp;<span style="color:#006600;">#這個可以不用安裝,我每次都沒有安裝</span></span> </p> <p> <span>rpm –ivh&nbsp; MySQL-devel-advanced-5.6.25-1.el6.x86_64.rpm&nbsp;&nbsp;&nbsp;&nbsp; </span> </p> <p> <span>rpm –ivh&nbsp; MySQL-shared-advanced-5.6.25-1.el6.x86_64.rpm</span> </p> <p> <span>rpm –ivh&nbsp; MySQL-embedded-advanced-5.6.25-1.el6.x86_64.rpm </span> </p> <p> <span>rpm –ivh&nbsp; MySQL-server-advanced-5.6.25-1.el6.x86_64.rpm &nbsp;&nbsp;</span> </p> <p style="margin-left:18.0pt;text-indent:-18.0pt;"> <b><span>4.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></b><b>修改<span>datadir </span></b><b>目錄:</b> </p> <p style="text-indent:18.0pt;"> <span>1). service mysql stop &nbsp;&nbsp;&nbsp;<span style="color:#006600;">#修改MySQL配置檔案,引數檔案最好是再MySQL停止的情況修改</span></span> </p> <p style="text-indent:18.0pt;"> <span>2). mv /mysqldata/mysql/* &nbsp;/mydata/mysql/</span> </p> <p> <span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; chown –R mysql.mysql /mydata/mysql/* &nbsp; <span style="color:#006600;">#root 使用者移動目錄後,許可權會被修改,所以要授予MySQL使用者許可權,不然啟動MySQL會報錯</span></span> </p> <p style="text-indent:21.0pt;"> <span>3). vi /etc/init.d/mysql</span> </p> <p> 原: </p> <p> <span># Set some defaults</span> </p> <p> <span>mysqld_pid_file_path=</span> </p> <p> <span>if test -z "$basedir"</span> </p> <p> <span>then</span> </p> <p> <span>&nbsp; basedir=/usr</span> </p> <p> <span>&nbsp; bindir=/usr/bin</span> </p> <p> <span>&nbsp; if test -z "$datadir"</span> </p> <p> <span>&nbsp; then</span> </p> <p> <span>&nbsp; <b>&nbsp;&nbsp;<span style="color:#006600;">datadir=/var/lib/mysql</span></b></span> </p> <p> <b>修改後</b>: </p> <p> <span># Set some defaults</span> </p> <p> <span>mysqld_pid_file_path=</span> </p> <p> <span>if test -z "$basedir"</span> </p> <p> <span>then</span> </p> <p> <span>&nbsp; basedir=/usr</span> </p> <p> <span>&nbsp; bindir=/usr/bin</span> </p> <p> <span>&nbsp; if test -z "$datadir"</span> </p> <p> <span>&nbsp; then</span> </p> <p style="text-indent:20.25pt;"> <b><span style="color:#E53333;">datadir=/mysqldata/mysql</span></b><span style="text-indent:20.25pt;line-height:1.5;">&nbsp; <span style="color:#006600;">#根據個人的規劃修改</span></span> </p> <p style="text-indent:20.25pt;"> <span>4). vi /etc/my.cnf</span> </p> <p style="text-indent:20.25pt;"> <span>datadir=/mysqldata/mysql</span> </p> <p style="text-indent:20.25pt;"> <span>socket = /mysqldata/mysql/mysql.sock <span style="color:#006600;">#sock 檔案一般是放在tmp下面,我這裡跟資料檔案放在一起</span></span> </p> <p style="text-indent:20.25pt;"> <span>5). service mysql start</span> </p> <p> 以上修改<span>MySQL</span>資料目錄需要主從機上都需做。 </p> <p style="text-indent:20.25pt;"> <span style="text-indent:20.25pt;line-height:1.5;">&nbsp;</span> </p> <p style="margin-left:25.5pt;text-indent:-25.5pt;"> <b>二、</b><b>主從配置步驟</b><b></b> </p> <p style="margin-left:38.25pt;text-indent:-18.0pt;"> <span>1.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>主從機修改配置檔案; </p> <p style="margin-left:38.25pt;text-indent:-18.0pt;"> <span>2.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>從機指向主機,開啟接收。 </p> <p style="margin-left:38.25pt;text-indent:0cm;"> 主<span>my.cnf<br /> <table border="1" cellspacing="0" cellpadding="0" width="596" style="width:447.2pt;border:none;"> <tbody> <tr> <td valign="top" style="border:solid windowtext 1.0pt;"> <p style="margin-left:38.25pt;"> <span>[client]</span> </p> <p style="margin-left:38.25pt;"> <span>port = 3306</span> </p> <p style="margin-left:38.25pt;"> <span>socket = /mysqldata/mysql/mysql.sock &nbsp;<span style="color:#00B050;">#</span></span><span style="font-family:宋體;color:#00B050;">客戶端使用的程式通道檔案</span> <span></span> </p> <p style="margin-left:38.25pt;"> <span>[mysqld]</span> </p> <p style="margin-left:38.25pt;"> <span>server-id=1 <span style="color:#00B050;">#</span></span><span style="font-family:宋體;color:#00B050;">主從中節點的唯一</span><span style="color:#00B050;">ID</span><span></span> </p> <p style="margin-left:38.25pt;"> <span>log-bin=mysql-master-bin &nbsp;</span><span style="font-size:9.0pt;color:#006600;background:white;">#</span><span style="font-size:9.0pt;font-family:宋體;color:#006600;background:white;">二進位制日誌</span>名字,用於主從複製<span></span> </p> <p style="margin-left:38.25pt;"> <span>binlog_format = mixed <span style="color:#00B050;">#</span></span><span style="font-family:&quot;color:#00B050;background:white;">binlog</span><span style="font-family:宋體;color:#00B050;background:white;">日誌格式,</span><span style="font-family:&quot;color:#00B050;background:white;">mysql</span><span style="font-family:宋體;color:#00B050;background:white;">預設採用</span><span style="font-family:&quot;color:#00B050;background:white;">statement</span><span style="font-family:宋體;color:#00B050;background:white;">,建議使用</span><span style="font-family:&quot;color:#00B050;background:white;">mixed</span><span style="color:#00B050;"></span> </p> <p style="margin-left:38.25pt;"> <span>expire_logs_days=30 &nbsp;</span><span style="font-size:9.0pt;color:#006600;background:white;">#</span><span style="font-size:9.0pt;font-family:宋體;color:#006600;background:white;">二進位制日誌保留的時間</span><span></span> </p> <p style="margin-left:38.25pt;"> <span>max_connections=1000 <span style="color:#00B050;">#</span></span><span style="font-family:宋體;color:#00B050;">最大連線數</span><span></span> </p> <p style="margin-left:38.25pt;"> <span>innodb_flush_log_at_trx_commit=1 <span style="color:#00B050;">#</span></span><span style="font-family:宋體;color:#00B050;">每隔</span><span style="color:#00B050;">1</span><span style="font-family:宋體;color:#00B050;">秒將資料寫入檔案</span><span style="color:#00B050;">InnoDB</span><span style="font-family:宋體;color:#00B050;">預設</span><span style="color:#00B050;">1</span><span></span> </p> <p style="margin-left:38.25pt;"> <span>sync_binlog=1 <span style="color:#00B050;">#</span></span><span style="font-family:宋體;color:#00B050;">主從同步模式</span><span style="color:#00B050;"> 1</span><span style="font-family:宋體;color:#00B050;">表示實時同步</span><span></span> </p> <p style="margin-left:38.25pt;"> <span>binlog-do-db=pwapacydb <span style="color:#00B050;">#</span></span><span style="font-family:宋體;color:#00B050;">需要做複製的資料庫名</span><span style="color:#00B050;"></span> </p> <p style="margin-left:38.25pt;"> <span>#binlog-ignore-db=mysql,test,information_schema <span style="color:#00B050;">#</span></span><span style="font-family:宋體;color:#00B050;">二進位制日誌過濾條件</span><span></span> </p> <p style="margin-left:38.25pt;"> <span>innodb_buffer_pool_size = 20480M <span style="color:#00B050;">#</span></span><span style="font-family:宋體;color:#00B050;">根據實際記憶體</span><span style="color:#00B050;"> <span>&lt;65%</span></span> </p> <p style="margin-left:38.25pt;"> <span>skip-name-resolve &nbsp;#</span><span style="font-size:9.0pt;font-family:宋體;color:#00B050;">對區域網各伺服器的</span><span style="font-size:9.0pt;color:#00B050;">IP</span><span style="font-size:9.0pt;font-family:宋體;color:#00B050;">做了反向解析</span><span style="font-size:9.0pt;color:#00B050;"> </span><span style="font-size:9.0pt;font-family:宋體;color:#00B050;">加速訪問速度</span><span></span> </p> <p style="margin-left:38.25pt;"> <span>skip-external-locking&nbsp;&nbsp; </span><span style="font-size:9.0pt;color:#006600;background:white;">#</span><span style="font-size:9.0pt;font-family:宋體;color:#006600;background:white;">加上可以避免因資源鎖引起</span><span style="font-size:9.0pt;color:#006600;background:white;">MySQL</span><span style="font-size:9.0pt;font-family:宋體;color:#006600;background:white;">服務停止</span><span></span> </p> <p style="margin-left:38.25pt;"> <span>datadir = /mysqldata/mysql &nbsp;<span style="color:#00B050;">#</span></span><span style="font-family:宋體;color:#00B050;">資料檔案存放目錄</span><span style="color:#00B050;"></span> </p> <p style="margin-left:38.25pt;"> <span>port = 3306&nbsp; <span style="color:#00B050;">#MySQL</span></span><span style="font-family:宋體;color:#00B050;">訪問埠</span><span></span> </p> <p style="margin-left:38.25pt;"> <span>socket = /mysqldata/mysql/mysql.sock</span> </p> <p style="margin-left:38.25pt;text-indent:0cm;"> <span>sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES</span> </p> <p style="text-indent:0cm;"> <span>&nbsp;</span> </p> </td> </tr> </tbody> </table> </span> </p> 從機my.cnf 配置(參考上面的)<br /> <table border="1" cellspacing="0" cellpadding="0" style="border:none;"> <tbody> <tr> <td width="437" valign="top" style="border:solid windowtext 1.0pt;"> <p> &nbsp; </p> <p> [client] </p> <p> port = 3306 </p> <p> socket = /mysqldata/mysql/mysql.sock </p> <p> [mysqld] </p> <p> server-id=2 </p> <p> datadir = /mysqldata/mysql </p> <p> port = 3306 </p> <p> socket = /mysqldata/mysql/mysql.sock </p> <p> user=mysql </p> <p> log-bin=mysql-slave-bin </p> <p> max_binlog_size=200M </p> <p> binlog_format = mixed </p> <p> expire_logs_days=30 </p> <p> innodb_flush_log_at_trx_commit=1 </p> <p> sync_binlog=1 </p> <p> read_only=1 </p> <p> replicate-do-db&nbsp;&nbsp; =test &nbsp; </p> <p> innodb_buffer_pool_size = 20480M </p> <p> skip-name-resolve </p> <p> skip-external-locking </p> <p style="text-indent:0cm;"> sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES<span style="line-height:1.5;text-indent:0cm;">&nbsp;</span> </p> </td> </tr> </tbody> </table> <p style="margin-left:38.25pt;text-indent:0cm;"> 從<span>my.cnf</span> </p> <p style="margin-left:38.25pt;text-indent:-18.0pt;"> <span>3.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>主從機建立同步使用者授權: </p> <p style="margin-left:38.25pt;text-indent:0cm;"> <span style="color:#E53333;">注:主從都建使用者是為了主從可以相互切換,IP指向對方,如果只在從上面做,則配置為主從複製,如果主從機都指向,則是主主複製</span> </p> <p style="margin-left:38.25pt;"> <span>mysql&gt; grant replication slave on *.* to 'zhanglin'@'172.16.11.87' identified by 'zhanglin';</span> </p> <p style="margin-left:38.25pt;"> <span>mysql&gt; flush privileges;</span> </p> <p style="margin-left:38.25pt;"> <span>mysql&gt; show master status;</span> </p> <p style="margin-left:38.25pt;text-indent:-18.0pt;"> <span>4.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><strong>從機指向主機</strong><span>:</span> </p> <p style="margin-left:38.25pt;"> <span>mysql&gt; change master to master_host='172.0.0.1',</span> </p> <p style="margin-left:38.25pt;"> <span>master_user='zhanglin',</span> </p> <p style="margin-left:38.25pt;"> <span>master_password='zhanglin',</span> </p> <p style="margin-left:38.25pt;"> <span>master_log_file='mysql-master-bin.000007', <span style="color:#006600;">#主機上當前的二進位制日誌名字</span></span> </p> <p style="margin-left:38.25pt;"> <span>master_log_pos=<span style="color:#5C5C5C;font-family:Consolas, monospace;letter-spacing:0.100000001490116px;line-height:15.6000003814697px;white-space:normal;background-color:#FFFFFF;">1036536265</span>;</span><span style="line-height:1.5;">&nbsp; <span style="color:#006600;">#在主機上,show master status 可以看到二進位制日誌的位置</span></span> </p> <p style="margin-left:38.25pt;text-indent:-18.0pt;"> <span>5.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span>mysql&gt; start slave; &nbsp;<span style="color:#006600;">#</span></span><span style="color:#006600;">啟動從庫連線</span> </p> <p style="margin-left:38.25pt;text-indent:-18.0pt;"> <span>6.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span>mysql&gt; show slave status\G;&nbsp;<span style="color:#006600;"> #</span></span><span style="color:#006600;">檢視連線情況</span><span style="line-height:1.5;text-indent:0cm;">&nbsp;</span> </p> <p style="margin-left:38.25pt;"> <span>mysql&gt; show slave status\G;</span> </p> <p style="margin-left:38.25pt;"> <br /> </p> <div> <div class="codeheads"> <p> 點選(<span style="cursor:pointer;color:red;" onclick="code_hide('code56')">此處</span>)摺疊或開啟 </p> </div> <div id="code56" class="codeText"> <ol style="margin:0 1px 0 0px;padding-left:40px;" start="1" class="dp-css"> <li> <span style="color:#000000;"><span style="color:#0000CC;">*</span><span style="color:#0000CC;">*</span><span style="color:#0000CC;">*</span><span style="color:#0000CC;">*</span><span style="color:#0000CC;">*</span><span style="color:#0000CC;">*</span><span style="color:#0000CC;">*</span><span style="color:#0000CC;">*</span><span style="color:#0000CC;">*</span><span style="color:#0000CC;">*</span><span style="color:#0000CC;">*</span><span style="color:#0000CC;">*</span><span style="color:#0000CC;">*</span><span style="color:#0000CC;">*</span><span style="color:#0000CC;">*</span><span style="color:#0000CC;">*</span><span style="color:#0000CC;">*</span><span style="color:#0000CC;">*</span><span style="color:#0000CC;">*</span><span style="color:#0000CC;">*</span><span style="color:#0000CC;">*</span><span style="color:#0000CC;">*</span><span style="color:#0000CC;">*</span><span style="color:#0000CC;">*</span><span style="color:#0000CC;">*</span><span style="color:#0000CC;">*</span><span style="color:#0000CC;">*</span> 1<span style="color:#0000CC;">.</span> row <span style="color:#0000CC;">*</span><span style="color:#0000CC;">*</span><span style="color:#0000CC;">*</span><span style="color:#0000CC;">*</span><span style="color:#0000CC;">*</span><span style="color:#0000CC;">*</span><span style="color:#0000CC;">*</span><span style="color:#0000CC;">*</span><span style="color:#0000CC;">*</span><span style="color:#0000CC;">*</span><span style="color:#0000CC;">*</span><span style="color:#0000CC;">*</span><span style="color:#0000CC;">*</span><span style="color:#0000CC;">*</span><span style="color:#0000CC;">*</span><span style="color:#0000CC;">*</span><span style="color:#0000CC;">*</span><span style="color:#0000CC;">*</span><span style="color:#0000CC;">*</span><span style="color:#0000CC;">*</span><span style="color:#0000CC;">*</span><span style="color:#0000CC;">*</span><span style="color:#0000CC;">*</span><span style="color:#0000CC;">*</span><span style="color:#0000CC;">*</span><span style="color:#0000CC;">*</span><span style="color:#0000CC;">*</span><br /> </span> </li> <li> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Slave_IO_State: Waiting <span style="color:#0000FF;">for</span> master <span style="color:#0000FF;">to</span> send event<br /> </li> <li> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Master_Host: 10<span style="color:#0000CC;">.</span>139<span style="color:#0000CC;">.</span>52<span style="color:#0000CC;">.</span>164<br /> </li> <li> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Master_User: ideal<br /> </li> <li> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Master_Port: 3306<br /> </li> <li> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Connect_Retry: 60<br /> </li> <li> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Master_Log_File: mysql-master-<span style="color:#FF0000;">bin</span><span style="color:#0000CC;">.</span>000007<br /> </li> <li> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Read_Master_Log_Pos: 1036536095<br /> </li> <li> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Relay_Log_File: wmback-relay-<span style="color:#FF0000;">bin</span><span style="color:#0000CC;">.</span>000011<br /> </li> <li> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Relay_Log_Pos: 1036536265<br /> </li> <li> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Relay_Master_Log_File: mysql-master-<span style="color:#FF0000;">bin</span><span style="color:#0000CC;">.</span>000007<br /> </li> <li> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#E53333;"><strong>Slave_IO_Running: Yes</strong></span><br /> </li> <li> <span style="color:#E53333;"><strong>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Slave_SQL_Running: Yes</strong></span><br /> </li> <li> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Replicate_Do_DB: <br /> </li> <li> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Replicate_Ignore_DB: <br /> </li> <li> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Replicate_Do_Table: <br /> </li> <li> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Replicate_Ignore_Table: <br /> </li> <li> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Replicate_Wild_Do_Table: <br /> </li> <li> &nbsp;&nbsp;Replicate_Wild_Ignore_Table: <br /> </li> <li> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Last_Errno: 0<br /> </li> <li> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Last_Error: <br /> </li> <li> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Skip_Counter: 0<br /> </li> <li> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Exec_Master_Log_Pos: 1036536095<br /> </li> <li> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Relay_Log_Space: 1036536493<br /> </li> <li> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Until_Condition: None<br /> </li> <li> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Until_Log_File: <br /> </li> <li> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Until_Log_Pos: 0<br /> </li> <li> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Master_SSL_Allowed: No<br /> </li> <li> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Master_SSL_CA_File: <br /> </li> <li> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Master_SSL_CA_Path: <br /> </li> <li> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Master_SSL_Cert: <br /> </li> <li> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Master_SSL_Cipher: <br /> </li> <li> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Master_SSL_Key: <br /> </li> <li> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Seconds_Behind_Master: 0<br /> </li> <li> Master_SSL_Verify_Server_Cert: No<br /> </li> <li> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Last_IO_Errno: 0<br /> </li> <li> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Last_IO_Error: <br /> </li> <li> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Last_SQL_Errno: 0<br /> </li> <li> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Last_SQL_Error: <br /> </li> <li> &nbsp;&nbsp;Replicate_Ignore_Server_Ids: <br /> </li> <li> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Master_Server_Id: 1<br /> </li> <li> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Master_UUID: 10162a19-2c75-11e5-af6c-00163e0007a0<br /> </li> <li> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Master_Info_File: <span style="color:#0000CC;">/</span>mydata<span style="color:#0000CC;">/</span>mysql<span style="color:#0000CC;">/</span>master<span style="color:#0000CC;">.</span>info<br /> </li> <li> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;SQL_Delay: 0<br /> </li> <li> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;SQL_Remaining_Delay: <span style="color:#0000FF;">NULL</span><br /> </li> <li> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Slave_SQL_Running_State: Slave has read all relay <span style="color:#FF0000;">log</span><span style="color:#0000CC;">;</span> waiting <span style="color:#0000FF;">for</span> the slave I<span style="color:#0000CC;">/</span>O thread <span style="color:#0000FF;">to</span> <span style="color:#0000FF;">update</span> it<br /> </li> <li> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Master_Retry_Count: 86400<br /> </li> <li> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Master_Bind: <br /> </li> <li> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Last_IO_Error_Timestamp: <br /> </li> <li> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Last_SQL_Error_Timestamp: <br /> </li> <li> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Master_SSL_Crl: <br /> </li> <li> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Master_SSL_Crlpath: <br /> </li> <li> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Retrieved_Gtid_Set: <br /> </li> <li> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Executed_Gtid_Set: <br /> </li> <li> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Auto_Position: 0<br /> </li> <li> 1 row <span style="color:#0000FF;">in</span> <span style="color:#0000FF;">set</span> <span style="color:#0000CC;">(</span>0<span style="color:#0000CC;">.</span>00 sec<span style="color:#0000CC;">)</span><br /> </li> <li> <br /> </li> <li> ERROR: <br /> </li> <li> No query specified </li> </ol> </div> </div> <p> <br /> </p> <p style="margin-left:38.25pt;text-indent:21.1pt;"> <b>Slave_IO_Running: Yes</b> </p> <p style="margin-left:38.25pt;text-indent:21.1pt;"> <b>Slave_SQL_Running: Yes</b> </p> <p style="margin-left:38.25pt;text-indent:0cm;"> 看到兩個<span style="color:#E53333;"><strong>Yes&nbsp;</strong></span>表示主從搭建成功,可以測試建立資料庫,表並插入資料,我這裡是成功的。 </p>

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/30936525/viewspace-2016541/,如需轉載,請註明出處,否則將追究法律責任。

相關文章