Skip to content

Commit

Permalink
Change to galera
Browse files Browse the repository at this point in the history
  • Loading branch information
Meezaan-ud-Din committed Apr 3, 2019
1 parent 0814908 commit e6a051c
Showing 1 changed file with 2 additions and 21 deletions.
23 changes: 2 additions & 21 deletions routes/status/v1/status.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,30 +19,11 @@
} catch (Exception $e) {
$dbResult = false;
}
try {
$db2 = $dbx->getConnection('database_slave');
$db2Result = $db2->fetchAssoc("SELECT id
FROM geolocate WHERE
city = ? AND countryiso = ?",
['Dubai', 'AE']);

if ($mc !== false) {
if ($dbResult !== false) {
$mc->set('DB_CONNECTION', 'database');
} else {
$mc->set('DB_CONNECTION', 'database_slave');
}
}
} catch (Exception $e) {
$db2Result = false;
}

$status = [
'memcached' => $mc === false ? 'NOT OK' : 'OK',
'perconaMaster' => $dbResult === false ? 'NOT OK' : 'OK',
'perconaSlave' => $db2Result === false ? 'NOT OK' : 'OK',
'activeDb' => $mc === false ? 'NOT OK' : $mc->get('DB_CONNECTION')
];
'galeraCluster' => $dbResult === false ? 'NOT OK' : 'OK',
];

if ($mc === false || $dbResult === false || $db2Result === false) {
return $response->withJson(ApiResponse::build($status, 500, 'Status Check Failed'), 500);
Expand Down

0 comments on commit e6a051c

Please sign in to comment.