当前位置:   article > 正文

flink 读取 starrocks 数据_flink读取starrocks

flink读取starrocks

一些命令

./bin/stop-cluster.sh
./bin/start-cluster.sh
./bin/flink list running
新补充一些 jar 包,需要重启 cluster
Could not acquire the minimum required resources.提示资源不够,需要更改配置
https://blog.csdn.net/liupinyang/article/details/126287771
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6

首先在 starrocks 上创建一个表,插入一些数据

CREATE TABLE `users` (
  `user_id` bigint(20) NOT NULL COMMENT "",
  `name` varchar(65533) NOT NULL COMMENT "",
  `email` varchar(65533) NULL COMMENT "",
  `address` varchar(65533) NULL COMMENT "",
  `age` tinyint(4) NULL COMMENT "",
  `sex` tinyint(4) NULL COMMENT "",
  `last_active` datetime NULL COMMENT "",
  `property0` tinyint(4) NOT NULL COMMENT "",
  `property1` tinyint(4) NOT NULL COMMENT "",
  `property2` tinyint(4) NOT NULL COMMENT "",
  `property3` tinyint(4) NOT NULL COMMENT ""
) ENGINE=OLAP
PRIMARY KEY(`user_id`)
COMMENT "OLAP"
DISTRIBUTED BY HASH(`user_id`) BUCKETS 4
PROPERTIES (
"replication_num" = "3",
"in_memory" = "false",
"storage_format" = "DEFAULT",
"enable_persistent_index" = "true",
"compression" = "LZ4"
);

insert into users (user_id,name,property0,property1,property2,property3) values(10, "jack",1,2,3,4);
insert into users (user_id,name,property0,property1,property2,property3) values(11, "mary",1,2,3,4);
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26

flink 上创建表

CREATE TABLE flink_test2 (
    user_id bigint ,
    name string ,
    email string ,
    address string ,
    age tinyint ,
    sex tinyint ,
    last_active TIMESTAMP(10),
    property0 tinyint ,
    property1 tinyint ,
    property2 tinyint ,
    property3 tinyint 
) WITH (
   'connector'='starrocks',
   'scan-url'='172.26.194.119:8134',
   'jdbc-url'='jdbc:mysql://172.26.194.119:9132',
   'username'='root',
   'password'='',
   'database-name'='tn_test',
   'table-name'='users'
);
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21

读取

Flink SQL> select * from flink_test2;
  • 1
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/我家自动化/article/detail/993026
推荐阅读
相关标签
  

闽ICP备14008679号