为什么我得到NoHostAvailable:?

时间:2017-03-06 13:36:36

标签: cassandra

如果我运行这个简单的查询:

SELECT * from myapp.latests WHERE organization_id = 1 and user_id = 1;

我收到错误:

NoHostAvailable:

nodetool status结果运行到:

Datacenter: eu-central
======================
Status=Up/Down
|/ State=Normal/Leaving/Joining/Moving
--  Address    Load       Tokens       Owns (effective)  Host ID                               Rack
UN  10.0.0.53  190.96 KiB  256          0.0%              80f8bf0a-c46d-41ce-bb2e-498def5b3792  1a
UN  10.0.20.5  189.35 KiB  256          0.0%              f25fe4bf-29b2-4403-8e3e-4e973a5f26ab  1b
UN  10.0.0.54  183.13 KiB  256          0.0%              c46ac05a-6cb2-48f1-a776-2c57c33e7719  1a

以下是描述:

DESCRIBE myapp;

CREATE KEYSPACE myapp WITH replication = {'class': 'NetworkTopologyStrategy', 'eu-central-1': '2'}  AND durable_writes = true;

CREATE TABLE myapp.locations (
    organization_id int,
    user_id int,
    date text,
    unix_time bigint,
    lat double,
    long double,
    PRIMARY KEY ((organization_id, user_id, date), unix_time)
) WITH CLUSTERING ORDER BY (unix_time ASC)
    AND bloom_filter_fp_chance = 0.01
    AND caching = {'keys': 'ALL', 'rows_per_partition': 'NONE'}
    AND comment = ''
    AND compaction = {'class': 'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy', 'max_threshold': '32', 'min_threshold': '4'}
    AND compression = {'chunk_length_in_kb': '64', 'class': 'org.apache.cassandra.io.compress.LZ4Compressor'}
    AND crc_check_chance = 1.0
    AND dclocal_read_repair_chance = 0.1
    AND default_time_to_live = 0
    AND gc_grace_seconds = 864000
    AND max_index_interval = 2048
    AND memtable_flush_period_in_ms = 0
    AND min_index_interval = 128
    AND read_repair_chance = 0.0
    AND speculative_retry = '99PERCENTILE';

CREATE TABLE myapp.latests (
    organization_id int,
    user_id int,
    lat double,
    long double,
    unix_time bigint,
    PRIMARY KEY (organization_id, user_id)
) WITH CLUSTERING ORDER BY (user_id ASC)
    AND bloom_filter_fp_chance = 0.01
    AND caching = {'keys': 'ALL', 'rows_per_partition': 'NONE'}
    AND comment = ''
    AND compaction = {'class': 'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy', 'max_threshold': '32', 'min_threshold': '4'}
    AND compression = {'chunk_length_in_kb': '64', 'class': 'org.apache.cassandra.io.compress.LZ4Compressor'}
    AND crc_check_chance = 1.0
    AND dclocal_read_repair_chance = 0.1
    AND default_time_to_live = 0
    AND gc_grace_seconds = 864000
    AND max_index_interval = 2048
    AND memtable_flush_period_in_ms = 0
    AND min_index_interval = 128
    AND read_repair_chance = 0.0
    AND speculative_retry = '99PERCENTILE';

有什么想法吗?

1 个答案:

答案 0 :(得分:0)

请检查您的客户端是否有权使用端口9042进行连接。 如果从群集上的cqlsh运行它,请检查端口是否在Cassandra节点之间打开(nodetool使用另一个端口和协议(JMX))。