GridDB Community Edition 4.1では、オンラインノードの追加と削除が追加されました。 この機能は、これまで商用Standard Edition(SE)でしか利用できませんでした。 2回シリーズの初回であるこのブログでは、パブリッククラウドインフラストラクチャ上に3ノードクラスタを設定する方法をご紹介します。 2回目のブログでは、障害からの回復、ノードの追加と削除のプロセスについて説明します。
この後説明する手順に従って各ステップを実行できるように、予め3つのCentos 7インスタンスを同じvnet、griddb1(192.168.1.10)、griddb2(192.168.1.11)、griddb3(192.168.1.12)にデプロイしておきましょう。
#1 GridDBをインストールする
$ sudo rpm -Uvh https://github.com/griddb/griddb_nosql/releases/download/v4.1.1/griddb_nosql-4.1.1-1.linux.x86_64.rpm
#2 コンフィギュレーションファイルを作成してデプロイする
まず、 iptables と firewalld を無効にします。 実稼働環境では、すべてのGridDBポートにアクセスできるようにするルールを作成する必要があります。
$ sudo su - # systemctl disable firewalld # systemctl stop firewalld # iptables -F INPUT
すべてのGridDB操作は gsadm ユーザーとして実行する必要があります。
$ sudo su - gsadm
gs_cluster.jsonは、クラスターの名前、クラスター内のノードの定義、および複製番号を指定します。 replicationNum: 2では、2つのノードにGridDBに格納されている各データが含まれます。
$ cat > /var/lib/gridstore/conf/gs_cluster.json << EOF
{
"dataStore":{
"partitionNum":128,
"storeBlockSize":"64KB"
},
"cluster":{
"clusterName":"defaultCluster",
"replicationNum":2,
"notificationInterval":"5s",
"heartbeatInterval":"5s",
"loadbalanceCheckInterval":"180s",
"notificationMember": [
{
"cluster": {"address":"192.168.1.10", "port":10010},
"sync": {"address":"192.168.1.10", "port":10020},
"system": {"address":"192.168.1.10", "port":10080},
"transaction": {"address":"192.168.1.10", "port":10001},
"sql": {"address":"192.168.1.10", "port":20001}
},
{
"cluster": {"address":"192.168.1.11", "port":10010},
"sync": {"address":"192.168.1.11", "port":10020},
"system": {"address":"192.168.1.11", "port":10080},
"transaction": {"address":"192.168.1.11", "port":10001},
"sql": {"address":"192.168.1.11", "port":20001}
},
{
"cluster": {"address":"192.168.1.12", "port":10010},
"sync": {"address":"192.168.1.12", "port":10020},
"system": {"address":"192.168.1.12", "port":10040},
"transaction": {"address":"192.168.1.12", "port":10001},
"sql": {"address":"192.168.1.12", "port":20001}
}
]
},
"sync":{
"timeoutInterval":"30s"
}
}
EOF
gs_node.json で、使用するメモリ量とスレッド数を設定します。 次の値は、8コアと8GBのRAMを搭載したノード用の設定です。
$ cat > /var/lib/gridstore/conf/gs_node.json << EOF
{
"dataStore":{
"dbPath":"data",
"backupPath":"backup",
"storeMemoryLimit":"5120MB",
"storeWarmStart":true,
"concurrency":8,
"logWriteMode":1,
"persistencyMode":"NORMAL",
"affinityGroupSize":4
},
"checkpoint":{
"checkpointInterval":"1200s",
"checkpointMemoryLimit":"1024MB",
"useParallelMode":false
},
"cluster":{
"servicePort":10010
},
"sync":{
"servicePort":10020
},
"system":{
"servicePort":10040,
"eventLogPath":"log"
},
"transaction":{
"servicePort":10001,
"connectionLimit":5000
},
"trace":{
"default":"LEVEL_ERROR",
"dataStore":"LEVEL_ERROR",
"collection":"LEVEL_ERROR",
"timeSeries":"LEVEL_ERROR",
"chunkManager":"LEVEL_ERROR",
"objectManager":"LEVEL_ERROR",
"checkpointFile":"LEVEL_ERROR",
"checkpointService":"LEVEL_INFO",
"logManager":"LEVEL_WARNING",
"clusterService":"LEVEL_ERROR",
"syncService":"LEVEL_ERROR",
"systemService":"LEVEL_INFO",
"transactionManager":"LEVEL_ERROR",
"transactionService":"LEVEL_ERROR",
"transactionTimeout":"LEVEL_WARNING",
"triggerService":"LEVEL_ERROR",
"sessionTimeout":"LEVEL_WARNING",
"replicationTimeout":"LEVEL_WARNING",
"recoveryManager":"LEVEL_INFO",
"eventEngine":"LEVEL_WARNING",
"clusterOperation":"LEVEL_INFO",
"ioMonitor":"LEVEL_WARNING"
}
}
EOF
最後に、管理ユーザーのパスワードを設定します。 テストではない実稼働環境であれば、もっと厳重で安全なパスワードにすべきでしょう。
$ gs_passwd -u admin -p admin
#3 GridDBをスタートさせる
$ sudo su - gsadm $ gs_startnode $ gs_joincluster -u admin/admin -n 3
#4 最後に
最後に、 gs_stat を実行してクラスタが正しく動作しているかどうかを確認します。 以下のように完全なノードリストが表示されない場合は、マスターノードに移動してそこで gs_stat を実行します。 gs_stat にSUB_CLUSTERと表示されている場合、クラスタは正常に動作していないため、ノード間の通信に問題がある可能性があります。
$ sudo su - gsadm
$ gs_stat -u admin/admin
... snip ...
"cluster": {
"activeCount": 3,
"clusterName": "defaultCluster",
"clusterStatus": "MASTER",
"designatedCount": 3,
"loadBalancer": "ACTIVE",
"master": {
"address": "192.168.1.10",
"port": 10040
},
"nodeList": [
{
"address": "192.168.1.10",
"port": 10040
},
{
"address": "192.168.1.11",
"port": 10080
},
{
"address": "192.168.1.12",
"port": 10080
}
],
"nodeStatus": "ACTIVE",
"notificationMode": "FIXED_LIST",
"partitionStatus": "NORMAL",
"startupTime": "2019-03-15T04:57:16Z",
"syncCount": 173
},
... snip ...
ブログの内容について疑問や質問がある場合は Q&A サイトである Stack Overflow に質問を投稿しましょう。 GridDB 開発者やエンジニアから速やかな回答が得られるようにするためにも "griddb" タグをつけることをお忘れなく。 https://stackoverflow.com/questions/ask?tags=griddb
