免费观看又色又爽又黄的小说免费_美女福利视频国产片_亚洲欧美精品_美国一级大黄大色毛片

Cassandra兩種登錄方式cassandra-cli/csqlsh

(1)cassandra-cli

創(chuàng)新互聯(lián)服務(wù)項(xiàng)目包括貴德網(wǎng)站建設(shè)、貴德網(wǎng)站制作、貴德網(wǎng)頁(yè)制作以及貴德網(wǎng)絡(luò)營(yíng)銷策劃等。多年來(lái),我們專注于互聯(lián)網(wǎng)行業(yè),利用自身積累的技術(shù)優(yōu)勢(shì)、行業(yè)經(jīng)驗(yàn)、深度合作伙伴關(guān)系等,向廣大中小型企業(yè)、政府機(jī)構(gòu)等提供互聯(lián)網(wǎng)行業(yè)的解決方案,貴德網(wǎng)站推廣取得了明顯的社會(huì)效益與經(jīng)濟(jì)效益。目前,我們服務(wù)的客戶以成都為中心已經(jīng)輻射到貴德省份的部分城市,未來(lái)相信會(huì)繼續(xù)擴(kuò)大服務(wù)區(qū)域并繼續(xù)獲得客戶的支持與信任!

cassadnra-cli命令在cassandra2.2中被拋棄,以后登錄訪問(wèn)cassandra可以使用cqlsh

[tnuser@sht-sgmhadoopdn-02 cassandra]$ cassandra-cli -h 172.16.101.59 -p 9160

Connected to: "mycluster" on 172.16.101.59/9160

Welcome to Cassandra CLI version 2.1.18

[default@unknown] create keyspace twissandra;

    with placement_strategy = 'org.apache.cassandra.locator.SimpleStrategy'

    and strategy_options = {replication_factor:1};

5200ec35-6f27-3f8f-a969-5f91b4308d40

[default@unknown] use twissandra;

Authenticated to keyspace: twissandra

[default@twissandra] help create column family;

[default@twissandra] create column family users with comparator = UTF8Type;

8eadec66-a110-32b4-b873-5bfaaac2ddf5

[default@twissandra] update column family users with

    column_metadata =

     [

    {column_name: first, validation_class: UTF8Type},

    {column_name: last, validation_class: UTF8Type},

    {column_name: age, validation_class: UTF8Type, index_type: KEYS}

    ];

ccdbe046-183a-307f-8e38-c1f44400f9fa

[default@twissandra] assume users keys as utf8;

Assumption for column family 'users' added successfully.

#插入數(shù)據(jù)

[default@twissandra] set users['jsmith']['first']='John';

[default@twissandra] set users['jsmith']['last']='Smith';

[default@twissandra] set users['jsmith']['age']='38';

#插入數(shù)據(jù)

[default@twissandra] get users['jsmith'];

=> (name=age, value=38, timestamp=1502764716526000)

=> (name=first, value=John, timestamp=1502764685559000)

=> (name=last, value=Smith, timestamp=1502764696653000)

#修改數(shù)據(jù)值

[default@twissandra] set users['jsmith']['first']='Jack';

[default@twissandra] get users['jsmith'];

=> (name=age, value=38, timestamp=1502764716526000)

=> (name=first, value=Jack, timestamp=1502764821855000)

=> (name=last, value=Smith, timestamp=1502764696653000)

[default@twissandra] get users where age='38';

-------------------

RowKey: jsmith

=> (name=age, value=38, timestamp=1502764716526000)

=> (name=first, value=Jack, timestamp=1502764821855000)

=> (name=last, value=Smith, timestamp=1502764696653000)

(2)cqlsh

[tnuser@sht-sgmhadoopdn-02 ~]$ cqlsh -ucassandra -pcassandra localhost

#遠(yuǎn)程訪問(wèn):

[tnuser@sht-sgmhadoopnn-02 ~]$ cqlsh 172.16.101.59

#查看版本

cassandra@cqlsh:system> show version;

[cqlsh 5.0.1 | Cassandra 3.11.1 | CQL spec 3.4.4 | Native protocol v4]

cassandra@cqlsh:system> show host;

Connected to Test Cluster at 127.0.0.1:9042.

#system.local表

cassandra@cqlsh:system> select key,cluster_name,listen_address from system.local;

key   | cluster_name | listen_address

-------+--------------+-----------------

local | Test Cluster | 192.168.163.102

#創(chuàng)建一個(gè)keyspace:

cqlsh> create keyspace mykeyspace with replication = {'class':'SimpleStrategy','replication_factor':1} AND durable_writes = true;

#查看總共有哪些keyspace:

cqlsh> desc keyspaces

system_traces  twissandra  system  mykeyspace

#查看指定keyspace的詳細(xì)信息:

cqlsh> desc mykeyspace

CREATE KEYSPACE mykeyspace WITH replication = {'class': 'SimpleStrategy', 'replication_factor': '1'}  AND durable_writes = true;

#進(jìn)入某個(gè)keyspace:

cqlsh> use mykeyspace;

#創(chuàng)建一個(gè)users表:

cqlsh:mykeyspace> create table users(user_id int primary key,fname text,lname text);

cqlsh:mykeyspace> desc tables;

users

#查看users表信息:

cqlsh:mykeyspace> desc users;

CREATE TABLE mykeyspace.users (

    user_id int PRIMARY KEY,

    fname text,

    lname text

) WITH 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'}

    AND compression = {'sstable_compression': 'org.apache.cassandra.io.compress.LZ4Compressor'}

    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 = '99.0PERCENTILE';

#插入數(shù)據(jù)

cqlsh:mykeyspace> insert into users (user_id,fname,lname) values(1744,'john','doe');

cqlsh:mykeyspace> insert into users (user_id,fname,lname) values(1745,'john','smith');

cqlsh:mykeyspace> insert into users (user_id,fname,lname) values(1746,'john','jack');

cqlsh:mykeyspace> select * from users;

user_id | fname | lname

---------+-------+-------

    1745 |  john | smith

    1744 |  john |   doe

    1746 |  john |  jack

#創(chuàng)建索引:

cqlsh:mykeyspace> create index users_lname_idx on users(lname);

cqlsh:mykeyspace> select * from users where lname='smith';

user_id | fname | lname

---------+-------+-------

    1745 |  john | smith

注意:

如果是通過(guò)cassandra-cli登錄創(chuàng)建的數(shù)據(jù)然后通過(guò)再cli查看,可能會(huì)不兼容:

cqlsh:mykeyspace> desc twissandra;

CREATE KEYSPACE twissandra WITH replication = {'class': 'NetworkTopologyStrategy', 'datacenter1': '1'}  AND durable_writes = true;

/*

Warning: Table twissandra.users omitted because it has constructs not compatible with CQL (was created via legacy API). # 這里發(fā)出警告,不兼容

Approximate structure, for reference:

(this should not be used to reproduce this schema)

CREATE TABLE twissandra.users (

    key blob,

    column1 text,

    value blob,

    age text,

    first text,

    last text,

    PRIMARY KEY (key, column1)

) WITH COMPACT STORAGE

    AND CLUSTERING ORDER BY (column1 ASC)

    AND caching = '{"keys":"ALL", "rows_per_partition":"NONE"}'

    AND comment = ''

    AND compaction = {'class': 'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy'}

    AND compression = {'sstable_compression': 'org.apache.cassandra.io.compress.LZ4Compressor'}

    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 = 'NONE';

CREATE INDEX users_age_idx ON twissandra.users (age);

*/

cqlsh:mykeyspace> select * from twissandra.users;

key            | column1 | value        | age   | first | last

----------------+---------+--------------+-------+-------+-------

0x6a736d697468 |     age |       0x3338 |    38 |    38 |    38

0x6a736d697468 |   first |   0x4a61636b |  Jack |  Jack |  Jack

0x6a736d697468 |    last | 0x536d697468 | Smith | Smith | Smith

本文標(biāo)題:Cassandra兩種登錄方式cassandra-cli/csqlsh
當(dāng)前地址:http://m.newbst.com/article6/gcsgig.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供App設(shè)計(jì)Google網(wǎng)站營(yíng)銷動(dòng)態(tài)網(wǎng)站網(wǎng)站制作標(biāo)簽優(yōu)化

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)

h5響應(yīng)式網(wǎng)站建設(shè)