NoHostAvailable:,在elassandra插入查询与网络拓扑策略

问题描述:

在elassandra插入查询与网络拓扑策略它显示'没有主机可用'。NoHostAvailable:,在elassandra插入查询与网络拓扑策略

cqlsh>CREATE KEYSPACE IF NOT EXISTS twitter WITH replication={ 'class':'NetworkTopologyStrategy', 'dc1':'1' }; 

cqlsh>CREATE TABLE twitter.user (
    name text, 
    attrs map<text,text>, 
    PRIMARY KEY (name) 
); 

cqlsh>INSERT INTO twitter.user (name,attrs) VALUES ('bob',{'email':'[email protected]','firstname':'bob'}); 

enter image description here nodetool状态使用相同的DC,展示的这个 enter image description here

+0

节目使用的nodetool状态输出的时间 –

+0

萨钦@用户PC:〜/ elassandraDemo/elassandra-2.4.2/bin $ ./nodetool status twitter Datacenter:DC1 =============== Status = Up/Down |/State = Normal/Leaving/Joining/Moving - Address Load代币所有者(有效)主机ID机架 UN 127.0.0.1 186.72 KB 8 0.0%089a9ce4-7676-4b14-9773-58aa5913fa34 r1 –

更改您的密钥空间的数据中心名称enter image description here

另一个密钥空间DC1

ALTER KEYSPACE twitter WITH replication = {'class': 'NetworkTopologyStrategy', 'DC1' : 1}; 

数据中心名称区分大小写。


编辑

两个复制策略可供选择:

  • SimpleStrategy:用于只有一个数据中心。如果您打算使用多个数据中心,请使用NetworkTopologyStrategy。
  • NetworkTopologyStrategy:强烈建议用于大多数部署,因为未来扩展需要扩展到多个数据中心时更容易。
+0

是数据中心或复制是否一样? –

+0

不可以。对于每个密钥空间复制可以为每个数据中心配置 –

+0

是否可以在simpleStrategy上运行elasticsearch? –

'dc1'创造密钥空间应该是数据中心的名称,当您使用nodetool status