#創建數據庫tsdb create database "tsdb" #顯示所有的數據庫 show databases #刪除數據庫tsdb drop database "tsdb" #使用數據庫tsdb use tsdb #顯示該數據庫中所有的表 show measurements #創建表,直接在插入數據的時候指定表名(test)表名 insert test,host=127.0.0.1,monitor_name=test count=1 #查詢表test select * from test #刪除表test drop measurement "test" #查看數據庫保存策略 show retention policies on "db" #創建保存策略 #rp:策略名 #db:具體的數據庫名 #1w:保存1周,1周之前的數據刪除,還有h(小時),d(天),w(星期) #replication 1:副本個數,一般為1就可以了 #default:設置為默認策略 create retention policy "rp" on "db" duration 1w replication 1 default #修改保存策略 alter retention policy "rp" on "db" duration 30d default # 刪除策略 drop retention policy "rp" #顯示用戶 show users #創建用戶 create user "username" with password 'password' #創建管理員權限用戶 create user "username" with password 'password' with all privileges #刪除用戶 drop user "username"