In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article will explain in detail how to achieve multi-instance configuration in MySQL. The content of the article is of high quality, so the editor will share it with you for reference. I hope you will have some understanding of the relevant knowledge after reading this article.
1.1 what is Mysql multi-instance?
To put it simply, Mysql multi-instance means that multiple Mysql servers are run simultaneously on one server (for example, 3306 / 3307 / 3308). These service processes use different socket to listen on different service ports to provide services.
These Mysql multi-instances share a set of Mysql installers, using different my.cnf configuration files, startup programs, and data files. When providing services, multi-instance Mysql is logically independent, and they get the corresponding resources of the server according to the corresponding settings of the configuration files.
1.2 idea of multi-instance configuration:
1. Multiple independent catalogs
two。 Each instance has independent data (initialization data)
3. Multiple port
4. Multiple socket
5. Multiple initiators
6. Multiple log files
1.3 process of multi-instance configuration:
1.3.1 create a stand-alone directory:
Mkdir-p / data/ {3307 mysql.mysql 3308} chown-R mysql.mysql / data
1.3.2 write a configuration file for each instance:
[root@db01 ~] # cat / data/3307/ my.cnf [mysqld] basedir=/application/mysqldatadir=/data/3307socket=/data/3307/mysql.socklog-error=/data/3307/mysql.loglog_bin=/data/3307/mysql-binbinlog_format=rowskip_name_resolve=1server_id=3307port=3307
1.3.3 initialization data:
. / mysql_install_db-defaults-file=/data/3307/my.cnf-basedir=/application/mysql-datadir=/data/3307-user=mysql
1.3.4 start the instance:
Sh mysqld_safe-defaults-file=/data/3307/my.cnf-pid-file=/data/3307/3307.pid &
Shell scripts manage multi-instance services:
#! / bin/bash. / etc/init.d/functions. / etc/profile Start='/application/mysql/bin/mysqld_safe-- defaults-file=/data/3307/my.cnf-- pid-file=/data/3307/3307.pid'Stop='mysqladmin-uroot-S / data/3307/mysql.sock shutdown'Port= `ss-tunlp | grep 3307 | wc-l` function START () {if [$Port-ne 1]; then $Start > / dev/null 2 > & 1 & sleep 3 if [$?-eq 0] Then action 'MySQL 3307 Starting' / bin/true fi else action' MySQL 3307 Already Exists' / bin/true fi} function STOP () {if [$Port-ne 0]; then $Stop if [$?-eq 0]; then action 'MySQL Stoping Successfuly' / bin/true fi else action' MySQL already Stoped' / bin/true fi} function RESTART () {STOP sleep 1 START} case $1 instart) START;; stop) STOP; restart) RESTART;; *) echo "Usage: $0 {start | stop | restart}" Esac on how to achieve multi-instance configuration in MySQL to share here, I hope that the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.