【发布时间】:2021-04-15 22:33:09
【问题描述】:
我已经安装了 YugabyteDB 并使用这个命令创建了本地集群
./bin/yugabyted start
数据库已启动并运行,然后我通过运行以下命令创建键空间和表
cqlsh -f resources/IoTData.cql
IoTData.cql 包含以下内容:
// Create keyspace
如果 TrafficKeySpace 不存在则创建密钥空间;
// Create keyspace
CREATE KEYSPACE IF NOT EXISTS TrafficKeySpace;
// Create tables
CREATE TABLE IF NOT EXISTS TrafficKeySpace.Origin_Table (vehicleId text, routeId text, vehicleType text, longitude text, latitude text, timeStamp timestamp, speed double, fuelLevel double, PRIMARY KEY ((vehicleId), timeStamp)) WITH default_time_to_live = 3600;
CREATE TABLE IF NOT EXISTS TrafficKeySpace.Total_Traffic (routeId text, vehicleType text, totalCount bigint, timeStamp timestamp, recordDate text, PRIMARY KEY (routeId, recordDate, vehicleType));
CREATE TABLE IF NOT EXISTS TrafficKeySpace.Window_Traffic (routeId text, vehicleType text, totalCount bigint, timeStamp timestamp, recordDate text, PRIMARY KEY (routeId, recordDate, vehicleType));
CREATE TABLE IF NOT EXISTS TrafficKeySpace.Poi_Traffic(vehicleid text, vehicletype text, distance bigint, timeStamp timestamp, PRIMARY KEY (vehicleid));
// Select from the tables
SELECT count(*) FROM TrafficKeySpace.Origin_Table;
SELECT count(*) FROM TrafficKeySpace.Total_Traffic;
SELECT count(*) FROM TrafficKeySpace.Window_Traffic;
SELECT count(*) FROM TrafficKeySpace.Poi_Traffic;
// Truncate the tables
TRUNCATE TABLE TrafficKeySpace.Origin_Table;
TRUNCATE TABLE TrafficKeySpace.Total_Traffic;
TRUNCATE TABLE TrafficKeySpace.Window_Traffic;
TRUNCATE TABLE TrafficKeySpace.Poi_Traffic;
YB-Master Admin UI 显示表已创建,但是当我使用 pgAdmin 客户端浏览该数据库中的数据时,它不会显示这些表。 为了连接到 yugabyteDB,我使用了这些属性:
数据库:yugabyte 用户:yugabyte 密码:yugabyte 主机:本地主机 端口:5433
为什么客户端不显示我创建的表
【问题讨论】:
标签: postgresql pgadmin yugabyte-db