亚洲激情专区-91九色丨porny丨老师-久久久久久久女国产乱让韩-国产精品午夜小视频观看

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

如何安裝mysql-mmm

發布時間:2022-01-14 16:06:30 來源:億速云 閱讀:500 作者:小新 欄目:數據庫

小編給大家分享一下如何安裝mysql-mmm,相信大部分人都還不怎么了解,因此分享這篇文章給大家參考一下,希望大家閱讀完這篇文章后大有收獲,下面讓我們一起去了解一下吧!

安裝mysql-mmm

1)安裝epel

相關文檔參見:http://fedoraproject.org/wiki/EPEL

rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-4.noarch.rpm

2) monitor軟件安裝

 [root@localhost ~]# yum install –y mysql-mmm-monitor-*

包如下:

[root@localhost ~]# rpm -qa|grep mysql

mysql-mmm-monitor-2.2.1-1.el5

mysql-mmm-2.2.1-1.el5

mysql-5.0.77-4.el5_5.4

3)所在機器安裝(包括master,slave)

[root@localhost ~]# yum install –y -mmm-agent*

包如下:

[root@localhost ~]# rpm -qa|grep mysql

mysql-test-5.0.77-4.el5_5.4

mysql-mmm-agent-2.2.1-1.el5

mysql-5.0.77-4.el5_5.4

mysql-server-5.0.77-4.el5_5.4

mysql-devel-5.0.77-4.el5_5.4

mysql-bench-5.0.77-4.el5_5.4

mysql-mmm-2.2.1-1.el5

mysql-connector-odbc-3.51.26r1127-1.el5

配置文件

1)monitor配置文件

[root@localhost ~]# vi /etc/mysql-mmm/mmm_mon.conf

include mmm_common.conf

<monitor>

    ip                  127.0.0.1

    pid_path            /var/run/mysql-mmm/mmm_mond.pid

    bin_path            /usr/libexec/mysql-mmm

    status_path         /var/lib/mysql-mmm/mmm_mond.status

    ping_ips            172.16.71.128,172.16.71.130 #master,slave實際數據庫ip

    auto_set_online     60

</monitor>

<host default>

    monitor_user        mmm_monitor

    monitor_password    10jqka

</host>

Debug

2)通用的配置文件,在monitor及master,slave上放置的這個文件都一致

[root@localhost ~]# vi /etc/mysql-mmm/mmm_common.conf

active_master_role      writer

<host default>

    cluster_interface       eth0

    pid_path                /var/run/mysql-mmm/mmm_agentd.pid

    bin_path                /usr/libexec/mysql-mmm/

    replication_user        replicant

    replication_password    10jqka

    agent_user              mmm_agent

    agent_password          10jqka

</host>

<host db1>

    ip      172.16.71.128 #真實master數據庫ip

    mode    master

    peer    db2

</host>

<host db2>

    ip      172.16.71.130 #真實master數據庫ip

    mode    master

    peer    db1

</host>

#<host db3>

#    ip      192.168.100.51 #真實slave數據庫ip

#    mode    slave

#</host>

<role writer>

    hosts   db1, db2

    ips     172.16.71.253 #虛擬寫數據庫ip

    mode    exclusive

</role>

<role reader>

    hosts   db1, db2

    ips     172.16.71.251,172.16.71.252 #虛擬讀數據庫ip

    mode    balanced

</role>

3)master,slave配置文件

[root@localhost ~]# vi /etc/mysql-mmm/mmm_agent.conf

include mmm_common.conf

# The 'this' variable refers to this server. Proper operation requires

# that 'this' server (db1 by default), as well as all other servers, have the

# proper IP addresses set in mmm_common.conf.

this db1#如為第一臺master db則為db1如為第二臺則為db2與mmm_common.conf里的機器對應

查看效果

1)啟動db1的相關服務

service mysqld start

service mysql-mmm-agent start

數據庫授權:所有數據庫的授權一致

GRANT REPLICATION CLIENT ON *.* TO 'mmm_monitor'@'172.16.71.%' IDENTIFIED BY '10jqka';

GRANT SUPER, REPLICATION CLIENT, PROCESS ON *.* TO 'mmm_agent'@'172.16.71.%'   IDENTIFIED BY '10jqka';

grant all on *.* to replicant@'172.16.71.%' identified by '10jqka';

flush privileges;

2)啟動monitor相關服務

service mysql-mmm-monitor start

查看狀態:

mmm_control show

把db1設置為online狀態:

mmm_control set_online db1

開放mmm_agentd端口9989

真實機器查看分配的vip地址

[root@localhost ~]# ip a

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue

    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00

    inet 127.0.0.1/8 scope host lo

    inet6 ::1/128 scope host

       valid_lft forever preferred_lft forever

2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast qlen 1000

    link/ether 00:0c:29:ef:79:70 brd ff:ff:ff:ff:ff:ff

    inet 172.16.71.132/24 brd 172.16.71.255 scope global eth0

    inet 172.16.71.251/32 scope global eth0

    inet 172.16.71.253/32 scope global eth0

    inet6 fe80::20c:29ff:feef:7970/64 scope link

       valid_lft forever preferred_lft forever

主主(master-master)同步配置

1)172.16.71.132機器my.cnf

skip-name-resolve

server_id           = 132

set-variable = key_buffer_size=512M

set-variable = table_cache=32

set-variable = sort_buffer_size=32M

set-variable = read_buffer_size=32M

set-variable = max_connections=2100

set-variable = log_slow_queries=/var/lib/mysql/log/mysql-slow.log

set-variable = log_bin=/var/lib/mysql/log/mysql-bin

set-variable = long_query_time=1

set-variable = thread_concurrency=16

set-variable = tmp_table_size=4000000000

set-variable = slave_skip_errors=all

#replicate-ignore-db=mysql

#replicate-ignore-db=test 發覺加上這個ignore選項后會導致mmm接管出現點小問題不知道為什么

log-slave-updates

sync_binlog=1

auto_increment_increment=2

auto_increment_offset=1

進入mysql配置設置為從

mysql> change master to master_host='172.16.71.128';

mysql>change master to master_user='repl';

mysql>change master to master_password='10jqka';

mysql>start slave

主(master)服務器配置:

GRANT REPLICATION SLAVE ON *.* TO 'repl'@'172.16.71.%' IDENTIFIED BY '10jqka';

2)172.16.71.128機器my.cnf配置

skip-name-resolve

server_id           = 1

set-variable = key_buffer_size=512M

set-variable = table_cache=32

set-variable = sort_buffer_size=32M

set-variable = read_buffer_size=32M

set-variable = max_connections=2100

set-variable = log_slow_queries=/var/lib/mysql/log/mysql-slow.log

set-variable = log_bin=/var/lib/mysql/log/mysql-bin

set-variable = long_query_time=1

set-variable = thread_concurrency=16

set-variable = tmp_table_size=4000000000

set-variable = slave_skip_errors=all

#replicate-ignore-db=mysql

#replicate-ignore-db=test

log-slave-updates

sync_binlog=1

auto_increment_increment=2

auto_increment_offset=2

進入mysql配置設置為從

mysql> change master to master_host='172.16.71.132';

mysql>change master to master_user='repl';

mysql>change master to master_password='10jqka';

mysql>start slave

主(master)服務器配置:

GRANT REPLICATION SLAVE ON *.* TO 'repl'@'172.16.71.%' IDENTIFIED BY '10jqka';

其它從(slave)服務器配置:

my.cnf配置

skip-name-resolve

server_id           = 1

set-variable = key_buffer_size=512M

set-variable = table_cache=32

set-variable = sort_buffer_size=32M

set-variable = read_buffer_size=32M

set-variable = max_connections=2100

set-variable = log_slow_queries=/var/lib/mysql/log/mysql-slow.log

set-variable = log_bin=/var/lib/mysql/log/mysql-bin

set-variable = long_query_time=1

set-variable = thread_concurrency=16

set-variable = tmp_table_size=4000000000

set-variable = slave_skip_errors=all

mysql>change master to master_host='172.16.71.253';

mysql>change master to master_user='repl';

mysql>change master to master_password='10jqka';                           mysql>change master to master_log_file=&rsquo;mysql-bin.00001&rsquo;;

mysql>change master to master_log_pos=128;                                mysql>start slave

或者在my.cnf加入

server-id=2

master-host=172.16.71.253

master-user=repl

master-password=10jqka

問題1:

兩臺機器互為對方的主,此時不能使用master的VIP作為該兩機器的主,如果使用VIP作為master的話沒有一臺先起來作為vip機器的話些會導致monitor不能使用,日志如下:

2010/12/06 16:29:46 WARN db1 is not replicating from db2

2010/12/06 16:29:46 WARN db2 is not replicating from db1

問題2:

當/etc/mysql-mmm/mmm_mon.conf的auto_set_online     3時間設置為較長時,在瞬間關閉現有主,開啟現未開啟的備時,會導致monitor不能自動切換VIP導致mmm不可用,需要手工設置online狀態,有時候甚至會導致monitor啟動問題。為防止這情況發生可以把該時間設置短些,或者先讓一其中的一臺主起來后,再關閉另一臺。

問題3:ERROR:Can't connect to monitor daemon

查看進程一般少了perl相關進程,莫名其妙的感覺,經多次嘗試試驗,一般都是在mysql那些擁有agent機器上的配置問題,還有monitor的auto_set_online時間設置

[root@localhost ~]# ps axu|grep mmm

root      3113 0.0 7.6 14000 8956 ?        S    16:27   0:00 mmm_mond

root      3115 0.9 33.2 106440 38976 ?        Sl   16:27   0:00 mmm_mond

root      3136 0.4 5.5 10388 6456 ?        S    16:28   0:00 perl /usr/libexec/mysql-mmm/monitor/checker ping_ip

root      3140 0.4 6.5 15208 7640 ?        S    16:28   0:00 perl /usr/libexec/mysql-mmm/monitor/checker mysql

root      3141 0.3 5.4 10388 6448 ?        S    16:28   0:00 perl /usr/libexec/mysql-mmm/monitor/checker ping

root      3142 0.5 6.5 15208 7636 ?        S    16:28   0:00 perl /usr/libexec/mysql-mmm/monitor/checker rep_backlog

root      3144 0.6 6.4 15208 7592 ?        S    16:28   0:00 perl /usr/libexec/mysql-mmm/monitor/checker rep_threads

root      3148 0.0 0.5   3916   652 pts/0    R+   16:28   0:00 grep mmm

其它補充資料

主從狀態查看:

查看master的狀態

SHOW MASTER STATUS;

Position不應為0

查看slave的狀態

show slave status;

Slave_IO_Running | Slave_SQL_Running這兩個字段 應為YES|YES.

show processlist;查看進程

slave start; #啟動從復制

STOP SLAVE; #停止從復制

RESET MASTER; #重設master日志

RESET SLAVE;#重設slave日志

當Slave_IO_Running: 為No時,從服務器無法同步時操作下如

SLAVE STOP;#停止slave

CHANGE MASTER TO MASTER_LOG_FILE='mysql-bin.000001', MASTER_LOG_POS=0;

#把master_log_file設置為從主show master status;得出來的日志名,POS設置為0

SLAVE START;#再次啟用slave

Mysql普通主從配置(未使用mmm參考)

配置主從my.cnf文件:

skip-innodb

skip-name-resolve

server_id           = 132

set-variable = key_buffer_size=512M

set-variable = table_cache=32

set-variable = sort_buffer_size=32M

set-variable = read_buffer_size=32M

set-variable = max_connections=2100

set-variable = log_slow_queries=/var/lib/mysql/log/mysql-slow.log

set-variable = log_bin=/var/lib/mysql/log/mysql-bin#從庫這條語句注釋掉

set-variable = long_query_time=1

set-variable = thread_concurrency=16

set-variable = tmp_table_size=4000000000

set-variable = slave_skip_errors=all

因為mysql版本不同在從服務器下開啟了下面選項導致同步不能進行

replicate-ignore-db=mysql

replicate-do-db =test

以上是“如何安裝mysql-mmm”這篇文章的所有內容,感謝各位的閱讀!相信大家都有了一定的了解,希望分享的內容對大家有所幫助,如果還想學習更多知識,歡迎關注億速云行業資訊頻道!

向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

抚远县| 廊坊市| 龙井市| 八宿县| 潼关县| 马山县| 砀山县| 武平县| 宁蒗| 盘锦市| 会宁县| 台州市| 安宁市| 金乡县| 惠州市| 庆城县| 台东县| 苏尼特左旗| 华蓥市| 和林格尔县| 龙口市| 安图县| 澎湖县| 桂东县| 蕲春县| 芜湖市| 武功县| 开平市| 综艺| 亚东县| 辽源市| 玛多县| 海阳市| 繁峙县| 临高县| 广饶县| 施秉县| 张北县| 沈丘县| 静宁县| 渭源县|