privilege_sysinfo.sim 5.7 KB
Newer Older
1 2 3 4 5
system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1
system sh/exec.sh -n dnode1 -s start
sql connect

S
Shengliang Guan 已提交
6 7 8 9 10
print =============== create user and login
sql create user sysinfo0 pass 'taosdata'
sql create user sysinfo1 pass 'taosdata'
sql alter user sysinfo0 sysinfo 0
sql alter user sysinfo1 sysinfo 1
11

12
sql create database db
13 14 15 16 17 18 19 20 21 22 23 24
sql use db
sql create table db.stb (ts timestamp, i int) tags (t int)
sql create table db.ctb using db.stb tags (1)
sql create table db.ntb (ts timestamp, i int)
sql insert into db.ctb values (now, 1);
sql insert into db.ntb values (now, 1);
sql select * from db.stb
sql select * from db.ctb
sql select * from db.ntb

sql create database d2
sql GRANT all ON d2.* to sysinfo0;
S
Shengliang Guan 已提交
25 26 27 28 29 30 31 32 33

print user sysinfo0 login
sql close
sql connect sysinfo0

print =============== check oper
sql_error create user u1 pass 'u1'
sql_error drop user sysinfo1
sql_error alter user sysinfo0 pass '1'
34 35 36 37 38 39 40 41 42 43 44 45 46 47
sql_error alter user sysinfo0 enable 0
sql_error alter user sysinfo0 enable 1
sql_error alter user sysinfo1 pass '1'
sql_error alter user sysinfo1 enable 1
sql_error alter user sysinfo1 enable 1
sql_error GRANT read ON db.* to sysinfo0;
sql_error GRANT read ON *.* to sysinfo0;
sql_error REVOKE read ON db.* from sysinfo0;
sql_error REVOKE read ON *.* from sysinfo0;
sql_error GRANT write ON db.* to sysinfo0;
sql_error GRANT write ON *.* to sysinfo0;
sql_error REVOKE write ON db.* from sysinfo0;
sql_error REVOKE write ON *.* from sysinfo0;
sql_error REVOKE write ON *.* from sysinfo0;
S
Shengliang Guan 已提交
48

49 50
sql_error create dnode $hostname port 7200
sql_error drop dnode 1
51 52 53 54 55 56 57
sql_error alter dnode 1 'debugFlag 135'
sql_error alter dnode 1 'dDebugFlag 131'
sql_error alter dnode 1 'resetlog'
sql_error alter dnode 1 'monitor' '1'
sql_error alter dnode 1 'monitor' '0'
sql_error alter dnode 1 'monitor 1'
sql_error alter dnode 1 'monitor 0'
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75

sql_error create qnode on dnode 1
sql_error drop qnode on dnode 1

sql_error create mnode on dnode 1
sql_error drop mnode on dnode 1

sql_error create snode on dnode 1
sql_error drop snode on dnode 1

sql_error redistribute vgroup 2 dnode 1 dnode 2
sql_error balance vgroup

sql_error kill transaction 1
sql_error kill connection 1
sql_error kill query 1

print =============== check db
76 77 78 79
sql_error create database d1
sql_error drop database db
sql_error use db
sql_error alter database db replica 1;
80
sql_error alter database db keep 21
81
sql_error show db.vgroups
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100

sql_error create table db.stb1 (ts timestamp, i int) tags (t int)
sql_error create table db.ctb1 using db.stb1 tags (1)
sql_error create table db.ntb1 (ts timestamp, i int)
sql_error insert into db.ctb values (now, 1);
sql_error insert into db.ntb values (now, 1);
sql_error select * from db.stb
sql_error select * from db.ctb
sql_error select * from db.ntb

sql use d2
sql create table d2.stb2 (ts timestamp, i int) tags (t int)
sql create table d2.ctb2 using d2.stb2 tags (1)
sql create table d2.ntb2 (ts timestamp, i int)
sql insert into d2.ctb2 values (now, 1);
sql insert into d2.ntb2 values (now, 1);
sql select * from d2.stb2
sql select * from d2.ctb2
sql select * from d2.ntb2
101 102

print =============== check show
103
sql_error show users
104
sql_error show cluster
105 106
sql_error select * from information_schema.ins_dnodes
sql_error select * from information_schema.ins_mnodes
107
sql_error show snodes
108
sql_error select * from information_schema.ins_qnodes
109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130
sql_error show dnodes
sql_error show snodes
sql_error show qnodes
sql_error show mnodes
sql_error show db.vgroups
sql_error show db.stables
sql_error show db.tables
sql_error show indexes from stb from db
sql       show databases
sql_error show d2.vgroups
sql       show d2.stables
sql       show d2.tables
sql       show indexes from stb2 from d2
#sql_error show create database db
sql_error show create table db.stb;
sql_error show create table db.ctb;
sql_error show create table db.ntb;
sql       show streams
sql       show consumers
sql       show topics
sql       show subscriptions
sql       show functions
131
sql_error show grants
132 133 134
sql       show queries
sql       show connections
sql       show apps
135 136
sql       show transactions
sql_error show create database d2
137 138 139 140 141
sql       show create table d2.stb2;
sql       show create table d2.ctb2;
sql       show create table d2.ntb2;
sql_error show variables;
sql       show local variables;
142
sql_error show dnode 1 variables;
143
sql_error show variables;
S
Shengliang Guan 已提交
144

145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164

print =============== check information_schema
sql show databases
if $rows != 3 then
  return -1
endi

sql use information_schema;
sql_error select * from information_schema.ins_dnodes
sql_error select * from information_schema.ins_mnodes
sql_error select * from information_schema.ins_modules
sql_error select * from information_schema.ins_qnodes
sql_error select * from information_schema.ins_cluster
sql select * from information_schema.ins_databases
sql select * from information_schema.ins_functions
sql select * from information_schema.ins_indexes
sql select * from information_schema.ins_stables
sql select * from information_schema.ins_tables
sql select * from information_schema.ins_tags
sql select * from information_schema.ins_users
D
dapan1121 已提交
165 166 167
sql select * from information_schema.ins_topics
sql select * from information_schema.ins_subscriptions
sql select * from information_schema.ins_streams
168 169 170 171 172 173 174 175 176 177
sql_error select * from information_schema.ins_grants
sql_error select * from information_schema.ins_vgroups
sql_error select * from information_schema.ins_configs
sql_error select * from information_schema.ins_dnode_variables

print =============== check performance_schema
sql use performance_schema;
sql select * from performance_schema.perf_connections
sql select * from performance_schema.perf_queries
sql select * from performance_schema.perf_consumers
178 179
sql select * from performance_schema.perf_trans
sql select * from performance_schema.perf_apps
180 181

#system sh/exec.sh -n dnode1 -s stop -x SIGINT