Ad Widget

Collapse

Remote mysql server won't connect on install

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • LTRA
    Junior Member
    • Nov 2013
    • 2

    #1

    Remote mysql server won't connect on install

    First of all, sorry about my english..

    I'm trying to install zabbix 2.2 on a centos 6.4 64b. The database it's a mysql installed from centos repo.

    The problem is, when i finish configuring zabbix and mysql to continue the install from the web, the db connection can stablish re connection to the remote mysql.

    I try to access from the zabbix server via mysql -h remote_server -u zabbix -p and i can access correctly, even doing a show grants for zabbix, tell me that i hava acces. So, the mysql server it's set correctly.

    I hace use "rpm -ivh http://repo.zabbix.com/zabbix/2.2/rhel/6/x86_64/zabbix-release-2.2-1.el6.noarch.rpm" to install my zabbix server.

    I've use the procedure that i found on this url "https://www.zabbix.com/documentation/2.2/manual/installation/install_from_packages" except for 2 things, i didn't install mysql-server on zabbix server, and i change the grants for the database as i can access to the database remotely.

    The only file from zabbix that i change it's "zabbix_server_conf" to add dbname user and pass.

    I try to connect to using a different user even root, butt the web install can't go on. the error that it constantly gives is:

    "Error connecting to database [Can't connect to MySQL server on '10.3.1.135' (13)]"

    where 10.3.1.135 it's remote db server.

    I usually install zabbix using local mysql db, but this time i'm trying to optimize the install with a remote db. Should i change any other config on any other file or something that i'm missing? or even, there's any tutorial on zabbix page that im missing relate to zabbix install with remote database server?

    Thanks a lot !!!

    Alejandro
    Zabbix Newbie
  • gmanual
    Junior Member
    • Oct 2008
    • 10

    #2
    I was having this issue as well able to connect via the mysql client but the zabbix configuration was giving the following error:

    Code:
    [Z3001] connection to database 'zabbix' failed: [2003] Can't connect to MySQL server on '<removed>' (13)
    It turned out be be SELinux was blocking the connection. There was two commands I used to enable connectivity.

    The first is how I discovered the issue, allowing apache to connect the database
    during the web interface install.
    Code:
    setsebool -P httpd_can_network_connect_db=1
    After running this the zabbix web interface could connect to the database but I was still getting errors for the zabbix-server process.

    Using:
    Code:
    getsebool -a
    Which lists all SELinux variables and I found the following right down the bottom:

    zabbix_can_network --> off
    Using similar command to the first fix:

    Code:
    setsebool -P zabbix_can_network=1
    I have not yet tested if this is a persistent fix but sharing to get people on the right track.

    EDIT:
    For the webservice to monitor status of zabbix-server it also needs the following:

    Code:
    semanage port -a -t http_port_t -p tcp 10051
    If you get a 'Port tcp/10051 already defined' error use -m

    Code:
    semanage port -m -t http_port_t -p tcp 10051
    This is a better rule than just globally allowing all ports with 'httpd_can_network_connect=1' (allows httpd to connect to any port)
    Last edited by gmanual; 29-03-2014, 07:37.

    Comment

    • LTRA
      Junior Member
      • Nov 2013
      • 2

      #3
      Can't connect to DB

      Gmanual, i've already resolved the issue.

      I try with SElinux, without.

      After a headache, the problem was found. It's was the damm maria db. The openSuSE install it as the default db, and when i try to know what packages of mysql were installs, i found a mix of things from maria and mysql.

      i decide to format the VM, and install DB on a CentOS, and the zabbix in another VM with CentOS to.

      Problems resolved

      Comment

      Working...