mariadb 集群使用

集群启动问题

在kvm虚机下,启动mariad,日志报如下错误:

170821 11:32:47 [Note] /usr/libexec/mysqld: Shutdown complete

170821 11:32:47 mysqld_safe mysqld from pid file /var/run/mariadb/mariadb.pid ended
170821 11:32:47 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
170821 11:32:47 [Note] /usr/libexec/mysqld (mysqld 5.5.44-MariaDB) starting as process 2344 ...
170821 11:32:48 InnoDB: The InnoDB memory heap is disabled
170821 11:32:48 InnoDB: Mutexes and rw_locks use GCC atomic builtins
170821 11:32:48 InnoDB: Compressed tables use zlib 1.2.7
170821 11:32:48 InnoDB: Using Linux native AIO
170821 11:32:48 InnoDB: Initializing buffer pool, size = 128.0M
170821 11:32:48 InnoDB: Completed initialization of buffer pool
170821 11:32:48 InnoDB: highest supported file format is Barracuda.
170821 11:32:48  InnoDB: Waiting for the background threads to start
170821 11:32:49 Percona XtraDB (http://www.percona.com) 5.5.43-MariaDB-37.2 started; log sequence number 1597945
170821 11:32:49 [Note] Plugin 'FEEDBACK' is disabled.
170821 11:32:49 [ERROR] Can't create IP socket: Success
170821 11:32:49 [ERROR] Aborting

170821 11:32:49  InnoDB: Starting shutdown...
170821 11:32:49  InnoDB: Shutdown completed; log sequence number 1597945
170821 11:32:49 [Note] /usr/libexec/mysqld: Shutdown complete

170821 11:32:50 mysqld_safe mysqld from pid file /var/run/mariadb/mariadb.pid ended
170821 11:32:51 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
170821 11:32:51 [Note] /usr/libexec/mysqld (mysqld 5.5.44-MariaDB) starting as process 2674 ...
170821 11:32:51 InnoDB: The InnoDB memory heap is disabled
170821 11:32:51 InnoDB: Mutexes and rw_locks use GCC atomic builtins
170821 11:32:51 InnoDB: Compressed tables use zlib 1.2.7
170821 11:32:51 InnoDB: Using Linux native AIO
170821 11:32:51 InnoDB: Initializing buffer pool, size = 128.0M
170821 11:32:51 InnoDB: Completed initialization of buffer pool
170821 11:32:51 InnoDB: highest supported file format is Barracuda.
170821 11:32:44 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
170821 11:32:44 [Note] /usr/libexec/mysqld (mysqld 5.5.44-MariaDB) starting as process 2015 ...
170821 11:32:44 InnoDB: The InnoDB memory heap is disabled
170821 11:32:44 InnoDB: Mutexes and rw_locks use GCC atomic builtins
170821 11:32:44 InnoDB: Compressed tables use zlib 1.2.7
170821 11:32:44 InnoDB: Using Linux native AIO
170821 11:32:44 InnoDB: Initializing buffer pool, size = 128.0M
170821 11:32:44 InnoDB: Completed initialization of buffer pool
InnoDB: The first specified data file ./ibdata1 did not exist:
InnoDB: a new database to be created!
170821 11:32:44  InnoDB: Setting file ./ibdata1 size to 10 MB
InnoDB: Database physically writes the file full: wait...
170821 11:32:44  InnoDB: Log file ./ib_logfile0 did not exist: new to be created
InnoDB: Setting log file ./ib_logfile0 size to 5 MB
InnoDB: Database physically writes the file full: wait...
170821 11:32:45  InnoDB: Log file ./ib_logfile1 did not exist: new to be created
InnoDB: Setting log file ./ib_logfile1 size to 5 MB
InnoDB: Database physically writes the file full: wait...
InnoDB: Doublewrite buffer not found: creating new
InnoDB: Doublewrite buffer created
InnoDB: 127 rollback segment(s) active.
InnoDB: Creating foreign key constraint system tables
InnoDB: Foreign key constraint system tables created
170821 11:32:45  InnoDB: Waiting for the background threads to start
170821 11:32:46 Percona XtraDB (http://www.percona.com) 5.5.43-MariaDB-37.2 started; log sequence number 0
170821 11:32:46 [Note] Plugin 'FEEDBACK' is disabled.
170821 11:32:46 [ERROR] Can't create IP socket: Success
170821 11:32:46 [ERROR] Aborting

对应的错误码:  | 1081 | 08S01 | ER_IPSOCK_ERROR| Can't create IP socket

问题: mariadb的配置文件中,bind-address 的值不正确。  /etc/my.cnf  或 /etc/my.cnf.d/*

解决: 设置正确的bind-address值。

http://bbs.chinaunix.net/thread-4193700-1-1.html

清除数据,重新初始化数据库

#rm /etc/my.cnf
#rm -rf /var/lib/mysql
#rm -rf /usr/share/mysql
#rm -rf /usr/lib/mysql
#rm -rf /var/run/mysql/

#mysql_install_db --user=mysql --datadir=/var/lib/mysql/
[root@vStack ~]# mysql_install_db --user=mysql --datadir=/var/lib/mysql
Installing MariaDB/MySQL system tables in '/var/lib/mysql' ...
170821 14:10:07 [Note] /usr/libexec/mysqld (mysqld 5.5.44-MariaDB) starting as process 2526 ...
170821 14:10:07 [ERROR] mysqld: File '/var/lib/mysql/aria_log_control' not found (Errcode: 13)
170821 14:10:07 [ERROR] mysqld: Got error 'Can't open file' when trying to use aria control file '/var/lib/mysql/aria_log_control'
170821 14:10:07 [ERROR] Plugin 'Aria' init function returned error.
170821 14:10:07 [ERROR] Plugin 'Aria' registration as a STORAGE ENGINE failed.
170821 14:10:07 [ERROR] mysqld: Can't find file: './mysql/db.frm' (errno: 13)
ERROR: 1017  Can't find file: './mysql/db.frm' (errno: 13)
170821 14:10:07 [ERROR] Aborting

170821 14:10:07 [Note] /usr/libexec/mysqld: Shutdown complete


Installation of system tables failed!  Examine the logs in
/var/lib/mysql for more information.

The problem could be conflicting information in an external
my.cnf files. You can ignore these by doing:

    shell> /usr/bin/scripts/mysql_install_db --defaults-file=~/.my.cnf

You can also try to start the mysqld daemon with:

    shell> /usr/libexec/mysqld --skip-grant --general-log &

and use the command line tool /usr/bin/mysql
to connect to the mysql database and look at the grant tables:

    shell> /usr/bin/mysql -u root mysql
    mysql> show tables;

Try 'mysqld --help' if you have problems with paths.  Using
--general-log gives you a log in /var/lib/mysql that may be helpful.

The latest information about mysql_install_db is available at
https://mariadb.com/kb/en/installing-system-tables-mysql_install_db
MariaDB is hosted on launchpad; You can find the latest source and
email lists at http://launchpad.net/maria

Please check all of the above before submitting a bug report
at http://mariadb.org/jira

https://www.reddit.com/r/linuxadmin/comments/myy2b/mariadb_fails_to_start_due_to_missing_file_which/

问题:文件权限问题。

修改:chown mysql:mysql -R .   将/var/lib/mysql 下的所有文件、目录的所有者,修改为mysql。

           重新启动 mariadb服务器,即可。

原文地址:https://www.cnblogs.com/doscho/p/6512990.html