真实的国产乱ⅩXXX66竹夫人,五月香六月婷婷激情综合,亚洲日本VA一区二区三区,亚洲精品一区二区三区麻豆

成都創(chuàng)新互聯(lián)網(wǎng)站制作重慶分公司

mysql多實(shí)例部署

1.修改my.cnf
[MySQL]

[mysqld_multi]
mysqld = /usr/local/mysql/bin/mysqld_safe
mysqladmin = /usr/local/mysql/bin/mysqladmin
user =
password =

[mysqld1]
#explicit_defaults_for_timestamp=true
port = 3306
skip-name-resolve
server_id=1
datadir=/data/master
max_connections=3000
slow-query-log=on ##開(kāi)啟慢查詢
slow-query-log-file=/var/log/mysql1/mysql-slow-queries.log
long_query_time=3
##開(kāi)啟二進(jìn)制文件
log-bin=/data/master_binlog/mysql1_bin.log
log-bin-index=/data/master_binlog/binlog.index
binlog-do-db=ibuy
innodb_buffer_pool_size=2G #緩存
innodb_log_file_size = 512M
innodb_log_files_in_group = 3
innodb_additional_mem_pool_size = 64M
socket=/var/lib/mysql/mysql3306.sock
pid-file=/data/master/mysql.pid
#query_cache_size = 128M #查詢緩存,合適查操作比較多的數(shù)據(jù)庫(kù)
symbolic-links=0
sql_mode=STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION
log-error=/var/log/mysql1/mysqld.log
user=mysql




[mysqld2]
port=3307
server_id=2
explicit_defaults_for_timestamp=true
skip-name-resolve
datadir=/data/slave
max_connections=3000
slow-query-log=on ##開(kāi)啟慢查詢
slow-query-log-file=/var/log/mysql2/mysql-slow-queries.log
long_query_time=3
log-bin=/data/slave_binlog/mysql_bin.log ##開(kāi)啟二進(jìn)制文件
log-bin-index=/data/slave_binlog/binlog.index
binlog-do-db=ibuy
innodb_buffer_pool_size=3G #緩存
innodb_log_file_size = 512M
innodb_log_files_in_group = 3
innodb_additional_mem_pool_size = 64M
socket=/var/lib/mysql/mysql3307.sock
pid-file=/data/slave/mysql.pid
#query_cache_size =512M #查詢緩存,合適查操作比較多的數(shù)據(jù)庫(kù)
symbolic-links=0
sql_mode=STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION
log-error=/var/log/mysql2/mysqld.log
user=mysql

[mysqld_safe]
#max_allowed_packet=20480
#log-error=/var/log/mysql/mysqld.log
#pid-file=/var/run/mysqld/mysqld.pid

2.創(chuàng)建數(shù)據(jù)目錄
		
  1. mkdir -p /data/master
  2. mkdir -p /data/slave
  3. mkdir -p /data/master_binlog
  4. mkdir -p /data/slave_binlog
  5. mkdir /var/log/mysql1
  6. mkdir/var/log/mysql2
  7. chown mysql.mysql /data/master -R
  8. chown mysql.mysql /data/slave -R
  9. chmod 777 /var/log/mysql1
  10. chmod 777/var/log/mysql2
  11. chmod 777 /var/lib/mysql
3.初始化DB
/usr/local/mysql/scripts/mysql_install_db--datadir=/data/master
/usr/local/mysql/scripts/mysql_install_db--datadir=/data/slave
4. 安裝工具
	
  1. cp /usr/local/mysql/bin/my_print_defaults /usr/bin/
  2. cp /usr/local/mysql/bin/mysqld_multi /usr/bin
5.修改環(huán)境變量
#vim /etc/profile
PATH=$PATH:/usr/local/mysql/bin
export PATH


1.mysql啟動(dòng)

應(yīng)縣網(wǎng)站建設(shè)公司創(chuàng)新互聯(lián),應(yīng)縣網(wǎng)站設(shè)計(jì)制作,有大型網(wǎng)站制作公司豐富經(jīng)驗(yàn)。已為應(yīng)縣上千提供企業(yè)網(wǎng)站建設(shè)服務(wù)。企業(yè)網(wǎng)站搭建\外貿(mào)網(wǎng)站建設(shè)要多少錢,請(qǐng)找那個(gè)售后服務(wù)好的應(yīng)縣做網(wǎng)站的公司定做!

	
  1. mysqld_multi start 1 啟動(dòng)實(shí)例1
  2. mysqld_multi start 1-2 啟動(dòng)實(shí)例1,2

2.命令行登陸

	
  1. mysql -u your_user -p your_password -P3307 -S /tmp/mysql3307.sock
由于涉及權(quán)限問(wèn)題,mysqld_multi不能控制關(guān)閉mysql多實(shí)例,自己寫了個(gè)關(guān)閉腳本
#!/bin/bash
user=""
password=""
read -p "Please input mysqld ID 1-2:" ID
if [ "$ID" == "1" ]; then
#read -p "Please input mysqld port number 3306-3307:" port
/usr/local/mysql/bin/mysqladmin -u$user -p$password -S /var/lib/mysql/mysql3306.sock shutdown && echo "close mysqld master successful"
elif [ "$ID" == "2" ]; then
/usr/local/mysql/bin/mysqladmin -u$user -p$password -S /var/lib/mysql/mysql3307.sock shutdown && echo "close mysqld slave successful"
else
echo "Please input mysqld ID 1-2:"
fi

網(wǎng)頁(yè)名稱:mysql多實(shí)例部署
網(wǎng)站路徑:http://weahome.cn/article/gshhgi.html

其他資訊

在線咨詢

微信咨詢

電話咨詢

028-86922220(工作日)

18980820575(7×24)

提交需求

返回頂部