这篇文章给大家介绍如何进行Mysql多实例配置管理,内容非常详细,感兴趣的小伙伴们可以参考借鉴,希望对大家能有所帮助。mysql 多实例配置管理配置多实例my.cnf:[root@open_source&n
这篇文章给大家介绍如何进行Mysql多实例配置管理,内容非常详细,感兴趣的小伙伴们可以参考借鉴,希望对大家能有所帮助。
[root@open_source 3309]# cat /mysql/3307/my.cnf
[mysqld]
user=mysql
basedir=/usr/local/mysql
datadir=/mysql/3307/data
Socket=/tmp/mysql3307.sock
port=3307
server_id=7
[root@open_source 3309]# cat /mysql/3308/my.cnf
[mysqld]
user=mysql
basedir=/usr/local/mysql
datadir=/mysql/3308/data
socket=/tmp/mysql3308.sock
port=3308
server_id=8
[root@open_source 3309]# cat /mysql/3309/my.cnf
[mysqld]
user=mysql
basedir=/usr/local/mysql
datadir=/mysql/3309/data
socket=/tmp/mysql3309.sock
port=3309
server_id=9
mysqld --initialize-insecure --user=mysql --basedir=/usr/local/mysql --datadir=/mysql/3307/data/
mysqld --initialize-insecure --user=mysql --basedir=/usr/local/mysql --datadir=/mysql/3308/data/
mysqld --initialize-insecure --user=mysql --basedir=/usr/local/mysql --datadir=/mysql/3309/data/
[root@open_source 3309]# mysqld_safe --defaults-file=/mysql/3307/my.cnf &
[root@open_source 3309]# mysqld_safe --defaults-file=/mysql/3308/my.cnf &
[root@open_source 3309]# mysqld_safe --defaults-file=/mysql/3309/my.cnf &
[root@open_source 3309]# ps -ef|grep mysql |grep -v grep
root 10251 7511 0 18:57 pts/1 00:00:00 /bin/sh /usr/local/mysql/bin/mysqld_safe --defaults-file=/mysql/3307/my.cnf
mysql 10428 10251 0 18:57 pts/1 00:00:00 /usr/local/mysql/bin/mysqld --defaults-file=/mysql/3307/my.cnf --basedir=/usr/local/mysql --datadir=/mysql/3307/data --plugin-dir=/usr/local/mysql/lib/plugin --user=mysql --log-error=open_source.err --pid-file=open_source.pid --socket=/tmp/mysql3307.sock --port=3307
root 10464 7511 0 18:59 pts/1 00:00:00 /bin/sh /usr/local/mysql/bin/mysqld_safe --defaults-file=/mysql/3308/my.cnf
mysql 10641 10464 0 18:59 pts/1 00:00:01 /usr/local/mysql/bin/mysqld --defaults-file=/mysql/3308/my.cnf --basedir=/usr/local/mysql --datadir=/mysql/3308/data --plugin-dir=/usr/local/mysql/lib/plugin --user=mysql --log-error=open_source.err --pid-file=open_source.pid --socket=/tmp/mysql3308.sock --port=3308
root 10672 7511 0 19:00 pts/1 00:00:00 /bin/sh /usr/local/mysql/bin/mysqld_safe --defaults-file=/mysql/3309/my.cnf
mysql 10849 10672 0 19:00 pts/1 00:00:01 /usr/local/mysql/bin/mysqld --defaults-file=/mysql/3309/my.cnf --basedir=/usr/local/mysql --datadir=/mysql/3309/data --plugin-dir=/usr/local/mysql/lib/plugin --user=mysql --log-error=open_source.err --pid-file=open_source.pid --socket=/tmp/mysql3309.sock --port=3309
[root@open_source 3309]# netstat -anlt |grep 33
tcp6 0 0 :::3307 :::* LISTEN
tcp6 0 0 :::3308 :::* LISTEN
tcp6 0 0 :::3309 :::* LISTEN
[root@open_source 3309]# mysql -S /tmp/mysql3307.sock -e "select @@server_id"
+-------------+
| @@server_id |
+-------------+
| 7 |
+-------------+
[root@open_source 3309]# mysql -S /tmp/mysql3308.sock -e "select @@server_id"
+-------------+
| @@server_id |
+-------------+
| 8 |
+-------------+
[root@open_source 3309]# mysql -S /tmp/mysql3309.sock -e "select @@server_id"
+-------------+
| @@server_id |
+-------------+
| 9 |
+-------------+
[root@open_source ~]# mysqladmin -S /tmp/mysql3307.sock shutdown
2020-03-10T00:04:36.491980Z mysqld_safe mysqld from pid file /mysql/3307/data/open_source.pid ended
[1] Done mysqld_safe --defaults-file=/mysql/3307/my.cnf (wd: /mysql/3309)
(wd now: ~)
[root@open_source ~]# mysqladmin -S /tmp/mysql3308.sock shutdown
2020-03-10T00:04:45.304744Z mysqld_safe mysqld from pid file /mysql/3308/data/open_source.pid ended
[2]- Done mysqld_safe --defaults-file=/mysql/3308/my.cnf (wd: /mysql/3309)
(wd now: ~)
[root@open_source ~]# mysqladmin -S /tmp/mysql3309.sock shutdown
2020-03-10T00:04:54.383289Z mysqld_safe mysqld from pid file /mysql/3309/data/open_source.pid ended
[3]+ Done mysqld_safe --defaults-file=/mysql/3309/my.cnf (wd: /mysql/3309)
(wd now: ~)
关于如何进行MySQL多实例配置管理就分享到这里了,希望以上内容可以对大家有一定的帮助,可以学到更多知识。如果觉得文章不错,可以把它分享出去让更多的人看到。
--结束END--
本文标题: 如何进行MySQL多实例配置管理
本文链接: https://lsjlt.com/news/61495.html(转载时请注明来源链接)
有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
2024-10-23
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
回答
回答
回答
回答
回答
回答
回答
回答
回答
回答
0