This content originally appeared on DEV Community and was authored by Özcan Kara
ssh root@*EIP*
wget https://sandbox-expriment-files.obs.cn-north-1.myhuaweicloud.com:443/20220525/GaussDB_opengauss_client_tools.zip
unzip GaussDB_opengauss_client_tools.zip
cd GaussDB_opengauss_client_tools/Euler2.8_arm_64/
tar -xvf GaussDB-Kernel-V500R001C20-EULER-64bit-gsql.tar.gz
source gsql_env.sh
GaussDB veritabanına bağlanmak için gsql kullanın. Komutta -h, GaussDB veritabanının dağıtıldığı ECS'nin özel IP adresini belirtir, -d veritabanı adını belirtir, -U kullanıcı adını belirtir, -p bağlantı noktasını belirtir ve -W parolayı belirtir.
gsql -h *Private IP address* -U root -d postgres -p 8000 -W yourpassword -r
\q
gsql --help
\copyright
\h
\help CREATE DATABASE
\?
gsql -h *Private IP address* -U root -d postgres -p 8000 -W yourpassword -l
gsql -V
gsql -h *Private IP address* -U root -d postgres -p 8000 -W yourpassword -q
create table t_test (firstcol int);
insert into t_test values(200);
select * from t_test;
\q
gsql -h *Private IP address* -U root -d postgres -p 8000 -W yourpassword -S
select * from t_test;
select * from t_test
\q
gsql -h *Private IP address* -U root -d postgres -p 8000 -W yourpassword -r
select * from t_test;
Terminali açın ve aşağıdaki komutu kullanarak ECS'ye bağlanın:
ssh username@ecs-ip-address
wget https://example.com/path/to/GaussDB_opengauss_client_tools.zip
unzip GaussDB_opengauss_client_tools.zip -d /path/to/destination
cd /path/to/destination/EulerOS_X86_64
cd /path/to/destination/EulerOS_X86_64
./gsql -d hccdp_db -h 192.168.0.183 -p 8000 -U hccdp
systemctl status gaussdb
systemctl start gaussdb
gsql İstemci Araçlarını Ayıklama ve Çalıştırma
wget https://example.com/path/to/GaussDB_opengauss_client_tools.zip
unzip GaussDB_opengauss_client_tools.zip -d /path/to/destination
cd /path/to/destination/EulerOS_X86_64
./gsql -d hccdp_db -h 192.168.0.183 -p 8000 -U hccdp
gsql istemcisinin bulunduğu dizine geçin.
cd /path/to/GaussDB_opengauss_client_tools/EulerOS_X86_64
GaussDB'ye bağlanın
./gsql -h 192.168.0.183 -U root -d postgres -p 8000 -W yourpassword -r
Burada 192.168.0.183 GaussDB'nin IP adresi, root kullanıcı adı, postgres veritabanı adı, 8000 port numarası ve yourpassword şifrenizdir.
Aşağıdaki komutu kullanarak GaussDB'ye bağlanın:
./gsql -d hccdp_db -h 192.168.0.183 -p 8000 -U hccdp
Burada hccdp_db veritabanı adı, 192.168.0.183 GaussDB'nin IP adresi, 8000 port numarası ve hccdp kullanıcı adıdır.o
CREATE SCHEMA hccdp;
CREATE TABLE hccdp.nation (
N_NATIONKEY INT PRIMARY KEY,
N_NAME VARCHAR(25),
N_REGIONKEY INT,
N_COMMENT VARCHAR(152)
);
\copy hccdp.nation FROM '/path/to/nation.csv' WITH (FORMAT csv, HEADER true);
\copy hccdp.part FROM '/path/to/part.csv' WITH (FORMAT csv, HEADER true);
\copy hccdp.supplier FROM '/path/to/supplier.csv' WITH (FORMAT csv, HEADER true);
\copy hccdp.partsupp FROM '/path/to/partsupp.csv' WITH (FORMAT csv, HEADER true);
\copy hccdp.orders FROM '/path/to/orders.csv' WITH (FORMAT csv, HEADER true);
\copy hccdp.lineitem FROM '/path/to/lineitem.csv' WITH (FORMAT csv, HEADER true);
Veri sorgulama işlemi için örnek bir SQL komutu:
SELECT * FROM hccdp.nation;
Stored procedure oluşturma:
CREATE OR REPLACE PROCEDURE proc_nation() AS $$
BEGIN
-- Buraya prosedür içeriği gelecek
END;
$$ LANGUAGE plpgsql;
This content originally appeared on DEV Community and was authored by Özcan Kara
Özcan Kara | Sciencx (2024-07-12T01:30:46+00:00) Demo project. Retrieved from https://www.scien.cx/2024/07/12/demo-project/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.