码迷,mamicode.com
首页 > 数据库 > 详细

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

时间:2019-11-24 12:20:04      阅读:108      评论:0      收藏:0      [点我收藏+]

标签:client   iss   命令   安装配置   database   log-bin   zlib   src   main   

从零开始: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的集群搭建

标签:client   iss   命令   安装配置   database   log-bin   zlib   src   main   

原文地址:https://www.cnblogs.com/Rlxy93/p/11921621.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!