从零开始: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. 在linux 下查询某个进程被那个程序占用

    ps -ef|grep pid ps -aux | grep pid 清除linux 缓存: echo 1 > /proc/sys/vm/drop_caches

  2. layui的选项卡(tab)的问题

    当页面打开单个tab时,操作栏显示: 当页面打开多个tab时,会发现操作栏与下面第一个tab显示的操作栏类型一样,并且操作栏的按钮无作用 第一个标签操作栏显示: 产生这样的原因:使用layui时,每个 ...

  3. Linux下NODE配置NODE_PATH变量

    在当我们使用了npm install express -g安装之后的,会安装在全局目录下,但是如果直接用Node来启动程序的话,是无法发现这个包的,原因就在于NODE_PATH这个环境变量设置的不正确 ...

  4. Swift与OC混合开发

    一.Swift调用OC 1. 创建{targetName}-Bridging-Header.h头文件,在BuildSetting -> bridging 2. Swift文件调用的OC中的类的头 ...

  5. 基于物品的协同过滤(ItemCF)

  6. 01_ESP8266 NONO_SDK 创建工程模板

    参考:https://wiki.ai-thinker.com/ai_ide_use  , 仅作为学习笔记. 一.关于报错 注意:Eclipse 只是一个代码编写工具,它并不能读取 makefile 里 ...

  7. Spring Boot 自定义注解,AOP 切面统一打印出入参请求日志

    其实,小哈在之前就出过一篇关于如何使用 AOP 切面统一打印请求日志的文章,那为什么还要再出一篇呢?没东西写了? 哈哈,当然不是!原因是当时的实现方案还是存在缺陷的,原因如下: 不够灵活,由于是以所有 ...

  8. Spring框架4大原则和主要功能

    Spring框架4大原则: 使用POJO进行轻量级和最小侵入式开发 POJO(Plain Ordinary Java Object)简单的Java对象,实际就是普通JavaBeans,是为了避免和EJ ...

  9. vue中数据绑定遇到的问题

    <!-- 使用element中的表格组件,在编辑的时候传递每行的数据 --> <el-button size="small" type="success ...

  10. Delphi ADOQuery的属性 locktype、CursorLocation 、Filter、CursorType、CancelBatch 和 UpdateBatch

    以下数据,部分来自网络的收集,部分为自己测试后的原创整理,希望对你有帮助,更新会注明日期. 1.locktype  指定用户打开数据集时对数据集的锁定级别: ltUnspecified   未指定锁定 ...