Skip to content

Commit cdc91af

Browse files
committed
更新cassandra-sink文档
1 parent ab67cfb commit cdc91af

File tree

1 file changed

+106
-19
lines changed

1 file changed

+106
-19
lines changed

docs/plugin/cassandraSink.md

Lines changed: 106 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ CREATE TABLE tableName(
1717
```
1818

1919
## 2.支持版本
20-
cassandra-3.6.x
20+
cassandra-3.x
2121

2222
## 3.表结构定义
2323

@@ -27,7 +27,7 @@ CREATE TABLE tableName(
2727
| colName | 列名称|
2828
| colType | 列类型 [colType支持的类型](docs/colType.md)|
2929

30-
## 4.参数
30+
## 4.参数
3131

3232
|参数名称|含义|是否必填|默认值|
3333
|----|----|----|----|
@@ -38,26 +38,113 @@ CREATE TABLE tableName(
3838
|tableName | cassandra表名称|||
3939
|database | cassandra表名称|||
4040
|parallelism | 并行度设置||1|
41-
|maxRequestsPerConnection | 每个连接最多允许64个并发请求||NONE|
42-
|coreConnectionsPerHost | 和Cassandra集群里的每个机器都至少有2个连接||NONE|
43-
|maxConnectionsPerHost | 和Cassandra集群里的每个机器都最多有6个连接||NONE|
44-
|maxQueueSize | Cassandra队列大小||NONE|
45-
|readTimeoutMillis | Cassandra读超时||NONE|
46-
|connectTimeoutMillis | Cassandra连接超时||NONE|
47-
|poolTimeoutMillis | Cassandra线程池超时||NONE|
41+
| maxRequestsPerConnection | 每个连接允许的并发请求数||1|
42+
| coreConnectionsPerHost | 每台主机连接的核心数||8|
43+
| maxConnectionsPerHost | Cassandra集群里的每个机器都最多连接数||32768|
44+
| maxQueueSize | Cassandra队列大小||100000|
45+
| readTimeoutMillis | Cassandra读超时||60000|
46+
| connectTimeoutMillis | Cassandra连接超时||60000|
47+
| poolTimeoutMillis | Cassandra线程池超时||60000|
4848

49-
## 5.样例
49+
## 5.完整样例
5050
```
51+
CREATE TABLE MyTable(
52+
id bigint,
53+
name varchar,
54+
address varchar
55+
)WITH(
56+
type = 'kafka10',
57+
bootstrapServers = '172.16.101.224:9092',
58+
zookeeperQuorm = '172.16.100.188:2181/kafka',
59+
offsetReset = 'latest',
60+
topic = 'tiezhu_test_in2',
61+
timezone = 'Asia/Shanghai',
62+
topicIsPattern = 'false',
63+
parallelism = '1'
64+
);
65+
66+
CREATE TABLE sideTable(
67+
id bigint,
68+
message varchar,
69+
PRIMARY KEY(id),
70+
PERIOD FOR SYSTEM_TIME
71+
)WITH(
72+
type ='cassandra',
73+
address ='192.168.80.106:9042, 192.168.80.107:9042',
74+
database ='tiezhu',
75+
tableName ='stu',
76+
userName='cassandra',
77+
password='cassandra',
78+
cache ='LRU',
79+
parallelism ='1',
80+
partitionedJoin='false'
81+
);
82+
5183
CREATE TABLE MyResult(
52-
channel VARCHAR,
53-
pv VARCHAR
84+
id bigint,
85+
name varchar,
86+
address varchar,
87+
message varchar
5488
)WITH(
5589
type ='cassandra',
56-
address ='172.21.32.1:9042,172.21.32.1:9042',
57-
userName ='dtstack',
58-
password ='abc123',
59-
database ='test',
60-
tableName ='pv',
90+
address ='192.168.80.106:9042,192.168.80.107:9042',
91+
userName='cassandra',
92+
password='cassandra',
93+
database ='tiezhu',
94+
tableName ='stu_out',
6195
parallelism ='1'
62-
)
63-
```
96+
);
97+
98+
insert
99+
into
100+
MyResult
101+
select
102+
t1.id AS id,
103+
t1.name AS name,
104+
t1.address AS address,
105+
t2.message AS message
106+
from
107+
(
108+
select
109+
id,
110+
name,
111+
address
112+
from
113+
MyTable
114+
) t1
115+
join sideTable t2
116+
on t1.id = t2.id;
117+
```
118+
### 6.结果表数据展示
119+
```
120+
cqlsh:tiezhu> desc stu_out
121+
122+
CREATE TABLE tiezhu.stu_out (
123+
id int PRIMARY KEY,
124+
address text,
125+
message text,
126+
name text
127+
) WITH bloom_filter_fp_chance = 0.01
128+
AND caching = {'keys': 'ALL', 'rows_per_partition': 'NONE'}
129+
AND comment = ''
130+
AND compaction = {'class': 'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy', 'max_threshold': '32', 'min_threshold': '4'}
131+
AND compression = {'chunk_length_in_kb': '64', 'class': 'org.apache.cassandra.io.compress.LZ4Compressor'}
132+
AND crc_check_chance = 1.0
133+
AND dclocal_read_repair_chance = 0.1
134+
AND default_time_to_live = 0
135+
AND gc_grace_seconds = 864000
136+
AND max_index_interval = 2048
137+
AND memtable_flush_period_in_ms = 0
138+
AND min_index_interval = 128
139+
AND read_repair_chance = 0.0
140+
AND speculative_retry = '99PERCENTILE';
141+
142+
143+
cqlsh:tiezhu> select * from stu_out limit 1;
144+
145+
id | address | message | name
146+
----+------------+------------------+----------
147+
23 | hangzhou23 | flinkStreamSql23 | tiezhu23
148+
149+
(1 rows)
150+
```

0 commit comments

Comments
 (0)