Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/cassandra/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Cassandra复制到不同于nodetool getendpoints中的节点_Cassandra - Fatal编程技术网

Cassandra复制到不同于nodetool getendpoints中的节点

Cassandra复制到不同于nodetool getendpoints中的节点,cassandra,Cassandra,我在卡桑德拉有一张桌子: CREATE TABLE imdb.movies_by_actor ( actor text, movie_id uuid, character text, movie_title text, salary int, PRIMARY KEY (actor, movie_id) ) WITH CLUSTERING ORDER BY (movie_id ASC) actor | movie_id

我在卡桑德拉有一张桌子:

CREATE TABLE imdb.movies_by_actor (
    actor text,
    movie_id uuid,
    character text,
    movie_title text,
    salary int,
    PRIMARY KEY (actor, movie_id)
) WITH CLUSTERING ORDER BY (movie_id ASC)


 actor     | movie_id                             | character | movie_title | salary
-----------+--------------------------------------+-----------+-------------+--------
 Tom Hanks | 767b7a89-868c-46ce-8fa6-f6184dfb6d69 |       Dad |     Seattle |  25000
 Tom Hanks | a9a64b89-a19d-46e9-b5ee-991ac4939891 |   Officer |  Green mile |  20000
然后我找出哪些节点负责“Tom Hanks”分区:

select token(actor) from movies_by_actor ;

 system.token(actor)
----------------------
 -4258050846863339499
 -4258050846863339499

root@2f5aa8d649e2:/# nodetool getendpoints imdb movies_by_actor -4258050846863339499
172.13.0.6
172.13.0.3
172.13.0.4
然后我关闭了与
172.13.0.6
对应的节点:

docker stop cassandra6
root@2f5aa8d649e2:/# ping 172.13.0.6
PING 172.13.0.6 (172.13.0.6): 56 data bytes
92 bytes from 2f5aa8d649e2 (172.13.0.2): Destination Host Unreachable
当我尝试更新行并查看跟踪信息时,数据似乎被发送到
172.13.0.2
172.13.0.4
172.13.0.5

cqlsh:imdb> update movies_by_actor set salary = 26000 where actor = 'Tom Hanks' and movie_id = 767b7a89-868c-46ce-8fa6-f6184dfb6d69;

Tracing session: f44dbd70-4228-11e7-89c9-cf534e0135c6

 activity                                                                                                                                                       | timestamp                  | source     | source_elapsed | client
----------------------------------------------------------------------------------------------------------------------------------------------------------------+----------------------------+------------+----------------+-----------
                                                                                                                                             Execute CQL3 query | 2017-05-26 15:35:32.295000 | 172.13.0.2 |              0 | 127.0.0.1
 Parsing update movies_by_actor set salary = 26000 where actor = 'Tom Hanks' and movie_id = 767b7a89-868c-46ce-8fa6-f6184dfb6d69; [Native-Transport-Requests-1] | 2017-05-26 15:35:32.295000 | 172.13.0.2 |            303 | 127.0.0.1
                                                                                                              Preparing statement [Native-Transport-Requests-1] | 2017-05-26 15:35:32.295000 | 172.13.0.2 |            646 | 127.0.0.1
                                                                                                Determining replicas for mutation [Native-Transport-Requests-1] | 2017-05-26 15:35:32.296000 | 172.13.0.2 |           1181 | 127.0.0.1
                                                                                                                       Appending to commitlog [MutationStage-3] | 2017-05-26 15:35:32.296000 | 172.13.0.2 |           1420 | 127.0.0.1
                                                                                                           Adding to movies_by_actor memtable [MutationStage-3] | 2017-05-26 15:35:32.296000 | 172.13.0.2 |           1557 | 127.0.0.1
                                                                          Sending MUTATION message to /172.13.0.4 [MessagingService-Outgoing-/172.13.0.4-Small] | 2017-05-26 15:35:32.296000 | 172.13.0.2 |           1567 | 127.0.0.1
                                                                          Sending MUTATION message to /172.13.0.5 [MessagingService-Outgoing-/172.13.0.5-Small] | 2017-05-26 15:35:32.296000 | 172.13.0.2 |           1583 | 127.0.0.1
                                                                             MUTATION message received from /172.13.0.2 [MessagingService-Incoming-/172.13.0.2] | 2017-05-26 15:35:32.297000 | 172.13.0.4 |             27 | 127.0.0.1
                                                                             MUTATION message received from /172.13.0.2 [MessagingService-Incoming-/172.13.0.2] | 2017-05-26 15:35:32.297000 | 172.13.0.5 |             23 | 127.0.0.1
                                                                                                                       Appending to commitlog [MutationStage-1] | 2017-05-26 15:35:32.297000 | 172.13.0.4 |            332 | 127.0.0.1
                                                                                                           Adding to movies_by_actor memtable [MutationStage-1] | 2017-05-26 15:35:32.297000 | 172.13.0.4 |            577 | 127.0.0.1
                                                                                                            Enqueuing response to /172.13.0.2 [MutationStage-1] | 2017-05-26 15:35:32.298000 | 172.13.0.4 |            884 | 127.0.0.1
                                                                                                                       Appending to commitlog [MutationStage-2] | 2017-05-26 15:35:32.298000 | 172.13.0.5 |           1526 | 127.0.0.1
                                                                  Sending REQUEST_RESPONSE message to /172.13.0.2 [MessagingService-Outgoing-/172.13.0.2-Small] | 2017-05-26 15:35:32.298000 | 172.13.0.4 |           1122 | 127.0.0.1
                                                                                                           Adding to movies_by_actor memtable [MutationStage-2] | 2017-05-26 15:35:32.299000 | 172.13.0.5 |           1854 | 127.0.0.1
                                                                                                            Enqueuing response to /172.13.0.2 [MutationStage-2] | 2017-05-26 15:35:32.299000 | 172.13.0.5 |           2187 | 127.0.0.1
                                                                  Sending REQUEST_RESPONSE message to /172.13.0.2 [MessagingService-Outgoing-/172.13.0.2-Small] | 2017-05-26 15:35:32.299000 | 172.13.0.5 |           2423 | 127.0.0.1
                                                                     REQUEST_RESPONSE message received from /172.13.0.4 [MessagingService-Incoming-/172.13.0.4] | 2017-05-26 15:35:32.300000 | 172.13.0.2 |             56 | 127.0.0.1
                                                                     REQUEST_RESPONSE message received from /172.13.0.5 [MessagingService-Incoming-/172.13.0.5] | 2017-05-26 15:35:32.300000 | 172.13.0.2 |             15 | 127.0.0.1
                                                                                                  Processing response from /172.13.0.5 [RequestResponseStage-5] | 2017-05-26 15:35:32.300000 | 172.13.0.2 |            273 | 127.0.0.1
                                                                                                  Processing response from /172.13.0.4 [RequestResponseStage-4] | 2017-05-26 15:35:32.300000 | 172.13.0.2 |            774 | 127.0.0.1
                                                                                                                                               Request complete | 2017-05-26 15:35:32.296887 | 172.13.0.2 |           1887 | 127.0.0.1

尽管
172.13.0.6
已关闭,但使用一致性级别ALL进行选择也可以工作。有人能解释一下吗?

命令nodetool getendpoints接收到分区键值作为参数,而不是令牌

但是当参数值包含空格时,
nodetool getendpoints
存在一个问题

您可以使用答案中的脚本:

您可以运行nodetool环来列出每个节点的令牌范围,并查看哪些节点负责该范围


源:

命令
nodetool getendpoints
将分区键值作为参数而不是令牌接收。如果你想用空格来获取一个键的端点,请检查:或者我认为你是正确的。我使用
token(actor)
作为解决空间问题的方法。但是忘记了nodetool需要分区密钥而不是令牌。如果你把它作为一个答案,我会接受。