| NGINX多实例就是多个配置文件 |
| mysql多实例:同一个软件启动多次,就是多个进程,每个进程监听的端口不同 |
| 1.不同的数据目录 |
| 2.不同的端口 |
| 3.不同的socket文件 |
| 4.不同的日志文件 |
| [root@db01 data] |
| [mysqld] |
| basedir=/service/mysql |
| datadir=/data/3307/data |
| port=3307 |
| socket=/data/3307/mysql.sock |
| log-error=/data/3307/data/mysql.err |
| log-bin=/data/3307/data/mysql-bin |
| server_id=7 |
| |
| ------------------------------------------- |
| |
| [root@db01 data] |
| [mysqld] |
| basedir=/service/mysql |
| datadir=/data/3308/data |
| port=3308 |
| socket=/data/3308/mysql.sock |
| log-error=/data/3308/data/mysql.err |
| log-bin=/data/3308/data/mysql-bin |
| server_id=8 |
| |
| -------------------------------------------- |
| |
| [root@db01 data] |
| [mysqld] |
| basedir=/service/mysql |
| datadir=/data/3309/data |
| port=3309 |
| socket=/data/3309/mysql.sock |
| log-error=/data/3309/data/mysql.err |
| log-bin=/data/3309/data/mysql-bin |
| server_id=9 |
| [root@db01 scripts] |
| |
| [root@db01 scripts] |
| |
| [root@db01 scripts] |
| |
| |
| [root@db01 scripts] |
| [root@db01 scripts] |
| [root@db01 scripts] |
| [root@db01 scripts] |
| [root@db01 scripts] |
| tcp6 0 0 :::3307 :::* LISTEN 25550/mysqld |
| tcp6 0 0 :::3308 :::* LISTEN 25722/mysqld |
| tcp6 0 0 :::3309 :::* LISTEN 25894/mysqld |
| [root@db01 scripts] |
| [root@db01 scripts] |
| [root@db01 scripts] |
| [root@db01 scripts]# mysql -uroot -p3307 -S /data/3307/mysql.sock -e "show variables like 'server_id';" |
| Warning: Using a password on the command line interface can be insecure. |
| +---------------+-------+ |
| | Variable_name | Value | |
| +---------------+-------+ |
| | server_id | 7 | |
| +---------------+-------+ |
| |
| [root@db01 scripts]# mysql -uroot -p3308 -S /data/3308/mysql.sock -e "show variables like 'server_id';" |
| Warning: Using a password on the command line interface can be insecure. |
| +---------------+-------+ |
| | Variable_name | Value | |
| +---------------+-------+ |
| | server_id | 8 | |
| +---------------+-------+ |
| |
| [root@db01 scripts]# mysql -uroot -p3309 -S /data/3309/mysql.sock -e "show variables like 'server_id';" |
| Warning: Using a password on the command line interface can be insecure. |
| +---------------+-------+ |
| | Variable_name | Value | |
| +---------------+-------+ |
| | server_id | 9 | |
| +---------------+-------+ |
| [root@db01 scripts] |
| mysql -uroot -p3309 -S /data/3309/mysql.sock |
| [root@db01 scripts] |
| mysql -uroot -p3308 -S /data/3308/mysql.sock |
| [root@db01 scripts] |
| mysql -uroot -p3307 -S /data/3307/mysql.sock |
| |
| [root@db01 scripts] |