Cassandraクラスタ構築
Cassandraクラスタ構築に関して記述する。
※ Cassandraのバージョンは3系である。
Cassandra データ構造
Cassandra データ処理
Cassandra シングルノード構築
クラスタ
シングルノードのCassandraを構築できていれば、クラスタの構築はそこまで手間ではない。
Cassandraの設定
listen addressとrpc addressの設定が必須となる。
また、GossipingPropertyFileSnitchでのsnitchとなる。
Seedとなるノードを決めて、そのNodeのIPアドレスを設定する。
全ノードで共通の設定は以下。1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36# Apache cassadnraの場合
$ sudo vim /etc/cassandra/default.conf/cassandra.yaml
< listen_address: 127.0.0.1
< rpc_address: 127.0.0.1
< endpoint_snitch: SimpleSnitch
<
< seed_provider:
< # Addresses of hosts that are deemed contact points.
< # Cassandra nodes use this list of hosts to find each other and learn
< # the topology of the ring. You must change this if you are running
< # multiple nodes!
< - class_name: org.apache.cassandra.locator.SimpleSeedProvider
< parameters:
< # seeds is actually a comma-delimited list of addresses.
< # Ex: "<ip1>,<ip2>,<ip3>"
< - seeds: "127.0.0.1"
---
> listen_address: {My IP address}
> rpc_address: {My IP address}
> endpoint_snitch: GossipingPropertyFileSnitch
>
> seed_provider:
> # Addresses of hosts that are deemed contact points.
> # Cassandra nodes use this list of hosts to find each other and learn
> # the topology of the ring. You must change this if you are running
> # multiple nodes!
> - class_name: org.apache.cassandra.locator.SimpleSeedProvider
> parameters:
> # seeds is actually a comma-delimited list of addresses.
> # Ex: "<ip1>,<ip2>,<ip3>"
> - seeds: "{Seed IP address}"
---
DataCenterとRackの設定
仮想Rackの設定。
すべてのノードを同じデータセンターとラックで設定する。
冗長化したい場合は、複数のデータセンターで構築したほうが良い。
今回は、1データセンターと1ラックでの構築とする。1
2
3
4
5
6
7
8
9
10
11
12
13$ sudo vim /etc/cassandra/default.conf/cassandra-rackdc.properties
---
< dc=DC1
< rack=RAC1
---
< dc=cassandra01
< rack=RAC1
---
Cassandraの起動
Cassandraをクラスタで起動するとき、Seedノードから起動する必要があり、SeedでないノードはSeedノードへのコンタクトで起動する。
Seedノードの起動。1
$ sudo systemctl start cassandra
Seedでないノードの起動。1
$ sudo systemctl start cassandra
Cassandraのステータス確認
Cassandraのクラスタステータスを確認する。
1 | $ nodetool status |