Cassandra 文件

版本

您正在檢視預發行版本的說明文件。

cassandra-topologies.properties 檔案

PropertyFileSnitch snitch 選項使用 cassandra-topologies.properties 組態檔來判斷叢集節點屬於哪些 datacenters 和機架。如果使用其他 snitches,則必須使用 cassandra-rackdc.properties。snitch 會決定網路拓撲(依機架和資料中心判斷接近性),以便有效地路由要求,並讓資料庫平均分配複本。

在屬性檔中納入叢集中的每個節點,並依照 keyspace 定義中的方式定義資料中心名稱。資料中心和機架名稱區分大小寫。

cassandra-topologies.properties 檔案必須複製到叢集中每個節點,且內容完全相同。

範例

此範例使用三個資料中心

# datacenter One

175.56.12.105=DC1:RAC1
175.50.13.200=DC1:RAC1
175.54.35.197=DC1:RAC1

120.53.24.101=DC1:RAC2
120.55.16.200=DC1:RAC2
120.57.102.103=DC1:RAC2

# datacenter Two

110.56.12.120=DC2:RAC1
110.50.13.201=DC2:RAC1
110.54.35.184=DC2:RAC1

50.33.23.120=DC2:RAC2
50.45.14.220=DC2:RAC2
50.17.10.203=DC2:RAC2

# datacenter Three

172.106.12.120=DC3:RAC1
172.106.12.121=DC3:RAC1
172.106.12.122=DC3:RAC1

# default for unknown nodes
default =DC3:RAC1