中文字幕av专区_日韩电影在线播放_精品国产精品久久一区免费式_av在线免费观看网站

溫馨提示×

溫馨提示×

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

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

MySQL單機多實例部署

發布時間:2020-07-07 07:11:24 來源:網絡 閱讀:1333 作者:hnr1017 欄目:MySQL數據庫

一、MySQL多實例部署

版本:5.7.18

1.軟件安裝

# tar xf mysql-5.7.18-linux-glibc2.5-x86_64.tar.gz -C /usr/local
# cd /usr/local
# chown -R root.root mysql-5.7.18-linux-glibc2.5-x86_64
# ln -sv mysql-5.7.18-linux-glibc2.5-x86_64 mysql5.7.18
# mkdir /data/{mydata3307,mydata3308}
# chown -R mysql.mysql /data/mydata33*

2.提供多實例服務啟動腳本

# cd /usr/local/mysql5.7.18
# cp support-files/mysqld_multi.server /etc/init.d/mysqld_multi
# chmod +x /etc/init.d/mysqld_multi
# chkconfig --add mysqld_multi
# vi /etc/init.d/mysqld_multi
export PATH=$PATH:/usr/local/mysql5.7.18/bin
basedir=/usr/local/mysql5.7.18
bindir=/usr/local/mysql5.7.18/bin

3.提供配置文件

# cat /etc/my.cnf
[mysql]
#password = 123456
#prompt = [\\u@\\h][\\d]>\\_
socket          = /tmp/mysql5.7.18.sock
[client]
#password = 123456
#prompt = [\\u@\\h][\\d]>\\_
socket          = /tmp/mysql5.7.18.sock
[mysqld_multi]
mysqld = /usr/local/mysql5.7.18/bin/mysqld_safe
mysqladmin =/usr/local/mysql5.7.18/bin/mysqladmin
log =/data/mydata3307/mysqld_multi.log
# 每個實例都設置統一管理密碼,方便使用服務腳本停止實例
user = root
pass = 123456
#初始化需要[mysqld]段配置,否則初始化的時候加載不到[mysqld3307]及[mysqld3308]段中關于設置獨立undo表空間及共享表空間大小
[mysqld]
innodb_buffer_pool_size = 4096M
#innodb_buffer_pool_size = 16384M
innodb_undo_log_truncate=ON
innodb_undo_tablespaces = 2
innodb_data_file_path=ibdata1:1G:autoextend
[mysqld3307]
innodb_buffer_pool_size = 4096M
#innodb_buffer_pool_size = 16384M
port = 3307
socket          = /data/mydata3307/mysql5.7.18.sock
skip-external-locking
key_buffer_size = 256M
max_allowed_packet = 10M
table_open_cache = 256
sort_buffer_size = 1M
read_buffer_size = 1M
read_rnd_buffer_size = 4M
myisam_sort_buffer_size = 16M
thread_cache_size = 4
max_connections=1500
character_set_server=utf8
group_concat_max_len=65535
log_bin_trust_function_creators=1
log_queries_not_using_indexes = ON
log_throttle_queries_not_using_indexes = 2
interactive_timeout = 600
wait_timeout = 600
connect_timeout = 10
expire_logs_days = 30
replicate-ignore-db=information_schema
replicate-ignore-db=performance_schema
replicate-ignore-db=mysql
replicate-ignore-db=sys
log_timestamps=SYSTEM
innodb_print_all_deadlocks=1
basedir=/usr/local/mysql5.7.18
datadir=/data/mydata3307
innodb_undo_log_truncate=ON
innodb_undo_tablespaces = 2
innodb_data_file_path=ibdata1:1G:autoextend
core_file
sync_binlog = 0
innodb_flush_log_at_trx_commit = 2
##Master
#log-bin=mysql-bin
log-bin=/data/mydata3307/mysql-bin
#binlog_format=mixed
binlog_format=row
server-id=3307
lower_case_table_names = 1
skip-name-resolve
innodb_file_per_table=1
long_query_time=2
slow_query_log=1
slow_query_log_file=/data/mydata3307/slow-query.log
sql_mode='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'
#slave
slave-parallel-type=LOGICAL_CLOCK
#slave-parallel-workers=16
slave-parallel-workers=4
master_info_repository=TABLE
relay_log_info_repository=TABLE
relay_log_recovery=ON
slave_preserve_commit_order=1
log-slave-updates=true
slave_skip_errors='1032,1062'
relay_log=/data/mydata3307/localhost-relay-bin
####gtid######
gtid_mode = ON
enforce_gtid_consistency = ON
master_verify_checksum = 1
slave_sql_verify_checksum = 1
[mysqld3308]
innodb_buffer_pool_size = 2048M
#innodb_buffer_pool_size = 16384M
port = 3308
socket          = /data/mydata3308/mysql5.7.18.sock
skip-external-locking
key_buffer_size = 256M
max_allowed_packet = 10M
table_open_cache = 256
sort_buffer_size = 1M
read_buffer_size = 1M
read_rnd_buffer_size = 4M
myisam_sort_buffer_size = 16M
thread_cache_size = 4
max_connections=1500
character_set_server=utf8
group_concat_max_len=65535
log_bin_trust_function_creators=1
log_queries_not_using_indexes = ON
log_throttle_queries_not_using_indexes = 2
interactive_timeout = 600
wait_timeout = 600
connect_timeout = 10
expire_logs_days = 30
replicate-ignore-db=information_schema
replicate-ignore-db=performance_schema
replicate-ignore-db=mysql
replicate-ignore-db=sys
log_timestamps=SYSTEM
innodb_print_all_deadlocks=1
basedir=/usr/local/mysql5.7.18
datadir=/data/mydata3308
innodb_undo_log_truncate=ON
innodb_undo_tablespaces = 2
innodb_data_file_path=ibdata1:1G:autoextend
core_file
sync_binlog = 0
innodb_flush_log_at_trx_commit = 2
##Master
#log-bin=mysql-bin
log-bin=/data/mydata3308/mysql-bin
#binlog_format=mixed
binlog_format=row
server-id=3308
lower_case_table_names = 1
skip-name-resolve
innodb_file_per_table=1
long_query_time=2
slow_query_log=1
slow_query_log_file=/data/mydata3308/slow-query.log
sql_mode='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'
#slave
slave-parallel-type=LOGICAL_CLOCK
#slave-parallel-workers=16
slave-parallel-workers=4
master_info_repository=TABLE
relay_log_info_repository=TABLE
relay_log_recovery=ON
slave_preserve_commit_order=1
log-slave-updates=true
slave_skip_errors='1032,1062'
relay_log=/data/mydata3308/localhost-relay-bin
####gtid######
gtid_mode = ON
enforce_gtid_consistency = ON
master_verify_checksum = 1
slave_sql_verify_checksum = 1

4.初始化實例

實例3307
# cd /usr/local/mysql5.7.18/bin
# ./mysqld --user=mysql --basedir=/usr/local/mysql5.7.18/ --datadir=/data/mydata3307/ --initialize --initialize-insecure
實例3308
# ./mysqld --user=mysql --basedir=/usr/local/mysql5.7.18/ --datadir=/data/mydata3308/ --initialize --initialize-insecure

5.啟動服務

# service mysqld_multi start
# service mysqld_multi report
Reporting MySQL servers
MySQL server from group: mysqld3307 is running
MySQL server from group: mysqld3308 is running
# ss -ntpl | grep mysqld
LISTEN     0      128                      :::3307                    :::*      users:(("mysqld",8004,29))
LISTEN     0      128                      :::3308                    :::*      users:(("mysqld",8003,29))
多實例啟動成功

6.設置管理賬號密碼

默認初始化密碼為空,提示輸入密碼時,直接回車
# mysqladmin -uroot -p password 123456 -S /data/mydata3307/mysql5.7.18.sock
# mysqladmin -uroot -p password 123456 -S /data/mydata3308/mysql5.7.18.sock

7.停止實例

# service mysqld_multi stop 3307
# service mysqld_multi report
Reporting MySQL servers
MySQL server from group: mysqld3307 is not running
MySQL server from group: mysqld3308 is running

注意:

多實例服務啟動腳本啟動報錯

[root@localhost mysql5.7.18]# service mysqld_multi start

WARNING: my_print_defaults command not found.

Please make sure you have this command available and

in your path. The command is available from the latest

MySQL distribution.

ABORT: Can't find command 'my_print_defaults'.

This command is available from the latest MySQL

distribution. Please make sure you have the command

in your PATH.

修改/etc/init.d/mysqld_multi

export PATH=$PATH:/usr/local/mysql5.7.18/bin


向AI問一下細節

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

AI

怀来县| 宁陵县| 兴国县| 运城市| 区。| 广汉市| 吉隆县| 景泰县| 泊头市| 平昌县| 新闻| 绿春县| 罗源县| 柯坪县| 偃师市| 高平市| 同江市| 开阳县| 育儿| 南通市| 晴隆县| 岚皋县| 于田县| 嘉峪关市| 梅河口市| 安义县| 常德市| 修水县| 达拉特旗| 宜春市| 家居| 东安县| 石家庄市| 得荣县| 凉城县| 林芝县| 岳阳市| 巴林右旗| 罗定市| 青田县| 安顺市|