Welcome Guest, Not a member yet? Register   Sign In
Failover database setup problem
#1

Hi,

I have problem with database failover setup. In my application I use 3 databases:
1. users DB - postgres -simple configuration,
2. data DB - postgres 2 same database(but different versions) and 2 different servers one as failover
3. data DB - ingres 2 same database and 2 different servers -> odbc connection one as failover

I test failover in codeigniter (version 3.1.9) switching off DB servers. For IngresDB ODBC there is no problem it switch to failover database. 
But for postgres I get an error:

Code:
[color=#4f5155][size=small]Severity: Warning[/size][/color]
[color=#4f5155][size=small]Message: pg_connect(): Unable to connect to PostgreSQL server: could not connect to server: Connection refused Is the server running on host "<server_name>" (<ip>) and accepting TCP/IP connections on port 5432?[/size][/color]
[color=#4f5155][size=small]Filename: postgre/postgre_driver.php[/size][/color]

[color=#4f5155][size=small][color=#4f5155][size=small]Severity: Warning[/size][/color][/size][/color]
[color=#4f5155][size=small][color=#4f5155][size=small]Message: pg_connect(): Unable to connect to PostgreSQL server: FATAL: role "apache" does not exist[/size][/color][/size][/color]
[color=#4f5155][size=small][color=#4f5155][size=small]Filename: postgre/postgre_driver.php[/size][/color][/size][/color]


I am able to connect to the failover database without any problem (changing in database.php). There is my database.conf:

PHP Code:
$active_group 'default';
$query_builder TRUE;

$db['default'] = array(
'dsn' => '',
'hostname' => '<server01>',
'username' => '<user1>',
'password' => '<pass>',
'database' => '<usersDB>',
'dbdriver' => 'postgre',
'dbprefix' => '',
'pconnect' => FALSE,
'db_debug' => FALSE,
'cache_on' => FALSE,
'cachedir' => '',
'char_set' => 'utf8',
'dbcollat' => 'utf8_general_ci',
'swap_pre' => '',
'encrypt' => FALSE,
'compress' => FALSE,
'stricton' => FALSE,
'port' => '5432'
);

// postgres database
$db['navdb02'] = array(
'dsn'  => '',
'hostname' => '<server02a>',
'username' => '<user2>',
'password' => '<pass2>',
'database' => '<dataDB02a>',
'dbdriver' => 'postgre',
'dbprefix' => '',
'pconnect' => FALSE,
'db_debug' => TRUE,
'cache_on' => FALSE,
'cachedir' => '',
'char_set' => 'utf8',
'dbcollat' => 'utf8_general_ci',
'swap_pre' => '',
'encrypt' => FALSE,
'compress' => FALSE,
'stricton' => FALSE,
'port' => '5432',
'autoinit' => TRUE
);

$db['navdb02']['failover'] = array(array(
'dsn'  => '',
'hostname' => '<server02b>',
'username' => '<user2>',
'password' => '<pass3>',
'database' => '<dataDB02b>',
'dbdriver' => 'postgre',
'dbprefix' => '',
'pconnect' => FALSE,
'db_debug' => TRUE,
'cache_on' => FALSE,
'cachedir' => '',
'char_set' => 'utf8',
'dbcollat' => 'utf8_general_ci',
'swap_pre' => '',
'encrypt' => FALSE,
'compress' => FALSE,
'stricton' => FALSE,
'port' => '5432',
'autoinit' => TRUE
));

// ingres database
$db['navdb01'] = array(
    'dsn'  => '<server03a>',
    'hostname' => '',
    'username' => '',
    'password' => '',
    'database' => '',
    'dbdriver' => 'odbc',
    'dbprefix' => '',
    'pconnect' => FALSE,
    'db_debug' => FALSE,
    'cache_on' => FALSE,
    'cachedir' => '',
    'char_set' => 'utf8',
    'dbcollat' => 'utf8_general_ci',
    'swap_pre' => '',
    'encrypt' => FALSE,
    'compress' => FALSE,
    'stricton' => FALSE,
    'port' => ''
);
$db['navdb01']['failover'] = array(array(
'dsn'=> '<server03b>',
'hostname' => '',
'username' => '',
'password' => '',
'database' => '',
'dbdriver' => 'odbc',
'dbprefix' => '',
'pconnect' => FALSE,
'db_debug' => FALSE,
'cache_on' => FALSE,
'cachedir' => '',
'char_set' => 'utf8',
'dbcollat' => 'utf8_general_ci',
'swap_pre' => '',
'encrypt' => FALSE,
'compress' => FALSE,
'stricton' => FALSE,
'port' => ''
)); 

Has someone same problem and know solution?
Reply




Theme © iAndrew 2016 - Forum software by © MyBB