Replace the master/slave terminology

Replaces master with primary and slave with replica.

Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
This commit is contained in:
Maurício Meneghini Fauth 2021-12-18 14:25:33 -03:00
parent b92e5d91f9
commit fa5c684f27
No known key found for this signature in database
GPG Key ID: 6A16FD38AFC89CC8
32 changed files with 365 additions and 383 deletions

View File

@ -25,6 +25,7 @@ phpMyAdmin - ChangeLog
- issue #17143 Require the openssl PHP extension
- issue #17171 Remove the printview.css file from themes
- issue #17203 Redesign the export and the import pages
- issue #16197 Replace the master/slave terminology
5.1.2 (not yet released)
- issue Replaced MySQL documentation redirected links

View File

@ -36,15 +36,15 @@ function updateConfig () {
AJAX.registerTeardown('replication.js', function () {
$('#db_type').off('change');
$('#db_select').off('change');
$('#master_status_href').off('click');
$('#master_slaves_href').off('click');
$('#slave_status_href').off('click');
$('#slave_control_href').off('click');
$('#slave_errormanagement_href').off('click');
$('#slave_synchronization_href').off('click');
$('#primary_status_href').off('click');
$('#primary_replicas_href').off('click');
$('#replica_status_href').off('click');
$('#replica_control_href').off('click');
$('#replica_errormanagement_href').off('click');
$('#replica_synchronization_href').off('click');
$('#db_reset_href').off('click');
$('#db_select_href').off('click');
$('#reset_slave').off('click');
$('#reset_replica').off('click');
});
AJAX.registerOnload('replication.js', function () {
@ -52,23 +52,23 @@ AJAX.registerOnload('replication.js', function () {
$('#db_type').on('change', updateConfig);
$('#db_select').on('change', updateConfig);
$('#master_status_href').on('click', function () {
$('#replication_master_section').toggle();
$('#primary_status_href').on('click', function () {
$('#replication_primary_section').toggle();
});
$('#master_slaves_href').on('click', function () {
$('#replication_slaves_section').toggle();
$('#primary_replicas_href').on('click', function () {
$('#replication_replicas_section').toggle();
});
$('#slave_status_href').on('click', function () {
$('#replication_slave_section').toggle();
$('#replica_status_href').on('click', function () {
$('#replication_replica_section').toggle();
});
$('#slave_control_href').on('click', function () {
$('#slave_control_gui').toggle();
$('#replica_control_href').on('click', function () {
$('#replica_control_gui').toggle();
});
$('#slave_errormanagement_href').on('click', function () {
$('#slave_errormanagement_gui').toggle();
$('#replica_errormanagement_href').on('click', function () {
$('#replica_errormanagement_gui').toggle();
});
$('#slave_synchronization_href').on('click', function () {
$('#slave_synchronization_gui').toggle();
$('#replica_synchronization_href').on('click', function () {
$('#replica_synchronization_gui').toggle();
});
$('#db_reset_href').on('click', function () {
$('#db_select option:selected').prop('selected', false);
@ -78,10 +78,10 @@ AJAX.registerOnload('replication.js', function () {
$('#db_select option').prop('selected', true);
$('#db_select').trigger('change');
});
$('#reset_slave').on('click', function (e) {
$('#reset_replica').on('click', function (e) {
e.preventDefault();
var $anchor = $(this);
var question = Messages.strResetSlaveWarning;
var question = Messages.strResetReplicaWarning;
$anchor.confirm(question, $anchor.attr('href'), function (url) {
Functions.ajaxShowMessage();
AJAX.source = $anchor;

View File

@ -190,7 +190,7 @@ return [
'You are using the MySQL Query cache with a fairly high traffic database.'
. ' It might be worth considering to use '
. '<a href="https://dev.mysql.com/doc/refman/5.6/en/ha-memcached.html">memcached</a>'
. ' instead of the MySQL Query cache, especially if you have multiple slaves.'
. ' instead of the MySQL Query cache, especially if you have multiple replicas.'
),
'justification' => __(
'The query cache is enabled and the server receives %d queries per second.'

View File

@ -167,7 +167,7 @@ class StructureController extends AbstractController
]);
}
$this->replicationInfo->load($_POST['master_connection'] ?? null);
$this->replicationInfo->load($_POST['primary_connection'] ?? null);
$replicaInfo = $this->replicationInfo->getReplicaInfo();
$pageSettings = new PageSettings('DbStructure');
@ -418,7 +418,7 @@ class StructureController extends AbstractController
)
),
'tracking_icon' => $this->getTrackingIcon($truename),
'server_slave_status' => $replicaInfo['status'],
'server_replica_status' => $replicaInfo['status'],
'table_url_params' => $tableUrlParams,
'db_is_system_schema' => $this->dbIsSystemSchema,
'drop_query' => $dropQuery,
@ -485,7 +485,7 @@ class StructureController extends AbstractController
'structure_table_rows' => $structureTableRows,
'body_for_table_summary' => [
'num_tables' => $this->numTables,
'server_slave_status' => $replicaInfo['status'],
'server_replica_status' => $replicaInfo['status'],
'db_is_system_schema' => $this->dbIsSystemSchema,
'sum_entries' => $sumEntries,
'database_collation' => $databaseCollation,
@ -602,14 +602,14 @@ class StructureController extends AbstractController
{
$do = $ignored = false;
if ($replicaInfo['status']) {
$nbServSlaveDoDb = count($replicaInfo['Do_DB']);
$nbServSlaveIgnoreDb = count($replicaInfo['Ignore_DB']);
$nbServReplicaDoDb = count($replicaInfo['Do_DB']);
$nbServReplicaIgnoreDb = count($replicaInfo['Ignore_DB']);
$searchDoDBInTruename = array_search($table, $replicaInfo['Do_DB']);
$searchDoDBInDB = array_search($this->db, $replicaInfo['Do_DB']);
$do = (is_string($searchDoDBInTruename) && strlen($searchDoDBInTruename) > 0)
|| (is_string($searchDoDBInDB) && strlen($searchDoDBInDB) > 0)
|| ($nbServSlaveDoDb == 0 && $nbServSlaveIgnoreDb == 0)
|| ($nbServReplicaDoDb == 0 && $nbServReplicaIgnoreDb == 0)
|| $this->hasTable($replicaInfo['Wild_Do_Table'], $table);
$searchDb = array_search($this->db, $replicaInfo['Ignore_DB']);

View File

@ -70,7 +70,7 @@ final class JavaScriptMessagesController
),
'strTruncatePartitionWarning' => __('Do you really want to TRUNCATE the selected partition(s)?'),
'strRemovePartitioningWarning' => __('Do you really want to remove partitioning?'),
'strResetSlaveWarning' => __('Do you really want to RESET SLAVE?'),
'strResetReplicaWarning' => __('Do you really want to reset the replica (RESET REPLICA)?'),
'strChangeColumnCollation' => __(
'This operation will attempt to convert your data to the new collation. In '
. 'rare cases, especially where a character doesn\'t exist in the new '

View File

@ -94,7 +94,7 @@ class DatabasesController extends AbstractController
}
$replicationInfo = new ReplicationInfo($this->dbi);
$replicationInfo->load($_POST['master_connection'] ?? null);
$replicationInfo->load($_POST['primary_connection'] ?? null);
$primaryInfo = $replicationInfo->getPrimaryInfo();
$replicaInfo = $replicationInfo->getReplicaInfo();
@ -166,8 +166,8 @@ class DatabasesController extends AbstractController
'pos' => $this->position,
'url_params' => $urlParams,
'max_db_list' => $cfg['MaxDbList'],
'has_master_replication' => $primaryInfo['status'],
'has_slave_replication' => $replicaInfo['status'],
'has_primary_replication' => $primaryInfo['status'],
'has_replica_replication' => $replicaInfo['status'],
'is_drop_allowed' => $this->dbi->isSuperUser() || $cfg['AllowUserDropDatabase'],
'text_dir' => $text_dir,
]);
@ -222,32 +222,32 @@ class DatabasesController extends AbstractController
$totalStatistics = $this->getStatisticsColumns();
foreach ($this->databases as $database) {
$replication = [
'master' => ['status' => $primaryInfo['status']],
'slave' => ['status' => $replicaInfo['status']],
'primary' => ['status' => $primaryInfo['status']],
'replica' => ['status' => $replicaInfo['status']],
];
if ($primaryInfo['status']) {
$key = array_search($database['SCHEMA_NAME'], $primaryInfo['Ignore_DB']);
$replication['master']['is_replicated'] = false;
$replication['primary']['is_replicated'] = false;
if (strlen((string) $key) === 0) {
$key = array_search($database['SCHEMA_NAME'], $primaryInfo['Do_DB']);
if (strlen((string) $key) > 0 || count($primaryInfo['Do_DB']) === 0) {
$replication['master']['is_replicated'] = true;
$replication['primary']['is_replicated'] = true;
}
}
}
if ($replicaInfo['status']) {
$key = array_search($database['SCHEMA_NAME'], $replicaInfo['Ignore_DB']);
$replication['slave']['is_replicated'] = false;
$replication['replica']['is_replicated'] = false;
if (strlen((string) $key) === 0) {
$key = array_search($database['SCHEMA_NAME'], $replicaInfo['Do_DB']);
if (strlen((string) $key) > 0 || count($replicaInfo['Do_DB']) === 0) {
$replication['slave']['is_replicated'] = true;
$replication['replica']['is_replicated'] = true;
}
}
}

View File

@ -45,8 +45,8 @@ class ReplicationController extends AbstractController
$params = [
'url_params' => $_POST['url_params'] ?? null,
'mr_configure' => $_POST['mr_configure'] ?? null,
'sl_configure' => $_POST['sl_configure'] ?? null,
'primary_configure' => $_POST['primary_configure'] ?? null,
'replica_configure' => $_POST['replica_configure'] ?? null,
'repl_clear_scr' => $_POST['repl_clear_scr'] ?? null,
];
$errorUrl = Url::getFromRoute('/');
@ -56,7 +56,7 @@ class ReplicationController extends AbstractController
}
$replicationInfo = new ReplicationInfo($this->dbi);
$replicationInfo->load($_POST['master_connection'] ?? null);
$replicationInfo->load($_POST['primary_connection'] ?? null);
$primaryInfo = $replicationInfo->getPrimaryInfo();
$replicaInfo = $replicationInfo->getReplicaInfo();
@ -74,21 +74,21 @@ class ReplicationController extends AbstractController
$errorMessages = $this->replicationGui->getHtmlForErrorMessage();
if ($primaryInfo['status']) {
$masterReplicationHtml = $this->replicationGui->getHtmlForMasterReplication();
$primaryReplicationHtml = $this->replicationGui->getHtmlForPrimaryReplication();
}
if (isset($params['mr_configure'])) {
$masterConfigurationHtml = $this->replicationGui->getHtmlForMasterConfiguration();
if (isset($params['primary_configure'])) {
$primaryConfigurationHtml = $this->replicationGui->getHtmlForPrimaryConfiguration();
} else {
if (! isset($params['repl_clear_scr'])) {
$slaveConfigurationHtml = $this->replicationGui->getHtmlForSlaveConfiguration(
$replicaConfigurationHtml = $this->replicationGui->getHtmlForReplicaConfiguration(
$replicaInfo['status'],
$replicationInfo->getReplicaStatus()
);
}
if (isset($params['sl_configure'])) {
$changeMasterHtml = $this->replicationGui->getHtmlForReplicationChangeMaster('slave_changemaster');
if (isset($params['replica_configure'])) {
$changePrimaryHtml = $this->replicationGui->getHtmlForReplicationChangePrimary('replica_changeprimary');
}
}
@ -96,14 +96,14 @@ class ReplicationController extends AbstractController
'url_params' => $urlParams,
'is_super_user' => $this->dbi->isSuperUser(),
'error_messages' => $errorMessages,
'is_master' => $primaryInfo['status'],
'master_configure' => $params['mr_configure'],
'slave_configure' => $params['sl_configure'],
'is_primary' => $primaryInfo['status'],
'primary_configure' => $params['primary_configure'],
'replica_configure' => $params['replica_configure'],
'clear_screen' => $params['repl_clear_scr'],
'master_replication_html' => $masterReplicationHtml ?? '',
'master_configuration_html' => $masterConfigurationHtml ?? '',
'slave_configuration_html' => $slaveConfigurationHtml ?? '',
'change_master_html' => $changeMasterHtml ?? '',
'primary_replication_html' => $primaryReplicationHtml ?? '',
'primary_configuration_html' => $primaryConfigurationHtml ?? '',
'replica_configuration_html' => $replicaConfigurationHtml ?? '',
'change_primary_html' => $changePrimaryHtml ?? '',
]);
}
}

View File

@ -78,11 +78,11 @@ class StatusController extends AbstractController
$connections = $this->getConnectionsInfo();
if ($primaryInfo['status']) {
$replication .= $this->replicationGui->getHtmlForReplicationStatusTable('master');
$replication .= $this->replicationGui->getHtmlForReplicationStatusTable('primary');
}
if ($replicaInfo['status']) {
$replication .= $this->replicationGui->getHtmlForReplicationStatusTable('slave');
$replication .= $this->replicationGui->getHtmlForReplicationStatusTable('replica');
}
}
@ -93,8 +93,8 @@ class StatusController extends AbstractController
'start_time' => $startTime ?? null,
'traffic' => $traffic,
'connections' => $connections,
'is_master' => $primaryInfo['status'],
'is_slave' => $replicaInfo['status'],
'is_primary' => $primaryInfo['status'],
'is_replica' => $replicaInfo['status'],
'replication' => $replication,
]);
}

View File

@ -476,11 +476,11 @@ class VariablesController extends AbstractController
. ' normally not critical even if this is big.)'
),
'Select_scan' => __('The number of joins that did a full scan of the first table.'),
'Slave_open_temp_tables' => __('The number of temporary tables currently open by the slave SQL thread.'),
'Slave_open_temp_tables' => __('The number of temporary tables currently open by the replica SQL thread.'),
'Slave_retried_transactions' => __(
'Total (since startup) number of times the replication slave SQL thread has retried transactions.'
'Total (since startup) number of times the replication replica SQL thread has retried transactions.'
),
'Slave_running' => __('This is ON if this server is a slave that is connected to a master.'),
'Slave_running' => __('This is ON if this server is a replica that is connected to a primary.'),
'Slow_launch_threads' => __(
'The number of threads that have taken more than slow_launch_time seconds to create.'
),

View File

@ -34,7 +34,7 @@ class Replication
}
/**
* Configures replication slave
* Configures replication replica
*
* @param string $action possible values: START or STOP
* @param string|null $control default: null,
@ -45,7 +45,7 @@ class Replication
*
* @return mixed|int output of DatabaseInterface::tryQuery
*/
public function slaveControl(string $action, ?string $control, int $link)
public function replicaControl(string $action, ?string $control, int $link)
{
global $dbi;
@ -64,21 +64,20 @@ class Replication
}
/**
* Changes master for replication slave
* Changes primary for replication replica
*
* @param string $user replication user on master
* @param string $user replication user on primary
* @param string $password password for the user
* @param string $host master's hostname or IP
* @param string $host primary's hostname or IP
* @param int $port port, where mysql is running
* @param array $pos position of mysql replication,
* array should contain fields File and Position
* @param bool $stop shall we stop slave?
* @param bool $start shall we start slave?
* @param array $pos position of mysql replication, array should contain fields File and Position
* @param bool $stop shall we stop replica?
* @param bool $start shall we start replica?
* @param int $link mysql link
*
* @return string output of CHANGE MASTER mysql command
*/
public function slaveChangeMaster(
public function replicaChangePrimary(
$user,
$password,
$host,
@ -91,7 +90,7 @@ class Replication
global $dbi;
if ($stop) {
$this->slaveControl('STOP', null, $link);
$this->replicaControl('STOP', null, $link);
}
$out = $dbi->tryQuery(
@ -106,7 +105,7 @@ class Replication
);
if ($start) {
$this->slaveControl('START', null, $link);
$this->replicaControl('START', null, $link);
}
return $out;
@ -123,7 +122,7 @@ class Replication
*
* @return mixed mysql link on success
*/
public function connectToMaster(
public function connectToPrimary(
$user,
$password,
$host = null,
@ -145,15 +144,15 @@ class Replication
}
/**
* Fetches position and file of current binary log on master
* Fetches position and file of current binary log on primary
*
* @param int $link mysql link
*
* @return array an array containing File and Position in MySQL replication
* on master server, useful for slaveChangeMaster()
* on primary server, useful for {@see Replication::replicaChangePrimary()}.
* @phpstan-return array{'File'?: string, 'Position'?: string}
*/
public function slaveBinLogMaster(int $link): array
public function replicaBinLogPrimary(int $link): array
{
global $dbi;

View File

@ -66,137 +66,137 @@ class ReplicationGui
}
/**
* returns HTML for master replication
* returns HTML for primary replication
*
* @return string HTML code
*/
public function getHtmlForMasterReplication(): string
public function getHtmlForPrimaryReplication(): string
{
global $dbi;
if (! isset($_POST['repl_clear_scr'])) {
$masterStatusTable = $this->getHtmlForReplicationStatusTable('master', true, false);
$slaves = $dbi->fetchResult('SHOW SLAVE HOSTS', null, null);
$primaryStatusTable = $this->getHtmlForReplicationStatusTable('primary', true, false);
$replicas = $dbi->fetchResult('SHOW SLAVE HOSTS', null, null);
$urlParams = $GLOBALS['urlParams'];
$urlParams['mr_adduser'] = true;
$urlParams['primary_add_user'] = true;
$urlParams['repl_clear_scr'] = true;
}
if (isset($_POST['mr_adduser'])) {
$masterAddSlaveUser = $this->getHtmlForReplicationMasterAddSlaveUser();
if (isset($_POST['primary_add_user'])) {
$primaryAddReplicaUser = $this->getHtmlForReplicationPrimaryAddReplicaUser();
}
return $this->template->render('server/replication/master_replication', [
return $this->template->render('server/replication/primary_replication', [
'clear_screen' => isset($_POST['repl_clear_scr']),
'master_status_table' => $masterStatusTable ?? '',
'slaves' => $slaves ?? [],
'primary_status_table' => $primaryStatusTable ?? '',
'replicas' => $replicas ?? [],
'url_params' => $urlParams ?? [],
'master_add_user' => isset($_POST['mr_adduser']),
'master_add_slave_user' => $masterAddSlaveUser ?? '',
'primary_add_user' => isset($_POST['primary_add_user']),
'primary_add_replica_user' => $primaryAddReplicaUser ?? '',
]);
}
/**
* returns HTML for master replication configuration
* returns HTML for primary replication configuration
*
* @return string HTML code
*/
public function getHtmlForMasterConfiguration(): string
public function getHtmlForPrimaryConfiguration(): string
{
$databaseMultibox = $this->getHtmlForReplicationDbMultibox();
return $this->template->render(
'server/replication/master_configuration',
'server/replication/primary_configuration',
['database_multibox' => $databaseMultibox]
);
}
/**
* returns HTML for slave replication configuration
* returns HTML for replica replication configuration
*
* @param bool $serverSlaveStatus Whether it is Master or Slave
* @param array $serverSlaveReplication Slave replication
* @param bool $serverReplicaStatus Whether it is Primary or Replica
* @param array $serverReplicaReplication Replica replication
*
* @return string HTML code
*/
public function getHtmlForSlaveConfiguration(
$serverSlaveStatus,
array $serverSlaveReplication
public function getHtmlForReplicaConfiguration(
$serverReplicaStatus,
array $serverReplicaReplication
): string {
global $dbi;
$serverSlaveMultiReplication = $dbi->fetchResult('SHOW ALL SLAVES STATUS');
if ($serverSlaveStatus) {
$serverReplicaMultiReplication = $dbi->fetchResult('SHOW ALL SLAVES STATUS');
if ($serverReplicaStatus) {
$urlParams = $GLOBALS['urlParams'];
$urlParams['sr_take_action'] = true;
$urlParams['sr_slave_server_control'] = true;
$urlParams['sr_replica_server_control'] = true;
if ($serverSlaveReplication[0]['Slave_IO_Running'] === 'No') {
$urlParams['sr_slave_action'] = 'start';
if ($serverReplicaReplication[0]['Slave_IO_Running'] === 'No') {
$urlParams['sr_replica_action'] = 'start';
} else {
$urlParams['sr_slave_action'] = 'stop';
$urlParams['sr_replica_action'] = 'stop';
}
$urlParams['sr_slave_control_parm'] = 'IO_THREAD';
$slaveControlIoLink = Url::getCommon($urlParams, '');
$urlParams['sr_replica_control_param'] = 'IO_THREAD';
$replicaControlIoLink = Url::getCommon($urlParams, '');
if ($serverSlaveReplication[0]['Slave_SQL_Running'] === 'No') {
$urlParams['sr_slave_action'] = 'start';
if ($serverReplicaReplication[0]['Slave_SQL_Running'] === 'No') {
$urlParams['sr_replica_action'] = 'start';
} else {
$urlParams['sr_slave_action'] = 'stop';
$urlParams['sr_replica_action'] = 'stop';
}
$urlParams['sr_slave_control_parm'] = 'SQL_THREAD';
$slaveControlSqlLink = Url::getCommon($urlParams, '');
$urlParams['sr_replica_control_param'] = 'SQL_THREAD';
$replicaControlSqlLink = Url::getCommon($urlParams, '');
if (
$serverSlaveReplication[0]['Slave_IO_Running'] === 'No'
|| $serverSlaveReplication[0]['Slave_SQL_Running'] === 'No'
$serverReplicaReplication[0]['Slave_IO_Running'] === 'No'
|| $serverReplicaReplication[0]['Slave_SQL_Running'] === 'No'
) {
$urlParams['sr_slave_action'] = 'start';
$urlParams['sr_replica_action'] = 'start';
} else {
$urlParams['sr_slave_action'] = 'stop';
$urlParams['sr_replica_action'] = 'stop';
}
$urlParams['sr_slave_control_parm'] = null;
$slaveControlFullLink = Url::getCommon($urlParams, '');
$urlParams['sr_replica_control_param'] = null;
$replicaControlFullLink = Url::getCommon($urlParams, '');
$urlParams['sr_slave_action'] = 'reset';
$slaveControlResetLink = Url::getCommon($urlParams, '');
$urlParams['sr_replica_action'] = 'reset';
$replicaControlResetLink = Url::getCommon($urlParams, '');
$urlParams = $GLOBALS['urlParams'];
$urlParams['sr_take_action'] = true;
$urlParams['sr_slave_skip_error'] = true;
$slaveSkipErrorLink = Url::getCommon($urlParams, '');
$urlParams['sr_replica_skip_error'] = true;
$replicaSkipErrorLink = Url::getCommon($urlParams, '');
$urlParams = $GLOBALS['urlParams'];
$urlParams['sl_configure'] = true;
$urlParams['replica_configure'] = true;
$urlParams['repl_clear_scr'] = true;
$reconfigureMasterLink = Url::getCommon($urlParams, '');
$reconfigurePrimaryLink = Url::getCommon($urlParams, '');
$slaveStatusTable = $this->getHtmlForReplicationStatusTable('slave', true, false);
$replicaStatusTable = $this->getHtmlForReplicationStatusTable('replica', true, false);
$slaveIoRunning = $serverSlaveReplication[0]['Slave_IO_Running'] !== 'No';
$slaveSqlRunning = $serverSlaveReplication[0]['Slave_SQL_Running'] !== 'No';
$replicaIoRunning = $serverReplicaReplication[0]['Slave_IO_Running'] !== 'No';
$replicaSqlRunning = $serverReplicaReplication[0]['Slave_SQL_Running'] !== 'No';
}
return $this->template->render('server/replication/slave_configuration', [
'server_slave_multi_replication' => $serverSlaveMultiReplication,
return $this->template->render('server/replication/replica_configuration', [
'server_replica_multi_replication' => $serverReplicaMultiReplication,
'url_params' => $GLOBALS['urlParams'],
'master_connection' => $_POST['master_connection'] ?? '',
'server_slave_status' => $serverSlaveStatus,
'slave_status_table' => $slaveStatusTable ?? '',
'slave_sql_running' => $slaveSqlRunning ?? false,
'slave_io_running' => $slaveIoRunning ?? false,
'slave_control_full_link' => $slaveControlFullLink ?? '',
'slave_control_reset_link' => $slaveControlResetLink ?? '',
'slave_control_sql_link' => $slaveControlSqlLink ?? '',
'slave_control_io_link' => $slaveControlIoLink ?? '',
'slave_skip_error_link' => $slaveSkipErrorLink ?? '',
'reconfigure_master_link' => $reconfigureMasterLink ?? '',
'has_slave_configure' => isset($_POST['sl_configure']),
'primary_connection' => $_POST['primary_connection'] ?? '',
'server_replica_status' => $serverReplicaStatus,
'replica_status_table' => $replicaStatusTable ?? '',
'replica_sql_running' => $replicaSqlRunning ?? false,
'replica_io_running' => $replicaIoRunning ?? false,
'replica_control_full_link' => $replicaControlFullLink ?? '',
'replica_control_reset_link' => $replicaControlResetLink ?? '',
'replica_control_sql_link' => $replicaControlSqlLink ?? '',
'replica_control_io_link' => $replicaControlIoLink ?? '',
'replica_skip_error_link' => $replicaSkipErrorLink ?? '',
'reconfigure_primary_link' => $reconfigurePrimaryLink ?? '',
'has_replica_configure' => isset($_POST['replica_configure']),
]);
}
@ -220,20 +220,20 @@ class ReplicationGui
}
/**
* returns HTML for changing master
* returns HTML for changing primary
*
* @param string $submitName submit button name
*
* @return string HTML code
*/
public function getHtmlForReplicationChangeMaster($submitName): string
public function getHtmlForReplicationChangePrimary($submitName): string
{
[
$usernameLength,
$hostnameLength,
] = $this->getUsernameHostnameLength();
return $this->template->render('server/replication/change_master', [
return $this->template->render('server/replication/change_primary', [
'server_id' => time(),
'username_length' => $usernameLength,
'hostname_length' => $hostnameLength,
@ -244,9 +244,8 @@ class ReplicationGui
/**
* This function returns html code for table with replication status.
*
* @param string $type either master or slave
* @param bool $isHidden if true, then default style is set to hidden,
* default value false
* @param string $type either primary or replica
* @param bool $isHidden if true, then default style is set to hidden, default value false
* @param bool $hasTitle if true, then title is displayed, default true
*
* @return string HTML code
@ -259,13 +258,13 @@ class ReplicationGui
global $dbi;
$replicationInfo = new ReplicationInfo($dbi);
$replicationInfo->load($_POST['master_connection'] ?? null);
$replicationInfo->load($_POST['primary_connection'] ?? null);
$replicationVariables = $replicationInfo->primaryVariables;
$variablesAlerts = null;
$variablesOks = null;
$serverReplication = $replicationInfo->getPrimaryStatus();
if ($type === 'slave') {
if ($type === 'replica') {
$replicationVariables = $replicationInfo->replicaVariables;
$variablesAlerts = [
'Slave_IO_Running' => 'No',
@ -354,11 +353,11 @@ class ReplicationGui
}
/**
* returns html code to add a replication slave user to the master
* returns html code to add a replication replica user to the primary
*
* @return string HTML code
*/
public function getHtmlForReplicationMasterAddSlaveUser(): string
public function getHtmlForReplicationPrimaryAddReplicaUser(): string
{
global $dbi;
@ -407,7 +406,7 @@ class ReplicationGui
}
}
return $this->template->render('server/replication/master_add_slave_user', [
return $this->template->render('server/replication/primary_add_replica_user', [
'username_length' => $usernameLength,
'hostname_length' => $hostnameLength,
'has_username' => isset($_POST['username']),
@ -433,19 +432,19 @@ class ReplicationGui
$messageSuccess = '';
$messageError = '';
if (isset($_POST['slave_changemaster']) && ! $GLOBALS['cfg']['AllowArbitraryServer']) {
if (isset($_POST['replica_changeprimary']) && ! $GLOBALS['cfg']['AllowArbitraryServer']) {
$_SESSION['replication']['sr_action_status'] = 'error';
$_SESSION['replication']['sr_action_info'] = __(
'Connection to server is disabled, please enable'
. ' $cfg[\'AllowArbitraryServer\'] in phpMyAdmin configuration.'
);
} elseif (isset($_POST['slave_changemaster'])) {
$result = $this->handleRequestForSlaveChangeMaster();
} elseif (isset($_POST['sr_slave_server_control'])) {
$result = $this->handleRequestForSlaveServerControl();
} elseif (isset($_POST['replica_changeprimary'])) {
$result = $this->handleRequestForReplicaChangePrimary();
} elseif (isset($_POST['sr_replica_server_control'])) {
$result = $this->handleRequestForReplicaServerControl();
$refresh = true;
switch ($_POST['sr_slave_action']) {
switch ($_POST['sr_replica_action']) {
case 'start':
$messageSuccess = __('Replication started successfully.');
$messageError = __('Error starting replication.');
@ -463,8 +462,8 @@ class ReplicationGui
$messageError = __('Error.');
break;
}
} elseif (isset($_POST['sr_slave_skip_error'])) {
$result = $this->handleRequestForSlaveSkipError();
} elseif (isset($_POST['sr_replica_skip_error'])) {
$result = $this->handleRequestForReplicaSkipError();
}
if ($refresh) {
@ -488,10 +487,7 @@ class ReplicationGui
unset($refresh);
}
/**
* handle control requests for Slave Change Master
*/
public function handleRequestForSlaveChangeMaster(): bool
public function handleRequestForReplicaChangePrimary(): bool
{
global $dbi;
@ -510,34 +506,34 @@ class ReplicationGui
$_SESSION['replication']['sr_action_status'] = 'error';
$_SESSION['replication']['sr_action_info'] = __('Unknown error');
// Attempt to connect to the new master server
$linkToMaster = $this->replication->connectToMaster(
// Attempt to connect to the new primary server
$linkToPrimary = $this->replication->connectToPrimary(
$sr['username'],
$sr['pma_pw'],
$sr['hostname'],
$sr['port']
);
if (! $linkToMaster) {
if (! $linkToPrimary) {
$_SESSION['replication']['sr_action_status'] = 'error';
$_SESSION['replication']['sr_action_info'] = sprintf(
__('Unable to connect to master %s.'),
__('Unable to connect to primary %s.'),
htmlspecialchars($sr['hostname'])
);
} else {
// Read the current master position
$position = $this->replication->slaveBinLogMaster(DatabaseInterface::CONNECT_AUXILIARY);
// Read the current primary position
$position = $this->replication->replicaBinLogPrimary(DatabaseInterface::CONNECT_AUXILIARY);
if (empty($position)) {
$_SESSION['replication']['sr_action_status'] = 'error';
$_SESSION['replication']['sr_action_info'] = __(
'Unable to read master log position. Possible privilege problem on master.'
'Unable to read primary log position. Possible privilege problem on primary.'
);
} else {
$_SESSION['replication']['m_correct'] = true;
if (
! $this->replication->slaveChangeMaster(
! $this->replication->replicaChangePrimary(
$sr['username'],
$sr['pma_pw'],
$sr['hostname'],
@ -549,11 +545,11 @@ class ReplicationGui
)
) {
$_SESSION['replication']['sr_action_status'] = 'error';
$_SESSION['replication']['sr_action_info'] = __('Unable to change master!');
$_SESSION['replication']['sr_action_info'] = __('Unable to change primary!');
} else {
$_SESSION['replication']['sr_action_status'] = 'success';
$_SESSION['replication']['sr_action_info'] = sprintf(
__('Master server changed successfully to %s.'),
__('Primary server changed successfully to %s.'),
htmlspecialchars($sr['hostname'])
);
}
@ -563,27 +559,24 @@ class ReplicationGui
return $_SESSION['replication']['sr_action_status'] === 'success';
}
/**
* handle control requests for Slave Server Control
*/
public function handleRequestForSlaveServerControl(): bool
public function handleRequestForReplicaServerControl(): bool
{
global $dbi;
/** @var string|null $control */
$control = $_POST['sr_slave_control_parm'] ?? null;
$control = $_POST['sr_replica_control_param'] ?? null;
if ($_POST['sr_slave_action'] === 'reset') {
$qStop = $this->replication->slaveControl('STOP', null, DatabaseInterface::CONNECT_USER);
if ($_POST['sr_replica_action'] === 'reset') {
$qStop = $this->replication->replicaControl('STOP', null, DatabaseInterface::CONNECT_USER);
$qReset = $dbi->tryQuery('RESET SLAVE;');
$qStart = $this->replication->slaveControl('START', null, DatabaseInterface::CONNECT_USER);
$qStart = $this->replication->replicaControl('START', null, DatabaseInterface::CONNECT_USER);
$result = $qStop !== false && $qStop !== -1 &&
$qReset !== false && $qReset !== -1 &&
$qStart !== false && $qStart !== -1;
} else {
$qControl = $this->replication->slaveControl(
$_POST['sr_slave_action'],
$qControl = $this->replication->replicaControl(
$_POST['sr_replica_action'],
$control,
DatabaseInterface::CONNECT_USER
);
@ -594,10 +587,7 @@ class ReplicationGui
return $result;
}
/**
* handle control requests for Slave Skip Error
*/
public function handleRequestForSlaveSkipError(): bool
public function handleRequestForReplicaSkipError(): bool
{
global $dbi;
@ -606,9 +596,9 @@ class ReplicationGui
$count = $_POST['sr_skip_errors_count'] * 1;
}
$qStop = $this->replication->slaveControl('STOP', null, DatabaseInterface::CONNECT_USER);
$qStop = $this->replication->replicaControl('STOP', null, DatabaseInterface::CONNECT_USER);
$qSkip = $dbi->tryQuery('SET GLOBAL SQL_SLAVE_SKIP_COUNTER = ' . $count . ';');
$qStart = $this->replication->slaveControl('START', null, DatabaseInterface::CONNECT_USER);
$qStart = $this->replication->replicaControl('START', null, DatabaseInterface::CONNECT_USER);
return $qStop !== false && $qStop !== -1 &&
$qSkip !== false && $qSkip !== -1 &&

View File

@ -89,7 +89,7 @@ final class ReplicationInfo
if ($this->multiPrimaryStatus) {
$this->setDefaultPrimaryConnection($connection);
$urlParams['master_connection'] = $connection;
$urlParams['primary_connection'] = $connection;
}
}

View File

@ -427,12 +427,12 @@ class Privileges
[
'Repl_slave_priv',
'REPLICATION SLAVE',
__('Needed for the replication slaves.'),
__('Needed for the replication replicas.'),
],
[
'Repl_client_priv',
'REPLICATION CLIENT',
__('Allows the user to ask where the slaves / masters are.'),
__('Allows the user to ask where the replicas / primaries are.'),
],
[
'Create_view_priv',

View File

@ -190,22 +190,22 @@ class Data
];
if ($primaryInfo['status']) {
$links['repl'][__('Show slave hosts')] = [
$links['repl'][__('Show replica hosts')] = [
'url' => Url::getFromRoute('/sql'),
'params' => Url::getCommon([
'sql_query' => 'SHOW SLAVE HOSTS',
'goto' => $this->selfUrl,
], ''),
];
$links['repl'][__('Show master status')] = [
'url' => '#replication_master',
$links['repl'][__('Show primary status')] = [
'url' => '#replication_primary',
'params' => '',
];
}
if ($replicaInfo['status']) {
$links['repl'][__('Show slave status')] = [
'url' => '#replication_slave',
$links['repl'][__('Show replica status')] = [
'url' => '#replication_replica',
'params' => '',
];
}
@ -355,7 +355,7 @@ class Data
global $dbi;
$this->replicationInfo = new ReplicationInfo($dbi);
$this->replicationInfo->load($_POST['master_connection'] ?? null);
$this->replicationInfo->load($_POST['primary_connection'] ?? null);
$this->selfUrl = basename($GLOBALS['PMA_PHP_SELF']);

View File

@ -7626,7 +7626,7 @@ parameters:
path: libraries/classes/RecentFavoriteTable.php
-
message: "#^Method PhpMyAdmin\\\\Replication\\:\\:slaveChangeMaster\\(\\) has parameter \\$pos with no value type specified in iterable type array\\.$#"
message: "#^Method PhpMyAdmin\\\\Replication\\:\\:replicaChangePrimary\\(\\) has parameter \\$pos with no value type specified in iterable type array\\.$#"
count: 1
path: libraries/classes/Replication.php
@ -7636,7 +7636,7 @@ parameters:
path: libraries/classes/Replication.php
-
message: "#^Method PhpMyAdmin\\\\ReplicationGui\\:\\:getHtmlForSlaveConfiguration\\(\\) has parameter \\$serverSlaveReplication with no value type specified in iterable type array\\.$#"
message: "#^Method PhpMyAdmin\\\\ReplicationGui\\:\\:getHtmlForReplicaConfiguration\\(\\) has parameter \\$serverReplicaReplication with no value type specified in iterable type array\\.$#"
count: 1
path: libraries/classes/ReplicationGui.php

View File

@ -1757,7 +1757,7 @@
<code>$formattedSize</code>
</InvalidScalarArgument>
<MixedArgument occurrences="37">
<code>$_POST['master_connection'] ?? null</code>
<code>$_POST['primary_connection'] ?? null</code>
<code>$checkTime</code>
<code>$checkTimeAll</code>
<code>$createTime</code>
@ -2491,7 +2491,7 @@
</file>
<file src="libraries/classes/Controllers/Server/DatabasesController.php">
<MixedArgument occurrences="12">
<code>$_POST['master_connection'] ?? null</code>
<code>$_POST['primary_connection'] ?? null</code>
<code>$database['DEFAULT_COLLATION_NAME']</code>
<code>$database['SCHEMA_NAME']</code>
<code>$dblist-&gt;databases</code>
@ -2630,7 +2630,7 @@
</file>
<file src="libraries/classes/Controllers/Server/ReplicationController.php">
<MixedArgument occurrences="2">
<code>$_POST['master_connection'] ?? null</code>
<code>$_POST['primary_connection'] ?? null</code>
<code>$replicaInfo['status']</code>
</MixedArgument>
</file>
@ -12547,9 +12547,9 @@
<MixedArgument occurrences="16">
<code>$_POST['hostname']</code>
<code>$_POST['hostname']</code>
<code>$_POST['master_connection'] ?? null</code>
<code>$_POST['pma_pw']</code>
<code>$_POST['sr_slave_action']</code>
<code>$_POST['primary_connection'] ?? null</code>
<code>$_POST['sr_replica_action']</code>
<code>$_POST['text_port']</code>
<code>$_POST['username']</code>
<code>$_POST['username']</code>
@ -12572,9 +12572,9 @@
<code>$urlParams</code>
</MixedArgumentTypeCoercion>
<MixedArrayAccess occurrences="3">
<code>$serverReplicaReplication[0]['Slave_IO_Running']</code>
<code>$serverReplicaReplication[0]['Slave_SQL_Running']</code>
<code>$serverReplication[0][$variable]</code>
<code>$serverSlaveReplication[0]['Slave_IO_Running']</code>
<code>$serverSlaveReplication[0]['Slave_SQL_Running']</code>
</MixedArrayAccess>
<MixedArrayAssignment occurrences="18">
<code>$_SESSION['replication']['m_correct']</code>
@ -12601,7 +12601,7 @@
<code>$currentUser</code>
<code>$database</code>
<code>$errorMessage</code>
<code>$linkToMaster</code>
<code>$linkToPrimary</code>
<code>$qControl</code>
<code>$qReset</code>
<code>$qSkip</code>
@ -12630,7 +12630,7 @@
<code>$status[0][$key]</code>
</MixedArgument>
<MixedArrayAssignment occurrences="1">
<code>$urlParams['master_connection']</code>
<code>$urlParams['primary_connection']</code>
</MixedArrayAssignment>
</file>
<file src="libraries/classes/ResponseRenderer.php">
@ -13208,7 +13208,7 @@
</file>
<file src="libraries/classes/Server/Status/Data.php">
<MixedArgument occurrences="3">
<code>$_POST['master_connection'] ?? null</code>
<code>$_POST['primary_connection'] ?? null</code>
<code>$server_status_result</code>
<code>$server_status_result</code>
</MixedArgument>

View File

@ -7,7 +7,7 @@
{%- endset %}
{{ num_tables_trans|format(format_number(num_tables, 0)) }}
</th>
{% if server_slave_status %}
{% if server_replica_status %}
<th>{% trans 'Replication' %}</th>
{% endif %}
{% set sum_colspan = db_is_system_schema ? 4 : 7 %}

View File

@ -12,7 +12,7 @@
</a>
{{ tracking_icon|raw }}
</th>
{% if server_slave_status %}
{% if server_replica_status %}
<td class="text-center">
{{ ignored ? get_image('s_cancel', 'Not replicated'|trans) }}
{{ do ? get_image('s_success', 'Replicated'|trans) }}

View File

@ -152,12 +152,12 @@
{% endfor %}
{% endif %}
{% if has_master_replication %}
<th>{% trans 'Master replication' %}</th>
{% if has_primary_replication %}
<th>{% trans 'Primary replication' %}</th>
{% endif %}
{% if has_slave_replication %}
<th>{% trans 'Slave replication' %}</th>
{% if has_replica_replication %}
<th>{% trans 'Replica replication' %}</th>
{% endif %}
<th>{% trans 'Action' %}</th>
@ -209,8 +209,8 @@
{% endfor %}
{% endif %}
{% if database.replication.master.status %}
{% if database.replication.master.is_replicated %}
{% if database.replication.primary.status %}
{% if database.replication.primary.is_replicated %}
<td class="tool text-center">
{{ get_icon('s_success', 'Replicated'|trans) }}
</td>
@ -221,8 +221,8 @@
{% endif %}
{% endif %}
{% if database.replication.slave.status %}
{% if database.replication.slave.is_replicated %}
{% if database.replication.replica.status %}
{% if database.replication.replica.is_replicated %}
<td class="tool text-center">
{{ get_icon('s_success', 'Replicated'|trans) }}
</td>
@ -276,11 +276,11 @@
{% endfor %}
{% endif %}
{% if has_master_replication %}
{% if has_primary_replication %}
<th></th>
{% endif %}
{% if has_slave_replication %}
{% if has_replica_replication %}
<th></th>
{% endif %}

View File

@ -678,10 +678,10 @@
<div class="item">
{% set grant_count = grant_count + 1 %}
<input type="checkbox" class="checkall" name="Repl_client_priv" id="checkbox_Repl_client_priv" value="Y" title="
{%- trans 'Allows the user to ask where the slaves / masters are.' %}"{{ row['Repl_client_priv'] == 'Y' ? ' checked' }}>
{%- trans 'Allows the user to ask where the replicas / primaries are.' %}"{{ row['Repl_client_priv'] == 'Y' ? ' checked' }}>
<label for="checkbox_Repl_client_priv">
<code>
<dfn title="{% trans 'Allows the user to ask where the slaves / masters are.' %}">
<dfn title="{% trans 'Allows the user to ask where the replicas / primaries are.' %}">
REPLICATION CLIENT
</dfn>
</code>
@ -691,10 +691,10 @@
<div class="item">
{% set grant_count = grant_count + 1 %}
<input type="checkbox" class="checkall" name="Repl_slave_priv" id="checkbox_Repl_slave_priv" value="Y" title="
{%- trans 'Needed for the replication slaves.' %}"{{ row['Repl_slave_priv'] == 'Y' ? ' checked' }}>
{%- trans 'Needed for the replication replicas.' %}"{{ row['Repl_slave_priv'] == 'Y' ? ' checked' }}>
<label for="checkbox_Repl_slave_priv">
<code>
<dfn title="{% trans 'Needed for the replication slaves.' %}">
<dfn title="{% trans 'Needed for the replication replicas.' %}">
REPLICATION SLAVE
</dfn>
</code>

View File

@ -2,8 +2,8 @@
{{ get_hidden_inputs('', '') }}
<fieldset class="pma-fieldset" id="fieldset_add_user_login">
<legend>
{% trans 'Slave configuration' %} -
{% trans 'Change or reconfigure master server' %}
{% trans 'Replica configuration' %} -
{% trans 'Change or reconfigure primary server' %}
</legend>
<p>
{% trans 'Make sure you have a unique server-id in your configuration file (my.cnf). If not, please add the following line into [mysqld] section:' %}
@ -30,6 +30,6 @@
<fieldset id="fieldset_user_privtable_footer" class="pma-fieldset tblFooters">
<input type="hidden" name="sr_take_action" value="true">
<input type="hidden" name="{{ submit_name }}" value="1">
<input class="btn btn-primary" type="submit" id="confslave_submit" value="{% trans 'Go' %}">
<input class="btn btn-primary" type="submit" id="confreplica_submit" value="{% trans 'Go' %}">
</fieldset>
</form>

View File

@ -11,29 +11,29 @@
<div id="replication" class="container-fluid">
{{ error_messages|raw }}
{% if is_master %}
{{ master_replication_html|raw }}
{% elseif master_configure is null and clear_screen is null %}
{% if is_primary %}
{{ primary_replication_html|raw }}
{% elseif primary_configure is null and clear_screen is null %}
<div class="card mb-2">
<div class="card-header">{% trans 'Master replication' %}</div>
<div class="card-header">{% trans 'Primary replication' %}</div>
<div class="card-body">
{% apply format('<a href="' ~ url('/server/replication') ~ '" data-post="' ~ get_common(url_params|merge({'mr_configure': true}), '') ~ '">', '</a>')|raw %}
{% apply format('<a href="' ~ url('/server/replication') ~ '" data-post="' ~ get_common(url_params|merge({'primary_configure': true}), '') ~ '">', '</a>')|raw %}
{% trans %}
This server is not configured as master in a replication process. Would you like to %sconfigure%s it?
This server is not configured as primary in a replication process. Would you like to %sconfigure%s it?
{% endtrans %}
{% endapply %}
</div>
</div>
{% endif %}
{% if master_configure is not null %}
{{ master_configuration_html|raw }}
{% if primary_configure is not null %}
{{ primary_configuration_html|raw }}
{% else %}
{% if clear_screen is null %}
{{ slave_configuration_html|raw }}
{{ replica_configuration_html|raw }}
{% endif %}
{% if slave_configure is not null %}
{{ change_master_html|raw }}
{% if replica_configure is not null %}
{{ change_primary_html|raw }}
{% endif %}
{% endif %}
</div>

View File

@ -1,54 +0,0 @@
{% if not clear_screen %}
<div class="card mb-2">
<div class="card-header">{% trans 'Master replication' %}</div>
<div class="card-body">
{% trans 'This server is configured as master in a replication process.' %}
<ul>
<li>
<a href="#master_status_href" id="master_status_href">
{% trans 'Show master status' %}
</a>
{{ master_status_table|raw }}
</li>
<li>
<p>
<a href="#master_slaves_href" id="master_slaves_href">
{% trans 'Show connected slaves' %}
</a>
</p>
<div id="replication_slaves_section" style="display: none;">
<table class="table w-auto">
<thead>
<tr>
<th>{% trans 'Server ID' %}</th>
<th>{% trans 'Host' %}</th>
</tr>
</thead>
<tbody>
{% for slave in slaves %}
<tr>
<td class="text-end font-monospace">{{ slave['Server_id'] }}</td>
<td class="text-end font-monospace">{{ slave['Host'] }}</td>
</tr>
{% endfor %}
</tbody>
</table>
<br>
{{ 'Only slaves started with the --report-host=host_name option are visible in this list.'|trans|notice }}
<br>
</div>
</li>
<li>
<a href="{{ url('/server/replication') }}" data-post="{{ get_common(url_params, '') }}" id="master_addslaveuser_href">
{% trans 'Add slave replication user' %}
</a>
</li>
{% endif %}
{% if master_add_user %}
{{ master_add_slave_user|raw }}
{% elseif not clear_screen %}
</ul>
</div>
</div>
{% endif %}

View File

@ -1,13 +1,13 @@
<div id="master_addslaveuser_gui">
<div id="primary_addreplicauser_gui">
<form action="{{ url('/server/privileges') }}" method="post" autocomplete="off" id="addUsersForm">
{{ get_hidden_inputs('', '') }}
<fieldset class="pma-fieldset" id="fieldset_add_user_login">
<legend>{% trans 'Add slave replication user' %}</legend>
<legend>{% trans 'Add replica replication user' %}</legend>
<input type="hidden" name="grant_count" value="25">
<input type="hidden" name="createdb" id="createdb_0" value="0">
{# Needed for the replication slaves. #}
{# Needed for the replication replicas. #}
<input type="hidden" name="Repl_slave_priv" id="checkbox_Repl_slave_priv" value="Y">
<input type="hidden" name="sr_take_action" value="true">

View File

@ -1,8 +1,8 @@
<fieldset class="pma-fieldset">
<legend>{% trans 'Master configuration' %}</legend>
<legend>{% trans 'Primary configuration' %}</legend>
<p>
{% trans %}
This server is not configured as a master server in a replication process. You can choose from either replicating all databases and ignoring some of them (useful if you want to replicate a majority of the databases) or you can choose to ignore all databases by default and allow only certain databases to be replicated. Please select the mode:
This server is not configured as a primary server in a replication process. You can choose from either replicating all databases and ignoring some of them (useful if you want to replicate a majority of the databases) or you can choose to ignore all databases by default and allow only certain databases to be replicated. Please select the mode:
{% endtrans %}
</p>
<select name="db_type" id="db_type">
@ -19,7 +19,7 @@
<pre id="rep"></pre>
<p>
{% trans %}
Once you restarted MySQL server, please click on Go button. Afterwards, you should see a message informing you, that this server <strong>is</strong> configured as master.
Once you restarted MySQL server, please click on Go button. Afterwards, you should see a message informing you, that this server <strong>is</strong> configured as primary.
{% endtrans %}
</p>
</fieldset>

View File

@ -0,0 +1,54 @@
{% if not clear_screen %}
<div class="card mb-2">
<div class="card-header">{% trans 'Primary replication' %}</div>
<div class="card-body">
{% trans 'This server is configured as primary in a replication process.' %}
<ul>
<li>
<a href="#primary_status_href" id="primary_status_href">
{% trans 'Show primary status' %}
</a>
{{ primary_status_table|raw }}
</li>
<li>
<p>
<a href="#primary_replicas_href" id="primary_replicas_href">
{% trans 'Show connected replicas' %}
</a>
</p>
<div id="replication_replicas_section" style="display: none;">
<table class="table w-auto">
<thead>
<tr>
<th>{% trans 'Server ID' %}</th>
<th>{% trans 'Host' %}</th>
</tr>
</thead>
<tbody>
{% for replica in replicas %}
<tr>
<td class="text-end font-monospace">{{ replica['Server_id'] }}</td>
<td class="text-end font-monospace">{{ replica['Host'] }}</td>
</tr>
{% endfor %}
</tbody>
</table>
<br>
{{ 'Only replicas started with the --report-host=host_name option are visible in this list.'|trans|notice }}
<br>
</div>
</li>
<li>
<a href="{{ url('/server/replication') }}" data-post="{{ get_common(url_params, '') }}" id="primary_addreplicauser_href">
{% trans 'Add replica replication user' %}
</a>
</li>
{% endif %}
{% if primary_add_user %}
{{ primary_add_replica_user|raw }}
{% elseif not clear_screen %}
</ul>
</div>
</div>
{% endif %}

View File

@ -1,14 +1,14 @@
<div class="card">
<div class="card-header">{% trans 'Slave replication' %}</div>
<div class="card-header">{% trans 'Replica replication' %}</div>
<div class="card-body">
{% if server_slave_multi_replication %}
{% trans 'Master connection:' %}
{% if server_replica_multi_replication %}
{% trans 'Primary connection:' %}
<form method="get" action="{{ url('/server/replication') }}">
{{ get_hidden_inputs(url_params) }}
<select name="master_connection">
<select name="primary_connection">
<option value="">{% trans 'Default' %}</option>
{% for server in server_slave_multi_replication %}
<option value="{{ server['Connection_name'] }}"{{ master_connection == server['Connection_name'] ? ' selected' }}>
{% for server in server_replica_multi_replication %}
<option value="{{ server['Connection_name'] }}"{{ primary_connection == server['Connection_name'] ? ' selected' }}>
{{ server['Connection_name'] }}
</option>
{% endfor %}
@ -19,38 +19,38 @@
<br>
{% endif %}
{% if server_slave_status %}
<div id="slave_configuration_gui">
{% if not slave_sql_running %}
{{ 'Slave SQL Thread not running!'|trans|error }}
{% if server_replica_status %}
<div id="replica_configuration_gui">
{% if not replica_sql_running %}
{{ 'Replica SQL Thread not running!'|trans|error }}
{% endif %}
{% if not slave_io_running %}
{{ 'Slave IO Thread not running!'|trans|error }}
{% if not replica_io_running %}
{{ 'Replica IO Thread not running!'|trans|error }}
{% endif %}
<p>{% trans 'Server is configured as slave in a replication process. Would you like to:' %}</p>
<p>{% trans 'Server is configured as replica in a replication process. Would you like to:' %}</p>
<ul>
<li>
<a href="#slave_status_href" id="slave_status_href">{% trans 'See slave status table' %}</a>
{{ slave_status_table|raw }}
<a href="#replica_status_href" id="replica_status_href">{% trans 'See replica status table' %}</a>
{{ replica_status_table|raw }}
</li>
<li>
<a href="#slave_control_href" id="slave_control_href">{% trans 'Control slave:' %}</a>
<div id="slave_control_gui" class="hide">
<a href="#replica_control_href" id="replica_control_href">{% trans 'Control replica:' %}</a>
<div id="replica_control_gui" class="hide">
<ul>
<li>
<a href="{{ url('/server/replication') }}" data-post="{{ slave_control_full_link|raw }}">
{{ not slave_io_running or not slave_sql_running ? 'Full start' : 'Full stop' }}
<a href="{{ url('/server/replication') }}" data-post="{{ replica_control_full_link|raw }}">
{{ not replica_io_running or not replica_sql_running ? 'Full start' : 'Full stop' }}
</a>
</li>
<li>
<a class="ajax" id="reset_slave" href="{{ url('/server/replication') }}" data-post="{{ slave_control_reset_link|raw }}">
{% trans 'Reset slave' %}
<a class="ajax" id="reset_replica" href="{{ url('/server/replication') }}" data-post="{{ replica_control_reset_link|raw }}">
{% trans 'Reset replica' %}
</a>
</li>
<li>
<a href="{{ url('/server/replication') }}" data-post="{{ slave_control_sql_link|raw }}">
{% if not slave_sql_running %}
<a href="{{ url('/server/replication') }}" data-post="{{ replica_control_sql_link|raw }}">
{% if not replica_sql_running %}
{% trans 'Start SQL Thread only' %}
{% else %}
{% trans 'Stop SQL Thread only' %}
@ -58,8 +58,8 @@
</a>
</li>
<li>
<a href="{{ url('/server/replication') }}" data-post="{{ slave_control_io_link|raw }}">
{% if not slave_io_running %}
<a href="{{ url('/server/replication') }}" data-post="{{ replica_control_io_link|raw }}">
{% if not replica_io_running %}
{% trans 'Start IO Thread only' %}
{% else %}
{% trans 'Stop IO Thread only' %}
@ -70,14 +70,14 @@
</div>
</li>
<li>
<a href="#slave_errormanagement_href" id="slave_errormanagement_href">
<a href="#replica_errormanagement_href" id="replica_errormanagement_href">
{% trans 'Error management:' %}
</a>
<div id="slave_errormanagement_gui" class="hide">
{{ 'Skipping errors might lead into unsynchronized master and slave!'|trans|error }}
<div id="replica_errormanagement_gui" class="hide">
{{ 'Skipping errors might lead into unsynchronized primary and replica!'|trans|error }}
<ul>
<li>
<a href="{{ url('/server/replication') }}" data-post="{{ slave_skip_error_link|raw }}">
<a href="{{ url('/server/replication') }}" data-post="{{ replica_skip_error_link|raw }}">
{% trans 'Skip current error' %}
</a>
</li>
@ -85,7 +85,7 @@
<form method="post" action="{{ url('/server/replication') }}">
{{ get_hidden_inputs('', '') }}
{{ 'Skip next %s errors.'|trans|format('<input type="text" name="sr_skip_errors_count" value="1" class="repl_gui_skip_err_cnt">')|raw }}
<input class="btn btn-primary" type="submit" name="sr_slave_skip_error" value="{% trans 'Go' %}">
<input class="btn btn-primary" type="submit" name="sr_replica_skip_error" value="{% trans 'Go' %}">
<input type="hidden" name="sr_take_action" value="1">
</form>
</li>
@ -93,18 +93,18 @@
</div>
</li>
<li>
<a href="{{ url('/server/replication') }}" data-post="{{ reconfigure_master_link|raw }}">
{% trans 'Change or reconfigure master server' %}
<a href="{{ url('/server/replication') }}" data-post="{{ reconfigure_primary_link|raw }}">
{% trans 'Change or reconfigure primary server' %}
</a>
</li>
</ul>
</div>
{% elseif not has_slave_configure %}
{% elseif not has_replica_configure %}
{% apply format('<a href="' ~ url('/server/replication') ~ '" data-post="' ~ get_common(url_params|merge({
'sl_configure': true,
'replica_configure': true,
'repl_clear_scr': true
})) ~ '">', '</a>')|raw %}
{% trans 'This server is not configured as slave in a replication process. Would you like to %sconfigure%s it?' %}
{% trans 'This server is not configured as replica in a replication process. Would you like to %sconfigure%s it?' %}
{% endapply %}
{% endif %}
</div>

View File

@ -2,10 +2,10 @@
{% if has_title %}
<h4>
<a id="replication_{{ type }}"></a>
{% if type == 'master' %}
{% trans 'Master status' %}
{% if type == 'primary' %}
{% trans 'Primary status' %}
{% else %}
{% trans 'Slave status' %}
{% trans 'Replica status' %}
{% endif %}
</h4>
{% endif %}

View File

@ -53,14 +53,14 @@
</table>
</div>
{% if is_master or is_slave %}
{% if is_primary or is_replica %}
<p class="alert alert-primary clearfloat" role="alert">
{% if is_master and is_slave %}
{% trans 'This MySQL server works as <b>master</b> and <b>slave</b> in <b>replication</b> process.' %}
{% elseif is_master %}
{% trans 'This MySQL server works as <b>master</b> in <b>replication</b> process.' %}
{% elseif is_slave %}
{% trans 'This MySQL server works as <b>slave</b> in <b>replication</b> process.' %}
{% if is_primary and is_replica %}
{% trans 'This MySQL server works as <b>primary</b> and <b>replica</b> in <b>replication</b> process.' %}
{% elseif is_primary %}
{% trans 'This MySQL server works as <b>primary</b> in <b>replication</b> process.' %}
{% elseif is_replica %}
{% trans 'This MySQL server works as <b>replica</b> in <b>replication</b> process.' %}
{% endif %}
</p>

View File

@ -74,9 +74,9 @@ class StatusControllerTest extends AbstractTestCase
//updatetime
$upTimeHtml = 'This MySQL server has been running for 0 days, 10 hours, 0 minutes and 0 seconds';
$this->assertStringContainsString($upTimeHtml, $html);
//master state
$masterHtml = 'This MySQL server works as <b>master</b>';
$this->assertStringContainsString($masterHtml, $html);
//primary state
$primaryHtml = 'This MySQL server works as <b>primary</b>';
$this->assertStringContainsString($primaryHtml, $html);
//validate 2: Status::getHtmlForServerStateTraffic
$trafficHtml = '<table class="table table-light table-striped table-hover col-12 col-md-5 w-auto">';

View File

@ -28,7 +28,7 @@ class ReplicationGuiTest extends AbstractTestCase
{
parent::setUp();
//$_POST
$_POST['mr_adduser'] = 'mr_adduser';
$_POST['primary_add_user'] = 'primary_add_user';
//$GLOBALS
$GLOBALS['cfg']['MaxRows'] = 10;
@ -50,67 +50,62 @@ class ReplicationGuiTest extends AbstractTestCase
}
/**
* Test for getHtmlForMasterReplication
*
* @group medium
*/
public function testGetHtmlForMasterReplication(): void
public function testGetHtmlForPrimaryReplication(): void
{
$html = $this->replicationGui->getHtmlForMasterReplication();
$html = $this->replicationGui->getHtmlForPrimaryReplication();
//validate 1: Master replication
$this->assertStringContainsString('<div class="card-header">Master replication</div>', $html);
$this->assertStringContainsString('This server is configured as master in a replication process.', $html);
//validate 1: Primary replication
$this->assertStringContainsString('<div class="card-header">Primary replication</div>', $html);
$this->assertStringContainsString('This server is configured as primary in a replication process.', $html);
//validate 2: getHtmlForReplicationStatusTable
$this->assertStringContainsString('<div id="replication_master_section"', $html);
$this->assertStringContainsString('<div id="replication_primary_section"', $html);
$this->assertStringContainsString('Binlog_Do_DB', $html);
$this->assertStringContainsString('Binlog_Ignore_DB', $html);
$this->assertStringContainsString('master-bin.000030', $html);
$this->assertStringContainsString('primary-bin.000030', $html);
//validate 3: getHtmlForReplicationSlavesTable
$this->assertStringContainsString('replication_slaves_section', $html);
//validate 3: getHtmlForReplicationReplicasTable
$this->assertStringContainsString('replication_replicas_section', $html);
$this->assertStringContainsString('<th>Server ID</th>', $html);
$this->assertStringContainsString('<th>Host</th>', $html);
//slave host
//replica host
$this->assertStringContainsString('<td class="text-end font-monospace">Server_id1</td>', $html);
$this->assertStringContainsString('<td class="text-end font-monospace">Server_id2</td>', $html);
$this->assertStringContainsString('<td class="text-end font-monospace">Host1</td>', $html);
$this->assertStringContainsString('<td class="text-end font-monospace">Host2</td>', $html);
//Notice
$this->assertStringContainsString('Only slaves started with the', $html);
$this->assertStringContainsString('Only replicas started with the', $html);
//validate 4: navigation URL
$this->assertStringContainsString('<a href="index.php?route=/server/replication', $html);
$this->assertStringContainsString('Add slave replication user', $html);
$this->assertStringContainsString('Add replica replication user', $html);
//validate 5: 'Add replication slave user' form
$this->assertStringContainsString('<div id="master_addslaveuser_gui">', $html);
//validate 5: 'Add replication replica user' form
$this->assertStringContainsString('<div id="primary_addreplicauser_gui">', $html);
}
/**
* Test for getHtmlForSlaveConfiguration
*/
public function testGetHtmlForSlaveConfiguration(): void
public function testGetHtmlForReplicaConfiguration(): void
{
$replicationInfo = new ReplicationInfo($GLOBALS['dbi']);
$replicationInfo->load();
//Call the test function
$html = $this->replicationGui->getHtmlForSlaveConfiguration(
$html = $this->replicationGui->getHtmlForReplicaConfiguration(
true,
$replicationInfo->getReplicaStatus()
);
//legend
$this->assertStringContainsString('<div class="card-header">Slave replication</div>', $html);
$this->assertStringContainsString('<div id="slave_configuration_gui">', $html);
$this->assertStringContainsString('<div class="card-header">Replica replication</div>', $html);
$this->assertStringContainsString('<div id="replica_configuration_gui">', $html);
//notice
$this->assertStringContainsString('Server is configured as slave in a replication process.', $html);
//slave session
$this->assertStringContainsString('<div id="replication_slave_section"', $html);
$this->assertStringContainsString('Server is configured as replica in a replication process.', $html);
//replica session
$this->assertStringContainsString('<div id="replication_replica_section"', $html);
//variable
$this->assertStringContainsString('Master_SSL_CA_Path', $html);
$this->assertStringContainsString('Master_SSL_Cert', $html);
@ -118,17 +113,14 @@ class ReplicationGuiTest extends AbstractTestCase
$this->assertStringContainsString('Seconds_Behind_Master', $html);
}
/**
* Test for getHtmlForReplicationChangeMaster
*/
public function testGetHtmlForReplicationChangeMaster(): void
public function testGetHtmlForReplicationChangePrimary(): void
{
//Call the test function
$html = $this->replicationGui->getHtmlForReplicationChangeMaster('slave_changemaster');
$html = $this->replicationGui->getHtmlForReplicationChangePrimary('replica_changeprimary');
$this->assertStringContainsString('<form method="post" action="index.php?route=/server/replication', $html);
$this->assertStringContainsString('Slave configuration', $html);
$this->assertStringContainsString('Change or reconfigure master server', $html);
$this->assertStringContainsString('Replica configuration', $html);
$this->assertStringContainsString('Change or reconfigure primary server', $html);
$notice = 'Make sure you have a unique server-id in your configuration file (my.cnf)';
$this->assertStringContainsString($notice, $html);
}

View File

@ -1578,7 +1578,7 @@ class DbiDummy implements DbiExtension
'query' => 'SHOW MASTER STATUS',
'result' => [
[
'File' => 'master-bin.000030',
'File' => 'primary-bin.000030',
'Position' => '107',
'Binlog_Do_DB' => 'Binlog_Do_DB',
'Binlog_Ignore_DB' => 'Binlog_Ignore_DB',