Weitere ähnliche Inhalte
Ähnlich wie Consistency level (19)
Mehr von Kazutaka Tomita (10)
Kürzlich hochgeladen (11)
Consistency level
- 4. データは何処にあるのか?(Partition) 複数ノードを立ち上げた時に実際データは何処にあるのか storage-conf.xmlのPartitionerがorg.apache.cassandra.dht.RandomPartitionerの場合 (デフォルト)、キーをMD5でHash値化した値を整数とみなし、0から2^127の間の 各ノードが持つレンジに割り当てる。 例) KS「TimeStampSimpleTrees」、CF「SimpleTrees」、 key「3」、Column「id」データの場合 TimeStampSimpleTrees.SimpleTrees['3']['id'] keyをmd5でハッシュ化->「314755909755515592000481005244904880883」 Nodetoolより pompadour@zaku2-F-1:~$ nodetool --host 192.168.1.104 ring Address Status Load Range Ring 123621947362397555094783433836216926846 192.168.1.106 Up 21.53 MB 4368941974377008489670679703283346037 |<--| 192.168.1.6 Up 11.01 MB 53716703941129153059732412441632990819 | | 192.168.1.104 Up 4.37 MB 72360816833403413813516172818645147903 | | 192.168.1.109 Up 10.95 MB 123621947362397555094783433836216926846 |-->| 192.168.1.109のキー「123621947362397555094783433836216926846」より大きい よってプライマリレプリカは「192.168.1.106」
- 6. thriftAPIで見てみる thriftAPIのdescribe_ringを使用してリング情報を取得する。 例) KS「TimeStampSimpleTrees」のringを取得 ReplicationFactor=2 結果を成形 [ TokenRange( end_token='123621947362397555094783433836216926846', start_token='72360816833403413813516172818645147903', endpoints=['192.168.1.109', '192.168.1.106']), TokenRange( end_token='72360816833403413813516172818645147903', start_token='53716703941129153059732412441632990819', endpoints=['192.168.1.104', '192.168.1.109']), TokenRange( end_token='4368941974377008489670679703283346037', start_token='123621947362397555094783433836216926846', endpoints=['192.168.1.106', '192.168.1.6']), TokenRange( end_token='53716703941129153059732412441632990819', start_token='4368941974377008489670679703283346037', endpoints=['192.168.1.6', '192.168.1.104']) ] 「3」のhash値「314755909755515592000481005244904880883」は 「 192.168.1.109」, 「192.168.1.6」に格納される。