Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to deploy a stand-alone machine using mysqld_multi in mysql

2025-04-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

In this issue, the editor will bring you about how to deploy a stand-alone machine using mysqld_multi in mysql. The article is rich in content and analyzes and describes for you from a professional point of view. I hope you can get something after reading this article.

1. Mysql compilation and installation:

Cd / usr/local/srcwget http://mirrors.sohu.com/mysql/MySQL-5.6/mysql-5.6.35-linux-glibc2.5-x86_64.tar.gz tar zxvf mysql-5.6.35-linux-glibc2.5-x86_64.tar.gzmv mysql-5.6.35-linux-glibc2.5-x86_64 / usr/local/mysqlcd / usr/local/mysqluseradd mysqlmkdir-p / data/mysqlchown-R mysql:mysql / data/mysql./scripts/mysql_ Install_db-user=mysql-datadir=/data/mysqlcp support-files/my-default.cnf / etc/my.cnfcp support-files/mysql.server / etc/init.d/mysqld II. Prepare the first multi-instance 3307

2.1 create a directory:

Mkdir / usr/local/mysql3307chown-R mysql.mysql / usr/local/mysql3307/mkdir-p / data/mysql3307chown-R mysql.mysql / data/mysql3307mkdir-p / home/data/mysql3307/binlogchown-R mysql.mysql / home/data/mysql3307

2.2 Profil

[root@zhdya01] # vim / etc/my.cnf# For advice on how to change settings please see# http://dev.mysql.com/doc/refman/5.6/en/server-configuration-defaults.html# * DO NOT EDIT THIS FILE. It's a template which will be copied to the# * default location during install And will be replaced if you# * * upgrade to a newer version of MySQL [mysqld _ multi] mysqld = / usr/local/mysql/bin/mysqld_safemysqladmin = / usr/local/mysql/bin/mysqladminlog = / var/log/mysqld_ multi.log [m ysqld1] socket = / usr/local/mysql3307/mysql.sockport = 3307pid-file = / usr/local/mysql3307/mysql.piddatadir = / data/mysql3307log_bin=/home/data/mysql3307/binlogserver-id = 1innodb_buffer_pool_size = 128Minnodb_flush_log_at_trx_commit = 0

2.3 initialize the database

/ usr/local/mysql/scripts/mysql_install_db-user=mysql-basedir=/usr/local/mysql-datadir=/data/mysql3307 III. Prepare the second multi-instance 3308

3.1 create a directory:

Mkdir / usr/local/mysql3308chown-R mysql.mysql / usr/local/mysql3308/mkdir-p / data/mysql3308chown-R mysql.mysql / data/mysql3308mkdir-p / home/data/mysql3308/binlogchown-R mysql.mysql / home/data/mysql3308

3.2 Profil

[root@zhdya01] # vim / etc/my.cnf# For advice on how to change settings please see# http://dev.mysql.com/doc/refman/5.6/en/server-configuration-defaults.html# * DO NOT EDIT THIS FILE. It's a template which will be copied to the# * default location during install And will be replaced if you# * * upgrade to a newer version of MySQL [mysqld _ multi] mysqld = / usr/local/mysql/bin/mysqld_safemysqladmin = / usr/local/mysql/bin/mysqladminlog = / var/log/mysqld_ multi.log [m ysqld1] socket = / usr/local/mysql3307/mysql.sockport = 3307pid-file = / usr/local/mysql3307/mysql.piddatadir = / data/mysql3307log_bin=/home/data/mysql3307/binlogserver-id = 1innodb_buffer_pool_size = 128Minnodbreadflush _ Log_at_trx_commit = 0 [mysqld2] socket = / usr/local/mysql3308/mysql.sockport = 3308pid-file = / usr/local/mysql3308/mysql.piddatadir = / data/mysql3308log_bin=/home/data/mysql3308/binlogserver-id = 2innodb_buffer_pool_size = 128Minnodb_flush_log_at_trx_commit = 0

3.3 initialize the database

/ usr/local/mysql/scripts/mysql_install_db-user=mysql-basedir=/usr/local/mysql-datadir=/data/mysql3308 IV. Launch multi-instance / etc/init.d/mysqld startmysqld_multi-- defaults-extra-file=/etc/my.cnf start 1 Magne2 [root@zhdya01 bin] #! netnetstat-lntp-lntpActive Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 0.0.0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. LISTEN 1241/sshd tcp 0 0127. 0. 0. 0. 1 of the 25 0. 0. 0. 0 of the LISTEN 2087/master tcp6. 00: 3306: * LISTEN 4406/mysqld tcp6 00: 3307: * LISTEN 4197/mysqld tcp6 00: 3308: * LISTEN 3359/mysqld tcp6 00: 8080: * LISTEN 2222/java tcp6 00: * LISTEN 1241/sshd tcp6 00:: 1:25:: * LISTEN 2087/master 5, Check the startup status [root@zhdya01 bin] # mysqld_multi-- defaults-extra-file=/etc/my.cnf reportReporting MySQL serversMySQL server from group: mysqld1 is runningMySQL server from group: mysqld2 is runing 6, stop multiple instances [root@zhdya01 bin] # mysqld_multi-- defaults-extra-file=/etc/my.cnf stop 1 Magi 2 [root@zhdya01 bin] # mysqld_multi-- defaults-extra-file=/etc/my.cnf reportReporting MySQL serversMySQL server from group: mysqld1 is not runningMySQL server from group: mysqld2 is not runing 7, Log in to the mysql instance [root@zhdya01 bin] # mysql-- socket=/usr/local/mysql3307/mysql.sockWelcome to the MySQL monitor. Commands end with; or\ g.Your MySQL connection id is 1Server version: 5.6.35-log MySQL Community Server (GPL) Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.Type 'help;' or'\ h' for help. Type'\ c'to clear the current input statement.mysql > the above is how to deploy a stand-alone machine in mysql using mysqld_multi. If you happen to have similar doubts, please refer to the above analysis to understand. If you want to know more about it, you are welcome to follow the industry information channel.

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: 270

*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.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report