In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-12 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
In the official Mysql help documentation, there are three ways to start Mysql: mysqld_safe, mysql.server, and mysql_multi. Introduction to mysql_multi:
Mysqld_multi can manage mysqld processes that connect multiple frames to listen to different Unix socket files and TCP/IP ports. It can start or stop servers or report their current status.
That is, multiple instances can be managed.
The author has also introduced the method of using mysqld_safe to enable multiple instances. Configuration files are specified for startup and shutdown, and the instances are opposed to each other and do not affect each other. Multiple instance master / slave Replication has been successfully deployed. Today, we also introduce mysql_multi multi-instance management, which is simple to configure and easy to manage.
1. First configure the my.cnf file and list my Mysql configuration file:
[mysqld_multi]
Mysqld = / usr/local/mysql/bin/mysqld_safe # configure according to your own mysql directory
Mysqladmin = / usr/local/mysql/bin/mysqladmin
[mysqld1]
Port = 3306
Socket = / tmp/mysql3306.sock
Basedir=/usr/local/mysql
Datadir=/mysqldata/data3306
Log-slow-queries=slow_query.txt
Long_query_time=2
Skip-locking
Skip-name-resolve
Skip-innodb
Max_allowed_packet = 256m
Query_cache_size=256M
Max_connections=2000
Max_connect_errors=10000
Key_buffer_size=6000M
Read_buffer_size=32M
Read_rnd_buffer_size = 32m
Myisam_sort_buffer_size=512M
Tmp_table_size=1024M
Old-passwords
Interactive_timeout=60
Wait_timeout=60
Connect_timeout=60
Table_cache=8192
Thread_cache_size=512
Sort_buffer_size=128M
Back_log = 500,
Thread_concurrency=48
Expire_logs_days=10
Log-bin=mysql-bin
[mysqld2]
Port = 3307
Socket = / tmp/mysql3307.sock
Basedir=/usr/local/mysql
Datadir=/mysqldata/data3307
Log-slow-queries=slow_query.txt
Long_query_time=2
Skip-locking
Skip-name-resolve
Skip-innodb
Max_allowed_packet = 256m
Query_cache_size=256M
Max_connections=2000
Max_connect_errors=10000
Key_buffer_size=6000M
Read_buffer_size=32M
Read_rnd_buffer_size = 32m
Myisam_sort_buffer_size=512M
Tmp_table_size=1024M
Old-passwords
Interactive_timeout=60
Wait_timeout=60
Connect_timeout=60
Table_cache=8192
Thread_cache_size=512
Sort_buffer_size=128M
Back_log = 500,
Thread_concurrency=48
Expire_logs_days=10
Log-bin=mysql-bin
[mysqldump]
Quick
Max_allowed_packet = 512m
[mysql]
No-auto-rehash
[isamchk]
Key_buffer = 512m
Sort_buffer_size = 32m
Read_buffer = 2m
Write_buffer = 2m
[myisamchk]
Key_buffer = 512m
Sort_buffer_size = 32m
Read_buffer = 2m
Write_buffer = 2m
[mysqlhotcopy]
Interactive-timeout
2. Initialize the database directory:
Shell > cd / usr/local/mysql/;./scripts/mysql_install_db-datadir=/mysqldata/data3307/-user=mysql
Shell > cd / usr/local/mysql/;./scripts/mysql_install_db-datadir=/mysqldata/data3306/-user=mysql
If the initial message is successful, OK will be prompted, otherwise, check to see if the database directory has permissions.
3. Start multiple instances:
Shell > / usr/local/mysql/bin/mysqld_multi start 1-2
Or
Shell > / usr/local/mysql/bin/mysqld_multi start 1
Shell > / usr/local/mysql/bin/mysqld_multi start 2
Note that 1 and 2 here correspond to the my.cnf configuration files mysqld1 and mysqld2 to distinguish.
4. Log in to Mysql locally, such as port 3307:
Shell > mysql-S / tmp/mysql3307.sock
Mysql > show variables like 'datadir'
+-- +
| | Variable_name | Value |
+-- +
| | datadir | / mysqldata/data3307/ |
+-- +
1 row in set (0.00 sec)
4. Close the database instance
Shell > / usr/local/mysql/bin/mysqld_multi stop 1-2
Or
Shell > / usr/local/mysql/bin/mysqld_multi stop 1
Shell > / usr/local/mysql/bin/mysqld_multi stop 2
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: 279
*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.