产品动态
产品公告
安全公告
mysql -h fe_host -P9030 -u root -p
mysql > drop database if exists example_db;mysql > drop user test;
mysql> SHOW PROC '/frontends'\\G************************* 1. row ************************Name: 172.16.139.24_9010_1594200991015IP: 172.16.139.24HostName: starrocks-sandbox01EditLogPort: 9010HttpPort: 8030QueryPort: 9030RpcPort: 9020Role: FOLLOWERIsMaster: trueClusterId: 861797858Join: trueAlive: trueReplayedJournalId: 64LastHeartbeat: 2020-03-23 20:15:07IsHelper: trueErrMsg:1 row in set (0.03 sec)
mysql> SHOW PROC '/backends'\\G********************* 1. row **********************BackendId: 10002Cluster: default_clusterIP: 172.16.139.24HostName: starrocks-sandbox01HeartbeatPort: 9050BePort: 9060HttpPort: 8040BrpcPort: 8060LastStartTime: 2020-03-23 20:19:07LastHeartbeat: 2020-03-23 20:34:49Alive: trueSystemDecommissioned: falseClusterDecommissioned: falseTabletNum: 0DataUsedCapacity: .000AvailCapacity: 327.292 GBTotalCapacity: 450.905 GBUsedPct: 27.41 %MaxDiskUsedPct: 27.41 %ErrMsg:Version:1 row in set (0.01 sec)
MySQL> SHOW PROC "/brokers"\\G*************************** 1. row ***************************Name: broker1IP: 172.16.139.24Port: 8000Alive: trueLastStartTime: 2020-04-01 19:08:35LastUpdateTime: 2020-04-01 19:08:45ErrMsg:1 row in set (0.00 sec)
mysql > create user 'test' identified by '123456';
mysql > create database example_db;
mysql > show databases;+--------------------+| Database |+--------------------+| example_db || information_schema |+--------------------+2 rows in set (0.00 sec)
mysql > grant all on example_db to test;
mysql > exitmysql -h 127.0.0.1 -P9030 -utest -p123456
mysql >CREATE TABLE table1(siteid INT DEFAULT '10',citycode SMALLINT,username VARCHAR(32) DEFAULT '',pv BIGINT SUM DEFAULT '0')AGGREGATE KEY(siteid, citycode, username)DISTRIBUTED BY HASH(siteid) BUCKETS 10PROPERTIES("replication_num" = "1");
CREATE TABLE table2(event_day DATE,siteid INT DEFAULT '10',citycode SMALLINT,username VARCHAR(32) DEFAULT '',pv BIGINT SUM DEFAULT '0')AGGREGATE KEY(event_day, siteid, citycode, username)PARTITION BY RANGE(event_day)(PARTITION p1 VALUES LESS THAN ('2017-06-30'),PARTITION p2 VALUES LESS THAN ('2017-07-31'),PARTITION p3 VALUES LESS THAN ('2017-08-31'))DISTRIBUTED BY HASH(siteid) BUCKETS 10PROPERTIES("replication_num" = "1");
mysql> show tables;+-------------------------+| Tables_in_example_db |+-------------------------+| table1 || table2 |+-------------------------+2 rows in set (0.01 sec)mysql> desc table1;+----------+-------------+------+-------+---------+-------+| Field | Type | Null | Key | Default | Extra |+----------+-------------+------+-------+---------+-------+| siteid | int(11) | Yes | true | 10 | || citycode | smallint(6) | Yes | true | N/A | || username | varchar(32) | Yes | true | | || pv | bigint(20) | Yes | false | 0 | SUM |+----------+-------------+------+-------+---------+-------+4 rows in set (0.00 sec)mysql> desc table2;+-----------+-------------+------+-------+---------+-------+| Field | Type | Null | Key | Default | Extra |+-----------+-------------+------+-------+---------+-------+| event_day | date | Yes | true | N/A | || siteid | int(11) | Yes | true | 10 | || citycode | smallint(6) | Yes | true | N/A | || username | varchar(32) | Yes | true | | || pv | bigint(20) | Yes | false | 0 | SUM |+-----------+-------------+------+-------+---------+-------+5 rows in set (0.00 sec)
文档反馈