Database Problem - Distributed System

Hieverybody…
First, sorry for my poor english!

I have a Asterisk / A2b / FreePBX Enviroment Cenario Works Good for me.

My problem is…I dont run my freepbx if database is putted on different machine. All config are IGNORED by freepbx, trying to connect only with local mysql

All password and adress of my structure in files listed below are replaced, ok?

To maximize performace, i have putted this is 2 machines, with distinct services…

Machine 01 -
APACHE
DATABASE MySQL
Java JRE (For OpenFire)
Running Services - In this machine, i have my A2b, All Databases, Munim Server, Openfire Server, all works ok and interact with asterisk via Manager
My asterisk is on Realtime mode, and all databases (asterisk and CDR) are in this machine,

Machine 02
Asterisk
Apache (Only for FreePBX)
Running Cenario - My FreePBX ignore all configuration putted on amportal.conf or freepbx.conf, both on /etc, as default installation.
If i put databases running on local machine, all works ok, But in other machine, is ignored.

My Files to Inspect…

freepbx.conf

<?php $amp_conf['AMPDBUSER'] = 'freepbxuser'; $amp_conf['AMPDBPASS'] = 'My_Password'; $amp_conf['AMPDBHOST'] = 'Host or IP - None Diference'; $amp_conf['AMPDBNAME'] = 'asterisk'; $amp_conf['AMPDBENGINE'] = 'mysql'; $amp_conf['datasource'] = ''; //for sqlite3 require_once('/usr/share/freepbx/admin/bootstrap.php'); amportal.conf AMPDBHOST=My IP AMPDBENGINE=mysql AMPDBNAME=asterisk AMPENGINE=:asterisk AMPDBUSER=freepbxuser (Custom User, tested via PHPMyAdmin) AMPDBPASS=My Password All i have on log is this... /var/log/apache.error.log [error] Connection error: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) If i put this to work, is good for me. In future, i will try to run in the BEST cenario for me. If i put my FreePBX on APP Machine (Machine 01_ and disable my Apache on asterisk Server, comunicate all data via Manager, is my dream goal... Thanks for any help or time reading this JCQ

Hi Again…

I dint understand. No answers and no time to wait more…

I will dont use FreePBX on my application. All i make is correct, put all files with correct permissions, and all data about database is ignored by Amportal and Freepbx.

Always ignored…

JCQ

FreePBX does not support Asterisk Realtime mode.

Ok, i undestand this…

So, why FreePBX ignore all config on amportal.conf or freepbc.conf and only try to connect on local Mysql…

This is a Bug?

JCQ

I know on a 2.6 system I had no problem connecting to a remote database. I doubt the functionality has broken going forward.

The variable must be declared somewhere else.

Sorry I can’t be of any more help.

You need to grant access from remote server in mysql to asterisk and asteriskcdrdb.

Connect to the mysql on Machine01 and type in mysql cli:

select User,Host from mysql.user;

Hi everybody…

This is not a Access Problem, for sure… I am not a noob, and all users and connections are tested and re-tested for me, ok…

The user on remote machine is ok…
The database, structure and permissions are ok…
From astrisk machine, i make a telnet on Mysql port, acess database from client, all things working ok…

I remember… The message on my log, is clear…

error] Connection error: Can’t connect to local MySQL server through socket ‘/var/run/mysqld/mysqld.sock’ (2)

I have putt all DB config on amportal.conf and freepbx.conf, and i have tried with ’ ', withou ‘’, in begining, in end of file, all forms to amportal read and try to connect on remote DB. No signal of this, no signal of changes…

Declare variable? What and Why?

set $XPTO=?

I have tried declare on system de Path Variable, as a read on amportal.conf. No sucess for me…

Just trying to conect on local mysql…

Last issue. All works ok for me, In REALTIME ASTERISk, if i put the database (asterisk) and asteriskcdr on localmachine…

LOL this problem, no?

JCQ

This problem is Surreal for me…

But, i make a double check on all DB stuff, users and permissions…

The user (freepbxuser) is access granted on localhost, and on 2 other hosts (2 ETH’s on Machine 2)

I have re-tested the remote conncetion for all databases from remote mysqlcli with user freepbxuser and all works ok…

I was check again que permission of files amportal.conf, and freepbx.conf and all is ok for me (asterisk:asterisk, with rw r r permissions for both files) - Remember, this files and all AMPORTAL stuff, except database, is on machine 2 (asterisk Server)

The path of amportal.conf and freepbx.conf is /etc, with symlinks created, just for secure reasons, on /etc/asterisk

All Declared variables on BOTH files, are ok. I have tried use host name, ip number abd smoke signals (rsrs) on host variable.

I have tried change the freepbxuser password for a simple text without symbols, and this not work too…

I dont have more ideas…

JCQ

I just tested it, and it works just like it should.

Server 192.168.0.205:
Changed amportal.conf by setting AMPDBHOST=192.168.0.202
Changed freepbx.conf by setting $amp_conf[‘AMPDBHOST’] = ‘192.168.0.202’;

Stopped mysqld on 205.

On mysql on 202:

GRANT USAGE ON *.* TO 'freepbxuser'@'192.168.0.205' IDENTIFIED BY PASSWORD 'somesecretpw'
GRANT ALL PRIVILEGES ON `asterisk`.* TO 'freepbxuser'@'192.168.0.205'
GRANT ALL PRIVILEGES ON `asteriskcdrdb`.* TO 'freepbxuser'@'192.168.0.205'

I then, just for testing, stopped iptables on both 202 and 205.

It worked.

UPDATE:
And of course, edit cdr_mysql.conf and change hostname to 192.168.0.202

Hi Everybody…

Is not a DB Permissions… All in my system in DB users, permissions and privileges are set ok! I was checked again, and tested and all is ok…

My apache error.log is clear to me… Error in LOCAL mysqld, on local mysqld sock…

Error on Web GUI… Nothing work on remote DB…

The config putted on amportal.conf AND/OR all config on freepbx.conf, both files on /etc are IGNORED by freepbx…

I dont have Iptables setted on BOTH machines at this time… Firewall is not the problem…

JCQ

Still, I got it to work in about five minutes with the steps outlined above.
Have you checked cdr_mysql.conf?