从零开始:Mysql基于Amoeba的集群搭建

准备环境

1、mysql-5.7.24-linux-glibc2.12-x86_64.tar.gz

2、amoeba-mysql-binary-2.0.1-BETA.tar.gz

3、Centos7

下载安装配置运行

1、mysql安装

使用wget命令下载安装

//创建目录
mkdir /software/mysql
cd /software/mysql
wget https://dev.mysql.com/get/downloads/mysql-5.7/mysql-5.7.24-linux-glibc2.12-x86_64.tar.gz

下载安装完成后使用tar命令解压

tar zxvf mysql-5.7.24-linux-glibc2.12-x86_64.tar.gz /software/mysql/mysql3307

我这里搭建的是一主两从模式,所以需要三个mysql实例。

cp -rf /software/mysql/mysql3307 /software/mysql/mysql3308
cp -rf /software/mysql/mysql3307 /software/mysql/mysql3309

2、mysql配置

在每个实例下的根路径创建一个my.cnf文件,一个data目录。

对每个实例修改相应的端口和目录。

[client]
no-beep
socket=/software/mysql/mysql3307/mysql.sock
# pipe
# socket=0.0
port=3307
[mysqld]
basedir=/software/mysql/mysql3307
datadir=/software/mysql/mysql3307/data
port=3307
pid-file=/software/mysql/mysql3307/mysqld.pid
#skip-grant-tables
skip-name-resolve
character-set-server=utf8
default-storage-engine=INNODB
explicit_defaults_for_timestamp = true
#----开启主从配置----
log-bin=mysql-bin
server-id = 1
sync_binlog=1
# -----------------
max_connections=2000
query_cache_size=0
table_open_cache=2000
tmp_table_size=246M
thread_cache_size=300
#限定用于每个数据库线程的栈大小。默认设置足以满足大多数应用
thread_stack = 192k
key_buffer_size=512M
read_buffer_size=4M
read_rnd_buffer_size=32M
innodb_data_home_dir = /software/mysql/mysql3307/data
innodb_flush_log_at_trx_commit=0
innodb_log_buffer_size=16M
innodb_buffer_pool_size=256M
innodb_log_file_size=128M
innodb_thread_concurrency=128
innodb_autoextend_increment=1000
innodb_buffer_pool_instances=8
innodb_concurrency_tickets=5000
innodb_old_blocks_time=1000
innodb_open_files=300
innodb_stats_on_metadata=0
innodb_file_per_table=1
innodb_checksum_algorithm=0
back_log=80
flush_time=0
join_buffer_size=128M
max_allowed_packet=1024M
max_connect_errors=2000
open_files_limit=4161
query_cache_type=0
sort_buffer_size=32M
table_definition_cache=1400
binlog_row_event_max_size=8K
sync_master_info=10000
sync_relay_log=10000
sync_relay_log_info=10000
#批量插入数据缓存大小,可以有效提高插入效率,默认为8M
bulk_insert_buffer_size = 64M
interactive_timeout = 120
wait_timeout = 120
log-bin-trust-function-creators=1
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES

#
# include all files from the config directory
#

创建用户组

#创建用户组
groupadd -r mysql
useradd -r -g mysql mysql
#设置用户组
chown -R mysql:mysql  /software/mysql/
chown -R mysql  /software/mysql/

使用mysqld命令初始化mysql。

cd /software/mysql/mysql3307/bin
./mysqld --user=mysql --basedir=/software/mysql/mysql3307 --datadir=/software/mysql/mysql3307/data --initialize
./mysqld --user=mysql --defaults-file=/software/mysql/mysql3307/my.cnf

cd /software/mysql/mysql3308/bin
./mysqld --user=mysql --basedir=/software/mysql/mysql3308 --datadir=/software/mysql/mysql3308/data --initialize
./mysqld --user=mysql --defaults-file=/software/mysql/mysql3308/my.cnf

cd /software/mysql/mysql3309/bin
./mysqld --user=mysql --basedir=/software/mysql/mysql3309 --datadir=/software/mysql/mysql3309/data --initialize
./mysqld --user=mysql --defaults-file=/software/mysql/mysql3309/my.cnf

初始化完成时会输出一个mysql的初始密码(Tsiq_elgs7iQ)。

2019-11-24T01:06:22.321101Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2019-11-24T01:06:23.032518Z 0 [Warning] InnoDB: New log files created, LSN=45790
2019-11-24T01:06:23.146942Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2019-11-24T01:06:23.205353Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: a1c226a9-0e56-11ea-ac41-00163e0c5978.
2019-11-24T01:06:23.206882Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2019-11-24T01:06:23.207553Z 1 [Note] A temporary password is generated for root@localhost: Tsiq_elgs7iQ

把/usr/local/mysql修改成相应的mysql目录。

#mysq.server的部分代码
mysqld_pid_file_path=
if test -z "$basedir"
then
  basedir=/software/mysql/mysql-5.7.24-linux-glibc2.12-x86_64
  bindir=/software/mysql/mysql-5.7.24-linux-glibc2.12-x86_64/bin
  if test -z "$datadir"
  then
    datadir=/software/mysql/mysql-5.7.24-linux-glibc2.12-x86_64/data
  fi
  sbindir=/software/mysql/mysql-5.7.24-linux-glibc2.12-x86_64/bin
  libexecdir=/software/mysql/mysql-5.7.24-linux-glibc2.12-x86_64/bin
else
  bindir="$basedir/bin"
  if test -z "$datadir"
  then
    datadir="$basedir/data"
  fi
  sbindir="$basedir/sbin"
  libexecdir="$basedir/libexec"
fi

3、mysql配置主从

在master服务器上(3307端口)输入

 show master status;
 +------------------+----------+--------------+------------------+-------------------+
| File             | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set |
+------------------+----------+--------------+------------------+-------------------+
| mysql-bin.000006 |      154 |              |                  |                   |
+------------------+----------+--------------+------------------+-------------------+
1 row in set (0.13 sec)

在slave服务器上(3308和3309端口)输入

stop slave;
change master to master_host='localhost', master_user='root', master_password='root',master_log_file='mysql-bin.000006',master_log_pos=154,master_port=3307;
start slave;

测试:

在从服务器上输入show slave status;

mysql> show slave status;
+----------------------------------+-------------+-------------+-------------+---------------+------------------+---------------------+------------------------------------------+---------------+-----------------------+------------------+-------------------+-----------------+---------------------+--------------------+------------------------+-------------------------+-----------------------------+------------+---------------------------------------------------------------------------------------------------------------------------+--------------+---------------------+-----------------+-----------------+----------------+---------------+--------------------+--------------------+--------------------+-----------------+-------------------+----------------+-----------------------+-------------------------------+---------------+---------------+----------------+---------------------------------------------------------------------------------------------------------------------------+-----------------------------+------------------+--------------------------------------+--------------------------------------------+-----------+---------------------+-------------------------+--------------------+-------------+-------------------------+--------------------------+----------------+--------------------+--------------------+-------------------+---------------+----------------------+--------------+--------------------+
| Slave_IO_State                   | Master_Host | Master_User | Master_Port | Connect_Retry | Master_Log_File  | Read_Master_Log_Pos | Relay_Log_File                           | Relay_Log_Pos | Relay_Master_Log_File | Slave_IO_Running | Slave_SQL_Running | Replicate_Do_DB | Replicate_Ignore_DB | Replicate_Do_Table | Replicate_Ignore_Table | Replicate_Wild_Do_Table | Replicate_Wild_Ignore_Table | Last_Errno | Last_Error                                                                                                                | Skip_Counter | Exec_Master_Log_Pos | Relay_Log_Space | Until_Condition | Until_Log_File | Until_Log_Pos | Master_SSL_Allowed | Master_SSL_CA_File | Master_SSL_CA_Path | Master_SSL_Cert | Master_SSL_Cipher | Master_SSL_Key | Seconds_Behind_Master | Master_SSL_Verify_Server_Cert | Last_IO_Errno | Last_IO_Error | Last_SQL_Errno | Last_SQL_Error                                                                                                            | Replicate_Ignore_Server_Ids | Master_Server_Id | Master_UUID                          | Master_Info_File                           | SQL_Delay | SQL_Remaining_Delay | Slave_SQL_Running_State | Master_Retry_Count | Master_Bind | Last_IO_Error_Timestamp | Last_SQL_Error_Timestamp | Master_SSL_Crl | Master_SSL_Crlpath | Retrieved_Gtid_Set | Executed_Gtid_Set | Auto_Position | Replicate_Rewrite_DB | Channel_Name | Master_TLS_Version |
+----------------------------------+-------------+-------------+-------------+---------------+------------------+---------------------+------------------------------------------+---------------+-----------------------+------------------+-------------------+-----------------+---------------------+--------------------+------------------------+-------------------------+-----------------------------+------------+---------------------------------------------------------------------------------------------------------------------------+--------------+---------------------+-----------------+-----------------+----------------+---------------+--------------------+--------------------+--------------------+-----------------+-------------------+----------------+-----------------------+-------------------------------+---------------+---------------+----------------+---------------------------------------------------------------------------------------------------------------------------+-----------------------------+------------------+--------------------------------------+--------------------------------------------+-----------+---------------------+-------------------------+--------------------+-------------+-------------------------+--------------------------+----------------+--------------------+--------------------+-------------------+---------------+----------------------+--------------+--------------------+
| Waiting for master to send event | localhost   | root        |        3307 |            60 | mysql-bin.000006 |                 154 | iz2zeaf5jdjve80rjlsjgnz-relay-bin.000011 |           367 | mysql-bin.000004      | Yes              | No                |                 |                     |                    |                        |                         |                             |       1008 | Error 'Can't drop database 'asd'; database doesn't exist' on query. Default database: 'asd'. Query: 'DROP DATABASE `asd`' |            0 |                 154 |            3043 | None            |                |             0 | No                 |                    |                    |                 |                   |                | NULL                  | No                            |             0 |               |           1008 | Error 'Can't drop database 'asd'; database doesn't exist' on query. Default database: 'asd'. Query: 'DROP DATABASE `asd`' |                             |                1 | 5805917d-0e17-11ea-97cd-00163e0c5978 | /software/mysql/mysql3308/data/master.info |         0 | NULL                |                         |              86400 |             |                         | 191124 09:51:23          |                |                    |                    |                   |             0 |                      |              |                    |
+----------------------------------+-------------+-------------+-------------+---------------+------------------+---------------------+------------------------------------------+---------------+-----------------------+------------------+-------------------+-----------------+---------------------+--------------------+------------------------+-------------------------+-----------------------------+------------+---------------------------------------------------------------------------------------------------------------------------+--------------+---------------------+-----------------+-----------------+----------------+---------------+--------------------+--------------------+--------------------+-----------------+-------------------+----------------+-----------------------+-------------------------------+---------------+---------------+----------------+---------------------------------------------------------------------------------------------------------------------------+-----------------------------+------------------+--------------------------------------+--------------------------------------------+-----------+---------------------+-------------------------+--------------------+-------------+-------------------------+--------------------------+----------------+--------------------+--------------------+-------------------+---------------+----------------------+--------------+--------------------+
1 row in set (0.88 sec)

其中

Slave_IO_State      Waiting for master to send event
Slave_IO_Running        Yes
Slave_SQL_Running       Yes

表示主从运行成功。

4、mysql运行

使用mysql.server运行mysql实例

[root@iz2zeaf5jdjve80rjlsjgnz bin]# cd /software/mysql/mysql3307/support-files
[root@iz2zeaf5jdjve80rjlsjgnz support-files]# ./mysql.server start
Starting MySQL.Logging to '/software/mysql/mysql3307/data/iz2zeaf5jdjve80rjlsjgnz.err'.
...                                                        [  OK  ]

进入mysql控制台

[root@iz2zeaf5jdjve80rjlsjgnz support-files]# cd /software/mysql/mysql-5.7.24-linux-glibc2.12-x86_64/bin
[root@iz2zeaf5jdjve80rjlsjgnz bin]# ./mysql -u root -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.24-log

Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
#修改默认密码
mysql> set password = password('root');
Query OK, 0 rows affected, 1 warning (0.00 sec)
#设置远程访问
mysql> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> update user set host = '%' where user = 'root';
Query OK, 1 row affected (0.00 sec)
Rows matched: 1  Changed: 1  Warnings: 0
#刷新数据库
mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)

mysql> exit;
Bye
[root@iz2zeaf5jdjve80rjlsjgnz bin]# 

使用navicat测试连接


5、amoeba安装

使用wget下载amoeba

//创建目录
mkdir /software/amoeba
cd /software/amoeba
wget https://jaist.dl.sourceforge.net/project/amoeba/Amoeba%20for%20mysql/2.x/amoeba-mysql-binary-2.0.1-BETA.tar.gz

使用tar命令解压

tar xf amoeba-mysql-binary-2.0.1-BETA.tar.gz -C /software/amoeba

6、amoeba配置

amoeba配置主要是amoeba.xml和dbServers.xml两个文件。

amoeba.xml

<?xml version="1.0" encoding="gbk"?>

<!DOCTYPE amoeba:configuration SYSTEM "amoeba.dtd">
<amoeba:configuration xmlns:amoeba="http://amoeba.meidusa.com/">

    <proxy>

        <!-- server class must implements com.meidusa.amoeba.service.Service -->
        <service name="Amoeba for Mysql" class="com.meidusa.amoeba.net.ServerableConnectionManager">
            <!-- port -->
            <property name="port">8066</property>

            <!-- bind ipAddress -->
            <!--
            <property name="ipAddress">127.0.0.1</property>
             -->

            <property name="manager">${clientConnectioneManager}</property>

            <property name="connectionFactory">
                <bean class="com.meidusa.amoeba.mysql.net.MysqlClientConnectionFactory">
                    <property name="sendBufferSize">128</property>
                    <property name="receiveBufferSize">64</property>
                </bean>
            </property>

            <property name="authenticator">
                <bean class="com.meidusa.amoeba.mysql.server.MysqlClientAuthenticator">

                    <property name="user">amoeba</property>

                    <property name="password">amoeba</property>

                    <property name="filter">
                        <bean class="com.meidusa.amoeba.server.IPAccessController">
                            <property name="ipFile">${amoeba.home}/conf/access_list.conf</property>
                        </bean>
                    </property>
                </bean>
            </property>

        </service>

        <!-- server class must implements com.meidusa.amoeba.service.Service -->
        <service name="Amoeba Monitor Server" class="com.meidusa.amoeba.monitor.MonitorServer">
            <!-- port -->
            <!--  default value: random number
            <property name="port">9066</property>
            -->
            <!-- bind ipAddress -->
            <property name="ipAddress">localhost</property>
            <property name="daemon">true</property>
            <property name="manager">${clientConnectioneManager}</property>
            <property name="connectionFactory">
                <bean class="com.meidusa.amoeba.monitor.net.MonitorClientConnectionFactory"></bean>
            </property>

        </service>

        <runtime class="com.meidusa.amoeba.mysql.context.MysqlRuntimeContext">
            <!-- proxy server net IO Read thread size -->
            <property name="readThreadPoolSize">20</property>

            <!-- proxy server client process thread size -->
            <property name="clientSideThreadPoolSize">30</property>

            <!-- mysql server data packet process thread size -->
            <property name="serverSideThreadPoolSize">30</property>

            <!-- per connection cache prepared statement size  -->
            <property name="statementCacheSize">500</property>

            <!-- query timeout( default: 60 second , TimeUnit:second) -->
            <property name="queryTimeout">60</property>
        </runtime>

    </proxy>

    <!--
        Each ConnectionManager will start as thread
        manager responsible for the Connection IO read , Death Detection
    -->
    <connectionManagerList>
        <connectionManager name="clientConnectioneManager" class="com.meidusa.amoeba.net.MultiConnectionManagerWrapper">
            <property name="subManagerClassName">com.meidusa.amoeba.net.ConnectionManager</property>
            <!--
              default value is avaliable Processors
            <property name="processors">5</property>
             -->
        </connectionManager>
        <connectionManager name="defaultManager" class="com.meidusa.amoeba.net.MultiConnectionManagerWrapper">
            <property name="subManagerClassName">com.meidusa.amoeba.net.AuthingableConnectionManager</property>

            <!--
              default value is avaliable Processors
            <property name="processors">5</property>
             -->
        </connectionManager>
    </connectionManagerList>

        <!-- default using file loader -->
    <dbServerLoader class="com.meidusa.amoeba.context.DBServerConfigFileLoader">
        <property name="configFile">${amoeba.home}/conf/dbServers.xml</property>
    </dbServerLoader>

    <queryRouter class="com.meidusa.amoeba.mysql.parser.MysqlQueryRouter">
        <property name="ruleLoader">
            <bean class="com.meidusa.amoeba.route.TableRuleFileLoader">
                <property name="ruleFile">${amoeba.home}/conf/rule.xml</property>
                <property name="functionFile">${amoeba.home}/conf/ruleFunctionMap.xml</property>
            </bean>
        </property>
        <property name="sqlFunctionFile">${amoeba.home}/conf/functionMap.xml</property>
        <property name="LRUMapSize">1500</property>
        <property name="defaultPool">master</property>

        <property name="writePool">master</property>
        <property name="readPool">multiPool</property>

        <property name="needParse">true</property>
    </queryRouter>
</amoeba:configuration>

dbServers.xml

<?xml version="1.0" encoding="gbk"?>

<!DOCTYPE amoeba:dbServers SYSTEM "dbserver.dtd">
<amoeba:dbServers xmlns:amoeba="http://amoeba.meidusa.com/">

        <!--
            Each dbServer needs to be configured into a Pool,
            If you need to configure multiple dbServer with load balancing that can be simplified by the following configuration:
             add attribute with name virtual = "true" in dbServer, but the configuration does not allow the element with name factoryConfig
             such as 'multiPool' dbServer
        -->

    <dbServer name="abstractServer" abstractive="true">
        <factoryConfig class="com.meidusa.amoeba.mysql.net.MysqlServerConnectionFactory">
            <property name="manager">${defaultManager}</property>
            <property name="sendBufferSize">64</property>
            <property name="receiveBufferSize">128</property>

            <!-- mysql port -->
            <property name="port">3307</property>

            <!-- mysql schema -->
            <property name="schema">amoeba</property>

            <!-- mysql user -->
            <property name="user">root</property>

            <property name="password">root</property>
        </factoryConfig>

        <poolConfig class="com.meidusa.amoeba.net.poolable.PoolableObjectPool">
            <property name="maxActive">500</property>
            <property name="maxIdle">500</property>
            <property name="minIdle">10</property>
            <property name="minEvictableIdleTimeMillis">600000</property>
            <property name="timeBetweenEvictionRunsMillis">600000</property>
            <property name="testOnBorrow">true</property>
            <property name="testWhileIdle">true</property>
        </poolConfig>
    </dbServer>

    <dbServer name="master"  parent="abstractServer">
        <factoryConfig>
            <!-- mysql ip -->
            <property name="ipAddress">localhost</property>
            <property name="port">3307</property>

        </factoryConfig>
    </dbServer>
    <dbServer name="slave1"  parent="abstractServer">
        <factoryConfig>
            <!-- mysql ip -->
            <property name="ipAddress">localhost</property>
            <property name="port">3308</property>

        </factoryConfig>
    </dbServer>

    <dbServer name="slave2"  parent="abstractServer">
        <factoryConfig>
            <!-- mysql ip -->
            <property name="ipAddress">localhost</property>
            <property name="port">3309</property>

        </factoryConfig>
    </dbServer>

    <dbServer name="multiPool" virtual="true">
        <poolConfig class="com.meidusa.amoeba.server.MultipleServerPool">
            <!-- Load balancing strategy: 1=ROUNDROBIN , 2=WEIGHTBASED , 3=HA-->
            <property name="loadbalance">1</property>

            <!-- Separated by commas,such as: server1,server2,server1 -->
            <property name="poolNames">slave1,slave2</property>
        </poolConfig>
    </dbServer>

</amoeba:dbServers>

进入三个mysql实例。

输入命令,其中的root应该设置为dbServers.xml中设置的用户名和密码。

grant all on *.* to'root'@'%' identified by 'root';
flush privileges;

7、amoeba运行

在控制台输入

[root@iz2zeaf5jdjve80rjlsjgnz support-files]# /software/amoeba/bin/amoeba
amoeba start|stop

出现amoeba start|stop说明安装成功。

输入/software/amoeba/bin/amoeba start运行

[root@iz2zeaf5jdjve80rjlsjgnz support-files]# /software/amoeba/bin/amoeba start
log4j:WARN log4j config load completed from file:/software/amoeba/conf/log4j.xml
log4j:WARN ip access config load completed from file:/software/amoeba/conf/access_list.conf
2019-11-24 09:44:54,342 INFO  net.ServerableConnectionManager - Amoeba for Mysql listening on 0.0.0.0/0.0.0.0:8066.
2019-11-24 09:44:54,344 INFO  net.ServerableConnectionManager - Amoeba Monitor Server listening on localhost/127.0.0.1:24211.

使用navicat连接8066端口


测试主从

连接到8066端口

测试主从复制

创建数据库

mysql> create database rlxy93;
Query OK, 1 row affected (0.12 sec)

创建表,插入数据

mysql> use rlxy93;
Database changed
mysql> CREATE TABLE `admin` (
  `user` char(100) DEFAULT NULL,
  `password` char(100) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
Query OK, 0 rows affected (0.32 sec)
mysql> insert into admin values('a','a');
Query OK, 1 row affected (0.28 sec)

测试读写分离

读取

关闭master服务器

kill -9 20585 21308

在8066端口测试

mysql> insert into admin values('e','e');
2013 - Lost connection to MySQL server during query
mysql> select * from admin;
+------+----------+
| user | password |
+------+----------+
| a    | a        |
| b    | b        |
| c    | c        |
| d    | d        |
| e    | e        |
+------+----------+
5 rows in set (0.59 sec)

此时,写入失败,读取正常。

写入

关闭两个slave服务器

kill -9 2772 9260 10010 12338

在8066端口测试

mysql> insert into admin values('r','r');
Query OK, 1 row affected (0.81 sec)

mysql> select * from admin;
2013 - Lost connection to MySQL server during query

此时,读取失败,写入正常。

踩坑

建立三个mysql服务器,一定要配置

log-bin=mysql-bin //日志文件
server-id = 2  //服务器id,不要和其他的相同
replicate-do-db=test  //同步的数据库,可以不指定,默认是所有数据库
log-slave-updates
sync_binlog=1
slave-net-timeout=60

在使用show slave status;命令时,要有提示下面的,才会开启主从同步。

Slave_IO_State      Waiting for master to send event
Slave_IO_Running        Yes
Slave_SQL_Running       Yes

同时,要关注Replicate_Do_DB的配置,比如配置的是test,那么就要在master创建一个test数据库,之后的同步操作才会在test里面进行,不会在其他数据库里面执行。

常见问题

提示

Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

删除目录下的.lock文件,删除tmp目录下的.sock和.lock文件。重启mysql。


使用mysq.server时报错

Starting MySQL.Logging to '/software/mysql/mysql-5.7.24-linux-glibc2.12-x86_64/data/iz2zeaf5jdjve80rjlsjgnz.err'.
...The server quit without updating PID file (/software/mys[FAILED]-5.7.24-linux-glibc2.12-x86_64/mysqld.pid).

打开/software/mysql/mysql-5.7.24-linux-glibc2.12-x86_64/data/iz2zeaf5jdjve80rjlsjgnz.err文件

2019-11-24T01:09:45.425848Z 0 [Warning] 'NO_ZERO_DATE', 'NO_ZERO_IN_DATE' and 'ERROR_FOR_DIVISION_BY_ZERO' sql modes should be used with strict mode. They will be merged with strict mode in a future release.
2019-11-24T01:09:45.425976Z 0 [Warning] 'NO_AUTO_CREATE_USER' sql mode was not set.
2019-11-24T01:09:45.426032Z 0 [Note] --secure-file-priv is set to NULL. Operations related to importing and exporting data are disabled
2019-11-24T01:09:45.426073Z 0 [Note] /software/mysql/mysql-5.7.24-linux-glibc2.12-x86_64/bin/mysqld (mysqld 5.7.24-log) starting as process 8143 ...
2019-11-24T01:09:45.541535Z 0 [Note] InnoDB: PUNCH HOLE support available
2019-11-24T01:09:45.541595Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2019-11-24T01:09:45.541605Z 0 [Note] InnoDB: Uses event mutexes
2019-11-24T01:09:45.541610Z 0 [Note] InnoDB: GCC builtin __sync_synchronize() is used for memory barrier
2019-11-24T01:09:45.541616Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2019-11-24T01:09:45.541621Z 0 [Note] InnoDB: Using Linux native AIO
2019-11-24T01:09:45.541642Z 0 [Note] InnoDB: Adjusting innodb_buffer_pool_instances from 8 to 1 since innodb_buffer_pool_size is less than 1024 MiB
2019-11-24T01:09:45.544101Z 0 [Note] InnoDB: Number of pools: 1
2019-11-24T01:09:45.544321Z 0 [Note] InnoDB: Using CPU crc32 instructions
2019-11-24T01:09:45.547333Z 0 [Note] InnoDB: Initializing buffer pool, total size = 256M, instances = 1, chunk size = 128M
2019-11-24T01:09:45.575769Z 0 [Note] InnoDB: Completed initialization of buffer pool
2019-11-24T01:09:45.583452Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2019-11-24T01:09:45.593324Z 0 [Note] InnoDB: The first innodb_system data file 'ibdata1' did not exist. A new tablespace will be created!
2019-11-24T01:09:45.593949Z 0 [Note] InnoDB: Setting file '/software/mysql/mysql-5.7.24-linux-glibc2.12-x86_64/data/ibdata1' size to 12 MB. Physically writing the file full; Please wait ...
2019-11-24T01:09:45.618878Z 0 [Note] InnoDB: File '/software/mysql/mysql-5.7.24-linux-glibc2.12-x86_64/data/ibdata1' size is now 12 MB.
2019-11-24T01:09:45.619435Z 0 [Note] InnoDB: Setting log file ./ib_logfile101 size to 128 MB
2019-11-24T01:09:45.619604Z 0 [Note] InnoDB: Progress in MB:
 100
2019-11-24T01:09:46.448502Z 0 [Note] InnoDB: Setting log file ./ib_logfile1 size to 128 MB
2019-11-24T01:09:46.448680Z 0 [Note] InnoDB: Progress in MB:
 100
2019-11-24T01:09:47.357744Z 0 [Note] InnoDB: Renaming log file ./ib_logfile101 to ./ib_logfile0
2019-11-24T01:09:47.357907Z 0 [Warning] InnoDB: New log files created, LSN=45790
2019-11-24T01:09:47.357961Z 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2019-11-24T01:09:47.358115Z 0 [Note] InnoDB: Setting file '/software/mysql/mysql-5.7.24-linux-glibc2.12-x86_64/data/ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2019-11-24T01:09:47.444395Z 0 [Note] InnoDB: File '/software/mysql/mysql-5.7.24-linux-glibc2.12-x86_64/data/ibtmp1' size is now 12 MB.
2019-11-24T01:09:47.444697Z 0 [Note] InnoDB: Doublewrite buffer not found: creating new
2019-11-24T01:09:47.539208Z 0 [Note] InnoDB: Doublewrite buffer created
2019-11-24T01:09:47.546333Z 0 [Note] InnoDB: 96 redo rollback segment(s) found. 96 redo rollback segment(s) are active.
2019-11-24T01:09:47.546365Z 0 [Note] InnoDB: 32 non-redo rollback segment(s) are active.
2019-11-24T01:09:47.546557Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2019-11-24T01:09:47.547190Z 0 [Note] InnoDB: Foreign key constraint system tables created
2019-11-24T01:09:47.547220Z 0 [Note] InnoDB: Creating tablespace and datafile system tables.
2019-11-24T01:09:47.547363Z 0 [Note] InnoDB: Tablespace and datafile system tables created.
2019-11-24T01:09:47.547383Z 0 [Note] InnoDB: Creating sys_virtual system tables.
2019-11-24T01:09:47.547476Z 0 [Note] InnoDB: sys_virtual table created
2019-11-24T01:09:47.547626Z 0 [Note] InnoDB: Waiting for purge to start
2019-11-24T01:09:47.597783Z 0 [Note] InnoDB: 5.7.24 started; log sequence number 0
2019-11-24T01:09:47.598264Z 0 [Note] Plugin 'FEDERATED' is disabled.
mysqld: Table 'mysql.plugin' doesn't exist
2019-11-24T01:09:47.598481Z 0 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
2019-11-24T01:09:47.602911Z 0 [Note] Salting uuid generator variables, current_pid: 8143, server_start_time: 1574557785, bytes_sent: 0,
2019-11-24T01:09:47.603045Z 0 [Note] Generated uuid: '1b96c3e3-0e57-11ea-8e76-00163e0c5978', server_start_time: 2292050736929437736, bytes_sent: 68790256
2019-11-24T01:09:47.603068Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 1b96c3e3-0e57-11ea-8e76-00163e0c5978.
2019-11-24T01:09:47.604341Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2019-11-24T01:09:47.605443Z 0 [Warning] Failed to set up SSL because of the following SSL library error: SSL context is not usable without certificate and private key
2019-11-24T01:09:47.605480Z 0 [Note] Server hostname (bind-address): '*'; port: 3310
2019-11-24T01:09:47.605566Z 0 [Note] IPv6 is available.
2019-11-24T01:09:47.605582Z 0 [Note]   - '::' resolves to '::';
2019-11-24T01:09:47.605695Z 0 [Note] Server socket created on IP: '::'.
2019-11-24T01:09:47.607400Z 0 [ERROR] /software/mysql/mysql-5.7.24-linux-glibc2.12-x86_64/bin/mysqld: Can't create/write to file '/software/mysql/mysql-5.7.24-linux-glibc2.12-x86_64/mysqld.pid' (Errcode: 13 - Permission denied)
2019-11-24T01:09:47.607417Z 0 [ERROR] Can't start server: can't create PID file: Permission denied

找到[ERROR]行,这里的错误是没有权限


amoeba找不到JAVA_HOME

在amoeba文件中第一行添加

JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.232.b09-0.el7_7.x86_64/jre

后面跟着的是jdk的路径。


amoeba运行时提示The stack size specified is too small, Specify at least 160k.

在amoeba文件中修改

DEFAULT_OPTS="-server -Xms256m -Xmx256m -Xss256k"

从零开始:Mysql基于Amoeba的集群搭建的更多相关文章

  1. MySQL数据库高可用集群搭建-PXC集群部署

    Percona XtraDB Cluster(下文简称PXC集群)提供了MySQL高可用的一种实现方法.集群是有节点组成的,推荐配置至少3个节点,但是也可以运行在2个节点上. PXC原理描述: 分布式 ...

  2. MySQL PXC 高可用集群搭建

    一些名词介绍: WS:write set 写数据集    IST: Incremental State Transfer 增量同步    SST:State Snapshot Transfer 全量同 ...

  3. MySQL mha 高可用集群搭建

    [mha] MHA作为MySQL故障切换和主从提升的高可用软件,在故障切换过程中,MHA能做到在0~30秒之内自动完成数据库的故障切换操作,并且在进行故障切换的过程中,MHA能在最大程度上保证数据的一 ...

  4. (转)基于keepalived搭建MySQL的高可用集群

    基于keepalived搭建MySQL的高可用集群  原文:http://www.cnblogs.com/ivictor/p/5522383.html MySQL的高可用方案一般有如下几种: keep ...

  5. 1 构建Mysql+heartbeat+DRBD+LVS集群应用系统系列之DRBD的搭建

    preface 近来公司利润上升,购买了10几台服务器,趁此机会,把mysql的主从同步的架构进一步扩展,为了适应日益增长的流量.针对mysql架构的扩展,先是咨询前辈,后和同事探讨,准备采用Mysq ...

  6. Kubernetes集群搭建之企业级环境中基于Harbor搭建自己的私有仓库

    搭建背景 企业环境中使用Docker环境,一般出于安全考虑,业务使用的镜像一般不会从第三方公共仓库下载.那么就要引出今天的主题 企业级环境中基于Harbor搭建自己的安全认证仓库 介绍 名称:Harb ...

  7. 2-20 MySQL集群搭建实现高可用

    MySQL集群概述和安装环境 MySQL Cluster是MySQL适合于分布式计算环境的高实用.高冗余版本.Cluster的汉语是"集群"的意思.它采用了NDB Cluster ...

  8. Linux下MySQL/MariaDB Galera集群搭建过程【转】

    MariaDB介绍 MariaDB是开源社区维护的一个MySQL分支,由MySQL的创始人Michael Widenius主导开发,采用GPL授权许可证. MariaDB的目的是完全兼容MySQL,包 ...

  9. 基于RHCS的web双机热备集群搭建

    基于RHCS的web双机热备集群搭建 RHCS集群执行原理及功能介绍 1. 分布式集群管理器(CMAN)  Cluster Manager.简称CMAN.是一个分布式集群管理工具.它执行在集群的各个节 ...

随机推荐

  1. node 创建静态web服务器(上)

    声明:本文仅用来做学习记录. 本文将使用node创建一个简单的静态web服务器. 准备工作: 首先,准备好一个类似图片中这样的页面 第一步: 创建 http 服务: const http = requ ...

  2. 剑指offer——50最长不含重复字符和子字符串

    题目: 请从字符串中找出一个最长的不包含重复字符的子字符串,计算该最长子字符串的长度.假设字符串中只包含’a~z”的字符.例如,在字符串“arabcacfr"中,最长的不含重复字符的子字符串 ...

  3. C# 简单的往txt中写日志,调试时很有用

    原文 http://blog.csdn.net/hejialin666/article/details/6106648 有些程序在调试时很难抓住断点(如服务程序),有些程序需要循环无数次,要看每一次或 ...

  4. 如何调用DLL中的导出类

    之前在网上一直查不到关于把类打包成dll文件的程序,今天自己写了个测试程序,供大家参考 一.生成类的dll文件 1.我是在vs2008上测试的,建立工程,在选择建立何种类型的工程的时候,勾上appli ...

  5. KMP2

    poj 2752 #include<stdio.h> #include<iostream> #include<algorithm> #include<stri ...

  6. Java SE(2)

    1.this的两种用法:(1)当成员变量和局部变量重名是,可以用关键字this来区分 .this代表对象,代表的是this所在函数所属对象的引用(哪个对象调用了this所在的函数,this就代表哪个对 ...

  7. jQuery实现enter键登录

    在登录时,使用快捷键登录时常用的方法,其中 loginReq()方法为请求登录检索的方法 $("#login").click(function(){ loginReq(); }); ...

  8. js求100以内的素数

    //打印2~100之间的数 ; i< ; i++){ var a = true; ; j < i; j++){ //判断i能否被j整除 ){ //能被整除则说明不是素数,修改布尔值为fal ...

  9. 请问在一个固定div大小里面,图片右移动,超出div容器的图片给隐藏,怎么设定?

    如图,让图片移动,溢出的图片被隐藏,怎么设置? overflow: hidden;

  10. MaxCompute表设计最佳实践

    MaxCompute表设计最佳实践 产生大量小文件的操作 MaxCompute表的小文件会影响存储和计算性能,因此我们先介绍下什么样的操作会产生大量小文件,从 而在做表设计的时候考虑避开此类操作. 使 ...