无法让MariaDB 10.1(在centos 7上)仅在IPv4

时间:2016-08-30 10:04:25

标签: cluster-computing mariadb ipv4 galera

我怎样才能让MariaDB 10.1只能在IPv4上收听?奇怪但是真的是我第一次安装MariaDB并启动它时,我看到它正在正确地监听IPv4,如下面的示例图所示

enter image description here

但奇怪的是,由于某些原因重新安装MariaDB并重新启动我的Centos 7安装后,它似乎已经开始仅在IPv6上进行监听,因此我无法使Galera集群正常工作(当它在IPv4上侦听时工作正常) 。那么我如何让这个MariaDB只听IPv4。以下是我机器的截图

[root@dataqry-0001 ~]# netstat -ntpl | grep sql
tcp6 0      0 :::3306                 :::*          LISTEN      14323/mysqld

/etc/my.cnf.d/server.cnf的内容(请注意我也尝试取消注释绑定地址,它仍然是奇怪的)

#
# These groups are read by MariaDB server.
# Use it for options that only the server (but not clients) should see
#
# See the examples of server my.cnf files in /usr/share/mysql/
#

# this is read by the standalone daemon and embedded servers
[server]

# this is only for the mysqld standalone daemon
[mysqld]

#
# * Galera-related settings
#
[galera]
# Mandatory settings
#wsrep_on=ON
#wsrep_provider=
#wsrep_cluster_address=
#binlog_format=row
#default_storage_engine=InnoDB
#innodb_autoinc_lock_mode=2
#
# Allow server to accept connections on all interfaces.
#
#bind-address=0.0.0.0
#
# Optional setting
#wsrep_slave_threads=1
#innodb_flush_log_at_trx_commit=0

# this is only for embedded server
[embedded]

# This group is only read by MariaDB servers, not by MySQL.
# If you use the same .cnf file for MySQL and MariaDB,
# you can put MariaDB-only options here
[mariadb]

# This group is only read by MariaDB-10.1 servers.
# If you use the same .cnf file for MariaDB of different versions,
# use this group for options that older servers don't understand
[mariadb-10.1]

我应该补充一点,我对遍布各处的MariaDB / MySQL设置感到困惑。上面的绑定地址是Galera我想的。这是我第一次在Centos 7上使用MariaDB,所以道歉 - 我甚至尝试过早禁用IPv6,但没有显示它在IPv4上听取

由于 M.M

1 个答案:

答案 0 :(得分:0)

虽然官方MariaDB错误跟踪器中的信息似乎表明这是不可能的,除非使用mysql软件;我可以确认在例如中设置以下配置选项/etc/my.cnf,至少在使用版本10.1.21-MariaDB时,确实按预期工作,如@Hackerman评论中所述。

bind-address=0.0.0.0

我未曾误解的误解/误导/无关的官方错误跟踪器:

要回答与您的具体情况相关的问题,您应该注意" 部分"在哪个设置下;即,您将其写在[galera]部分下,而不是服务器范围的[mysqld]部分。

[mysqld]

#
# * Galera-related settings
#
[galera]
# Mandatory settings
#wsrep_on=ON
#wsrep_provider=
#wsrep_cluster_address=
#binlog_format=row
#default_storage_engine=InnoDB
#innodb_autoinc_lock_mode=2
#
# Allow server to accept connections on all interfaces.
#
#bind-address=0.0.0.0
相关问题