自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

Ubuntu MySQL熱備份安裝

數(shù)據(jù)庫(kù) MySQL
Ubuntu又火了,MySQL來(lái)借東風(fēng)了,如何在Ubuntu下對(duì)MySQL進(jìn)行熱備份安裝?來(lái)看看,你會(huì)有收獲。

參考資料:

http://www.cnblogs.com/wuhou/archive/2008/09/28/1301071.html

http://www.hebaodans.com/2009/02/m-y-s-q-l-shu-ju-ku-de-tong-bu-wen-ti-shuang-ji-re-bei/

1.安裝最新的Ubuntu Server版本,并更新系統(tǒng)。

2.安裝MySQL Server:sudo apt-get instal mysql-server,然后設(shè)置管理員密碼,去掉本地地址綁定,以便可以進(jìn)行遠(yuǎn)程訪問(wèn)。

主:192.168.137.12

從:192.168.137.13

3.設(shè)置utf8字符集來(lái)支持中文,在主從服務(wù)器的配置文件/etc/mysql/my.cnf中加入:

[client]
default-character-set   = utf8

[mysqld]
default-character-set   = utf8

init_connect    = 'SET NAMES utf8;'

4.在服務(wù)器中啟動(dòng)備份。首先在主服務(wù)器在配置文件中添加下面的內(nèi)容。其中s3(舉個(gè)例子)為需要同步的數(shù)據(jù)庫(kù)。

[mysqld]

log-bin         = mysql-bin
server-id       = 1
binlog-do-db    = s3

5.重新啟動(dòng)主數(shù)據(jù)庫(kù)。

sudo service start mysql

6.連接到主數(shù)據(jù)庫(kù),并創(chuàng)建你需要同步的數(shù)據(jù)庫(kù),如果已經(jīng)存在可以忽略這一步。

mysql –u root –p

create database s3;

7.在服務(wù)器中添加一個(gè)賬號(hào)(sync)用于同步數(shù)據(jù)庫(kù),并賦予從備份的權(quán)限,重要。

grant replication slave on *.* to 'sync'@'%' identified by '12345'

8.記錄s3數(shù)據(jù)庫(kù)的日志文件名稱和位置,用于從機(jī)備份開始的位置。

mysql> show master status;
+------------------+----------+--------------+------------------+
| File             | Position | Binlog_Do_DB | Binlog_Ignore_DB |
+------------------+----------+--------------+------------------+
| mysql-bin.000007 |      106 | s3           |                  |
+------------------+----------+--------------+-----------------

9.修改從機(jī)的配置文件。

[mysqld]
server-id       = 2
read-only
master-connect-retry     = 60
replicate-do-db = s3

10.重新啟動(dòng)從機(jī),新建數(shù)據(jù)庫(kù)(s3)或者從原來(lái)的數(shù)據(jù)庫(kù)恢復(fù)數(shù)據(jù)庫(kù)。并執(zhí)行命令:

change master to MASTER_HOST='192.168.137.12', MASTER_USER='sync',MASTER_PASSWORD='12345',MASTER_LOG_FILE='mysql-bin.000007',MASTER_LOG_POS=106;

#p#

11.啟動(dòng)從機(jī)備份,并查看從機(jī)狀態(tài)

start slave;

show slave status\G;
*************************** 1. row ***************************
               Slave_IO_State: Waiting for master to send event
                  Master_Host: 192.168.137.12
                  Master_User: sync
                  Master_Port: 3306
                Connect_Retry: 60
              Master_Log_File: mysql-bin.000007
          Read_Master_Log_Pos: 106
               Relay_Log_File: S3-DB-SLAVE-1-relay-bin.000010
                Relay_Log_Pos: 251
        Relay_Master_Log_File: mysql-bin.000007
             Slave_IO_Running: Yes
            Slave_SQL_Running: Yes
              Replicate_Do_DB: s3
          Replicate_Ignore_DB:
           Replicate_Do_Table:
       Replicate_Ignore_Table:
      Replicate_Wild_Do_Table:
  Replicate_Wild_Ignore_Table:
                   Last_Errno: 0
                   Last_Error:
                 Skip_Counter: 0
          Exec_Master_Log_Pos: 106
              Relay_Log_Space: 559
              Until_Condition: None
               Until_Log_File:
                Until_Log_Pos: 0
           Master_SSL_Allowed: No
           Master_SSL_CA_File:
           Master_SSL_CA_Path:
              Master_SSL_Cert:
            Master_SSL_Cipher:
               Master_SSL_Key:
        Seconds_Behind_Master: 0
Master_SSL_Verify_Server_Cert: No
                Last_IO_Errno: 0
                Last_IO_Error:
               Last_SQL_Errno: 0
               Last_SQL_Error:
1 row in set (0.00 sec)

  • Slave_IO_Running: Yes
  • Slave_SQL_Running: Yes

表示工作正常,否者出現(xiàn)問(wèn)題。出現(xiàn)問(wèn)題重要的解決工具是查看日志記錄。

cat /var/log/mysql/error.log

原文鏈接:http://www.cnblogs.com/dyj057/archive/2011/10/14/2212647.html

【編輯推薦】

  1. 說(shuō)說(shuō)一些有用的MySQL語(yǔ)句
  2. Craigslist采用MongoDB替代MySQL
  3. MySQL中的NoSQL插件
  4. SQL與NoSQL——MySQL與NoSQL的融合
  5. 論MySQL何時(shí)使用索引,何時(shí)不使用索引
責(zé)任編輯:艾婧 來(lái)源: 南橋一夢(mèng)的博客
相關(guān)推薦

2011-03-29 15:15:06

熱備份熱修復(fù)

2011-04-13 11:33:37

HSRP

2011-09-01 10:56:19

ubuntu軟件

2010-01-06 10:04:55

2010-06-12 14:40:53

熱備份路由協(xié)議HSRP

2010-08-06 09:50:19

思科路由器

2010-06-01 10:26:49

MySQL安裝

2011-02-23 09:47:07

UbuntuProFTPdMySQL

2011-02-23 09:47:07

2010-01-07 16:47:01

2018-10-09 10:07:57

Ubuntu應(yīng)用程序軟件包

2011-09-05 18:27:46

Ubuntu

2010-05-14 16:57:31

MySQL 安裝備份

2010-02-22 14:53:49

Ubuntu ngin

2010-01-05 16:14:54

Ubuntu mysq

2010-01-07 17:16:19

Ubuntu MySQ

2019-04-28 10:00:11

UbuntuLinuxMySQL

2018-12-12 14:15:40

MongoDB熱備份工具數(shù)據(jù)庫(kù)

2010-03-12 14:38:55

2010-06-13 09:03:41

Grub安裝Ubunt
點(diǎn)贊
收藏

51CTO技術(shù)棧公眾號(hào)