本文へジャンプします。

ニフクラ ユーザーガイド

クラウド トップ>API> RDB> SetExternalMaster
本ページは2023/9/5をもって、新ページhttps://docs.nifcloud.com/rdb/api/SetExternalMaster.htmへ移行しました。 今後は新ページをご参照ください。

SetExternalMaster

処理概要

外部レプリケーションの設定を行います。

指定するパラメーター

パラメーター 説明 必須
DBInstanceIdentifier string

DBサーバー名

  • ※ステータスが“available”のDBサーバーのみ指定できます

MasterHost string

マスターとなるDBサーバーのIPアドレスまたはホスト名

  • アルファベット・数字・ハイフン(‘-’)・ドット(‘.’)が使用できます。1-60文字。

MasterPort integer マスターとなるDBサーバーのポート番号
Default: 3306
使用可能文字: 0~65535
ReplicationUserName string

レプリケーションユーザー名

  • アルファベット・数字・アンダースコア(‘_’)が使用できます
  • 最初の文字はアルファベットである必要があります
  • MySQLの予約語は使用できません
  • 1-96文字

ReplicationUserPassword string

レプリケーションユーザーのパスワード

  • 「/」、「@」、「"」、「 」、「’」を除く、印字可能なASCII文字が使用できます
  • 1-32文字。

BinlogFileName string

レプリケーションを開始するバイナリログファイル名

  • 「 」を除く、印字可能なASCII文字が使用できます
  • 1-511文字。

BinlogPosition integer レプリケーションを開始するバイナリログファイル内の位置
使用可能文字: 0~18446744073709551615

応答フィールド

フィールド (項目) 説明
SetExternalMasterResponse structure ルート
SetExternalMasterResult structure 結果
DBInstance structure DBサーバー
備考: DBInstanceの子要素はDescribeDBInstancesで返却される要素をすべて記載しているためAPIによっては返却されない要素もあります。実際のレスポンスはレスポンスサンプルを参照してください。
AllocatedStorage integer 割り当てるディスク容量(GB)
AutoMinorVersionUpgrade boolean マイナーバージョンの自動アップデートを行うかどうか
備考: 固定値falseを返却
AvailabilityZone string DBサーバーのゾーン
BackupRetentionPeriod integer バックアップ保持期間
BinlogRetentionPeriod integer

バイナリログ保持期間(日)

  • BinlogRetentionPeriodを変更した場合のみ要素を返却します。

ExternalReplicationInfo structure

外部レプリケーション情報

  • ※DBサーバーが以下の場合のみこのタグは返却されます
  • MySQLでシングル構成
  • MySQLで冗長構成 (データ優先)

ExternalReplicationMessage string

外部レプリケーション操作結果

  • ※エラー発生時は、実行時に出力されたメッセージ

ExternalReplicationStatus string

外部レプリケーション操作ステータス

  • set(SetExternalMaster実行成功 & StartReplication未実行)
  • started(StartReplication実行成功 & StopReplication未実行)
  • stopped(StopReplication実行成功 & ResetExternalMaster未実行)
  • set-error(SetExternalMaster実行失敗)
  • start-error(StartReplication実行失敗)
  • stop-error(StopReplication実行失敗)
  • reset-error(ResetExternalMaster実行失敗)

ReplicationAddresses list 外部レプリケーション接続元グローバルIPアドレスリスト
ReplicationAddress string

外部レプリケーション接続元グローバルIPアドレス

  • ※シングル構成の場合は外部レプリケーション接続元グローバルIPアドレスを1つ返却します
  • ※冗長構成(データ優先)の場合は外部レプリケーション接続元グローバルIPアドレスを2つ返却します

ReplicationPrivateAddresses list 外部レプリケーション接続元プライベートIPアドレスリスト
ReplicationPrivateAddress string

外部レプリケーション接続元プライベートIPアドレス

  • ※シングル構成の場合は外部レプリケーション接続元プライベートIPアドレスを1つ返却します
  • ※冗長構成(データ優先)の場合は外部レプリケーション接続元プライベートIPアドレスを2つ返却します

ExternalMasterAddress string マスターとなるDBサーバーのIPアドレスまたはホスト名
CACertificateIdentifier string DBサーバーのサーバー証明書と紐付くCA証明書
DBInstanceClass string DBサーバータイプ
DBInstanceIdentifier string DBサーバー名
DBInstanceStatus string DBサーバーのステータス
DBName string DB名
DBParameterGroups list DBパラメーターグループ情報リスト
DBParameterGroup structure DBパラメーターグループ
DBParameterGroupName string DBパラメーターグループ名
ParameterApplyStatus string

DBパラメーターの適用ステータス

  • 値:applying(適用中) | pending-reboot(再起動待ち) | in-sync(適用済み)

DBSecurityGroups list DBファイアウォールグループ情報リスト
DBSecurityGroup structure DBファイアウォールグループ
DBSecurityGroupName string DBファイアウォールグループ名
Status string

DBファイアウォールグループのステータス

  • 値:active(有効) | adding(適用中) | removing(取り外し中) | failed(変更失敗)

Endpoint structure DB接続時のエンドポイント
Port integer ポート番号
Address string

グローバルIPアドレス

  • ※PubliclyAccessibleがオフの場合、このタグは返却されません。

NiftyPrivateAddress string プライベートIPアドレス
Engine string データベースエンジン
EngineVersion string データベースエンジンのバージョン
InstanceCreateTime timestamp DBサーバーの作成日時
LatestRestorableTime timestamp ポイントインタイムリカバリー可能な最新の時刻
LicenseModel string DBサーバーのライセンスモデル
MasterUsername string DBサーバーのマスターユーザー名
MultiAZ boolean 冗長化機能が有効かどうか
NiftyMultiAZType string 冗長構成タイプ
備考: ニフクラ独自仕様
OptionGroupMemberships list オプショングループ情報リスト
OptionGroupMembership structure オプショングループ情報
OptionGroupName string

下記の固定値を返却

  • DBエンジンがMySQL 5.5系の場合、default:mysql-5-5
  • DBエンジンがMySQL 5.6系の場合、default:mysql-5-6
  • DBエンジンがMySQL 5.7系の場合、default:mysql-5-7
  • DBエンジンがPostgreSQL9.3系の場合、default:postgres-9-3
  • DBエンジンがPostgreSQL9.6系の場合、default:postgres-9-6
  • DBエンジンがPostgreSQL11系の場合、default:postgres-11
  • DBエンジンがPostgreSQL13系の場合、default:postgres-13

Status string オプショングループのステータス
備考: 固定値in-syncを返却
PendingModifiedValues structure 保留の修正情報
AllocatedStorage integer 保留中のディスク容量
BackupRetentionPeriod integer 保留中のバックアップ保持期間
DBInstanceClass string 保留中のDBサーバータイプ
DBInstanceIdentifier string 保留中のDBサーバー名
EngineVersion string 保留中のデータベースエンジンのバージョン
MasterUserPassword string 保留中のDBサーバーのマスターユーザー名
MultiAZ boolean 保留中の「冗長化機能が有効かどうか」フラグ
Port integer 保留中のアクセス可能なポート番号
PreferredBackupWindow string バックアップ時間
PreferredMaintenanceWindow string メンテナンス時間
PubliclyAccessible boolean グローバルIPアドレスを有効にするかどうか
ReadReplicaDBInstanceIdentifiers list リードレプリカ名リスト
ReadReplicaDBInstanceIdentifier string リードレプリカ名
ReadReplicaSourceDBInstanceIdentifier string リードレプリカのマスターとして設定されているDBサーバー名
SecondaryAvailabilityZone string

待機系DBサーバーのゾーン

  • ※冗長化機能がオンの場合、固定でAvailabilityZoneと同じ値が返却されます
  • ※冗長化機能がオフの場合、このタグは返却されません

StatusInfos list

リードレプリカのステータス

  • ※DBサーバーがリードレプリカでない場合、空タグが返却されます

DBInstanceStatusInfo structure DBサーバーのステータス情報のリスト
Message string

エラーメッセージ

  • ※エラーが発生していない場合は空タグが返却されます

Normal boolean 正常かどうか
Status string

DBサーバーのステータス

  • 値(StatusTypeが“read replication”の場合): replicating(レプリケーション中) | error(レプリケーションエラー)

StatusType string DBサーバーのステータス種別
備考: 固定値"read replication"を返却
VpcSecurityGroups string ※返却値なし
NiftyStorageType integer ディスクタイプ
備考: ニフクラ独自仕様
NiftyNetworkId string プライベートLANのネットワークユニークID
備考: ニフクラ独自仕様
NiftyMasterPrivateAddress string 主系DBサーバー用のプライベートIPアドレス
備考: ニフクラ独自仕様
NiftySlavePrivateAddress string 待機系DBサーバー用のプライベートIPアドレス
備考: ニフクラ独自仕様
AccountingType string 当月の利用料金タイプ
NextMonthAccountingType string 翌月の利用料金タイプ
ResponseMetadata structure 共通メタ情報
RequestId string リクエスト識別子

エラー

コード メッセージ タイプ HTTPステータスコード 説明
Client.InvalidParameterCannotSpecify.BinlogFileName

The parameter BinlogFileName is not a valid. Only printable ASCII characters besides ’ ’ may be used.

Sender 400 BinlogFileNameに無効な値を指定した場合
Client.InvalidParameterCannotSpecify.MasterHost

The parameter MasterHost is not a valid. Only alphabet, digits, ‘-’, ‘.’, may be used.

Sender 400 MasterHostに無効な値を指定した場合
Client.InvalidParameterCannotSpecify.ReplicationUserName

ReplicationUserName INTO cannot be used as it is a reserved word used by the engine

Sender 400 ReplicationUserNameに予約語を指定した場合
Client.InvalidParameterCannotSpecify.ReplicationUserPassword

The parameter ReplicationUserPassword is not a valid password. Only printable ASCII characters besides ‘/’, ‘@’, ‘"’, ’ ‘,’’’ may be used.

Sender 400 ReplicationUserPasswordに無効な値を指定した場合
Client.InvalidParameterFormat.DBInstanceIdentifier

The parameter DBInstanceIdentifier is not a valid identifier. Identifiers must begin with a letter; must contain only lowercase ASCII letters, digits, and hyphens; and must not end with a hyphen or contain two consecutive hyphens.

Sender 400 DBInstanceIdentifierに無効な値(ハイフンから始まる 等)を指定した場合
Client.InvalidParameterFormat.ReplicationUserName

The parameter ReplicationUserName is not a valid. ReplicationUserName must begin with a alphabet; Only alphabet, digits, ’_’ may be used.

Sender 400 ReplicationUserNameに無効な値を指定した場合
Client.InvalidParameterIllegalInput.BinlogPosition
Sender 400 BinlogPositionに数値でない値を指定した場合
Client.InvalidParameterIllegalInput.MasterPort
Sender 400 MasterPortに数値でない値を指定した場合
Client.InvalidParameterNotFound.DBInstance

DBInstance aaa not found.

Sender 404 存在しないDBInstanceIdentifierを指定した場合
Client.InvalidParameterOutOfRange.BinlogPosition

Invalid BinlogPosition: -1. The BinlogPosition must be between 0 and 18446744073709551615.

Sender 400 BinlogPositionに0~18446744073709551615ではない値を指定した場合
Client.InvalidParameterOutOfRange.MasterPort

Invalid MasterPort: 100000. Valid range is 0-65535.

Sender 400 MasterPortに0~65535ではない値を指定した場合
Client.InvalidParameterRequired.BinlogFileName

The parameter BinlogFileName must be provided and must not be blank.

Sender 400 必須のBinlogFileNameを指定しなかった場合
Client.InvalidParameterRequired.BinlogPosition

The parameter BinlogPosition must be provided and must not be blank.

Sender 400 必須のBinlogPositionを指定しなかった場合
Client.InvalidParameterRequired.DBInstanceIdentifier

The parameter DBInstanceIdentifier must be provided and must not be blank.

Sender 400 必須のDBInstanceIdentifierを指定しなかった場合
Client.InvalidParameterRequired.MasterHost

The parameter MasterHost must be provided and must not be blank.

Sender 400 必須のMasterHostを指定しなかった場合
Client.InvalidParameterRequired.ReplicationUserName

The parameter ReplicationUserName must be provided and must not be blank.

Sender 400 必須のReplicationUserNameを指定しなかった場合
Client.InvalidParameterRequired.ReplicationUserPassword

The parameter ReplicationUserPassword must be provided and must not be blank.

Sender 400 必須のReplicationUserPasswordを指定しなかった場合
Client.InvalidParameterTooLong.BinlogFileName

The parameter BinlogFileName is not a valid BinlogFileName because it is longer than 511 characters.

Sender 400 BinlogFileNameに511文字を超える値を指定した場合
Client.InvalidParameterTooLong.DBInstanceIdentifier

The parameter DBInstanceIdentifier is not a valid identifier because it is longer than 63 characters.

Sender 400 DBInstanceIdentifierに63文字を超える値を指定した場合
Client.InvalidParameterTooLong.MasterHost

The parameter MasterHost is not a valid MasterHost because it is longer than 60 characters.

Sender 400 MasterHostに60文字を超える値を指定した場合
Client.InvalidParameterTooLong.ReplicationUserName

The parameter ReplicationUserName is not a valid ReplicationUserName because it is longer than 96 characters.

Sender 400 ReplicationUserNameに96文字を超える値を指定した場合
Client.InvalidParameterTooLong.ReplicationUserPassword

The parameter ReplicationUserPassword is not a valid ReplicationUserPassword because it is longer than 32 characters.

Sender 400 ReplicationUserPasswordに32文字を超える値を指定した場合
Client.ResourceInapplicable.DBInstanceOtherThanMySQL

Can only set replication DB Instance with Engine: mysql.

Sender 400 DBエンジンがmysqlでない場合
Client.ResourceInapplicable.ReadReplica

Can not be specified when DB Instance is a readreplica.

Sender 400 指定したDBサーバーがリードレプリカの場合
Client.ResourceIncorrectState.DBInstance.Unavailable

The specified DB Instance is not in the available state.

Sender 400 DBサーバーのステータスが有効でない場合
Client.ResourceIncorrectState.ExternalReplication.Started

Can not be specified when external replication in progress on DB Instance.

Sender 400 外部レプリケーション中のDBサーバーを指定した場合

リクエストサンプル

    https://jp-east-1.rdb.api.nifcloud.com/
  ?Action=SetExternalMaster
  &DBInstanceIdentifier=mydbinstance
  &MasterHost=0.0.0.0
  &MasterPort=3306
  &ReplicationUserName=repl
  &ReplicationUserPassword=repl
  &BinlogFileName=mysql-bin.00001
  &BinlogFilePosition=1
  &SignatureVersion=2
  &SignatureMethod=HmacSHA256
  &Timestamp=2013-12-09T00:00:00.000Z
  &AWSAccessKeyId=<NIFCLOUD Access Key ID>
  &Signature=<Signature>

  

応答サンプル

    <SetExternalMasterResponse>
  <SetExternalMasterResult>
    <DBInstance>
      <AllocatedStorage>50</AllocatedStorage>
      <AutoMinorVersionUpgrade>false</AutoMinorVersionUpgrade>
      <AvailabilityZone>east-14</AvailabilityZone>
      <BackupRetentionPeriod>1</BackupRetentionPeriod>
      <CACertificateIdentifier>rdb-ca-2023</CACertificateIdentifier>
      <DBInstanceClass>db.mini</DBInstanceClass>
      <DBInstanceIdentifier>mydbinstance</DBInstanceIdentifier>
      <DbInstanceStatus>modifying</DbInstanceStatus>
      <DBName>db01</DBName>
      <DBParameterGroups>
        <DBParameterGroup>
          <DBParameterGroupName>default.mysql5.7</DBParameterGroupName>
          <ParameterApplyStatus>in-sync</ParameterApplyStatus>
        </DBParameterGroup>
      </DBParameterGroups>
      <DBSecurityGroups>
        <DBSecurityGroup>
          <DBSecurityGroupName>mydbsecuritygroup</DBSecurityGroupName>
          <Status>active</Status>
        </DBSecurityGroup>
      </DBSecurityGroups>
      <Endpoint>
        <Port>3306</Port>
        <Address>XXX.XXX.XXX.XXX</Address>
        <NiftyPrivateAddress>YYY.YYY.YYY.YYY</NiftyPrivateAddress>
      </Endpoint>
      <Engine>mysql</Engine>
      <EngineVersion>5.7.15</EngineVersion>
      <ExternalReplicationInfo>
        <ReplicationAddresses>
          <ReplicationAddress>xxx.xxx.xxx.xxx</ReplicationAddress>
          <ReplicationAddress>yyy.yyy.yyy.yyy</ReplicationAddress>
        </ReplicationAddresses>
        <ReplicationPrivateAddresses>
          <ReplicationPrivateAddress>xxx.xxx.xxx.xxx</ReplicationPrivateAddress>
          <ReplicationPrivateAddress>yyy.yyy.yyy.yyy</ReplicationPrivateAddress>
        </ReplicationPrivateAddresses>
      </ExternalReplicationInfo>
      <InstanceCreateTime>2019-01-01T02:30:00.000Z</InstanceCreateTime>
      <LatestRestoragleTime>2019-01-01T04:00:00.000Z</LatestRestoragleTime>
      <LicenseModel>general-public-license</LicenseModel>
      <MasterUsername>mydbuser</MasterUsername>
      <MultiAZ>true</MultiAZ>
      <OptionGroupMemberships>
        <OptionGroupMembership>
          <OptionGroupName>default:mysql-5-7</OptionGroupName>
          <Status>in-sync</Status>
        </OptionGroupMembership>
      </OptionGroupMemberships>
      <PendingModifiedValues/>
      <PreferredBackupWindow>05:30-06:00</PreferredBackupWindow>
      <PreferredMaintenanceWindow>mon:06:01-mon:07:31</PreferredMaintenanceWindow>
      <PubliclyAccessible>true</PubliclyAccessible>
      <VpcSecurityGroups/>
      <NiftyStorageType>0</NiftyStorageType>
      <AccountingType>2</AccountingType>
      <NextMonthAccountingType>2</NextMonthAccountingType>
    </DBInstance>
  </SetExternalMasterResult>
  <ResponseMetadata>
    <RequestId>4838a0d1-e2ff-4da9-b675-0e3f9eb21c10</RequestId>
  </ResponseMetadata>
</SetExternalMasterResponse>

  
  • ※本ページ記載の金額は、すべて税抜表示です。
  • ※本ページ記載の他社製品名および会社名などは、各社の商標または登録商標です。
  • ※本ページの内容は、2023年9月05日時点の情報です。

推奨画面サイズ 1024×768 以上