返回首页

gbase数据、南大通用产品文档:GBase8a指定导出的文件个数

更新日期:2024年09月11日

在SELECT INTO OUTFILE 语句中可以指定FILECOUNT 参数指定并行导出的文
件个数,
文件命名方式为file_title+suffix+file_ext 形式,
其中file_title 是file_name
中’.’之前的部分,file_ext 为file_name 中’.’之后的部分(包含’.’)suffix
为自动追加的文件名后缀,第一个文件名后缀是“_1”,以此类推。
示例
示例1:指定导出的文件个数FILECOUNT(本地导出时本参数不起作用)。
示例中所用的表及数据:
DROP TABLE IF EXISTS test;
CREATE TABLE test (ps_partkey bigint,ps_suppkey bigint,ps_availqty
bigint,ps_supplycost decimal(15,2),ps_comment varchar(200));
gbase>select * from test;
+------+------+------+--------+-------------------------------------+
| a
| b
| c
| d
| e
|
+------+------+------+--------+-------------------------------------
|
1 |
2 | 3325 | 771.64 | , even theodolites. regular
|
|
1 | 2502 | 8076 | 993.49 | ven ideas. quickly
|
|
1 | 5002 | 3956 | 337.09 | after the fluffily ironic
|
|
1 | 7502 | 4069 | 357.84 | al, regular dependencies
|
|
2 |
3 | 8895 | 378.49 | nic accounts. final accounts
|
|
2 | 2503 | 4969 | 915.27 | ptotes. quickly pending
|
|
2 | 5003 | 8539 | 438.37 | blithely bold ideas. furiously
|
|
2 | 7503 | 3025 | 306.39 | olites. deposits wake carefully
|
|
3 |
4 | 4651 | 920.92 | ilent foxes affix furiously quickly |
|
3 | 2504 | 4093 | 498.13 | ending dependencies haggle fluffily |
|
3 | 5004 | 3917 | 645.40 | of the blithely regular theodolites |
|
3 | 7504 | 9942 | 191.92 | unusual, ironic foxes according
|
|
4 |
5 | 1339 | 113.97 | carefully unusual ideas. packages
|
|
4 | 2505 | 6377 | 591.18 | ly final courts haggle
|
|
4 | 5005 | 2694 |


在GBase 8c 上建立外表时,不会同步在远端的GBase 8c 上建表,需要自己利用客户端
连接远端GBase 8c 建表。

执行CREATE USER MAPPING 时使用的GBase 8c 用户需要有远程连接GBase 8c 及对
表相关操作的权限。使用外表前,可以在本地机器上,使用gsql 的客户端,使用对应
的用户名密码确认能否成功连接远端GBase 8c 并进行操作。

示例
以GBase 8c 分布式为示例,则需指定-Z 参数
示例1:修改数据库允许的最大连接数为800。修改后需要重启数据库才能生效。
[gbase@gbasehost ~]$ gs_guc set-Z coordinator -D /home/gbase/data/coord/cn1 -c
"max_connections = 800"
The gs_guc run with the following arguments: [gs_guc -Z coordinator -D
/home/gbase/data/coord/cn1/ -c max_connections = 800 set].
expected instance path: [/home/gbase/data/coord/cn1/postgresql.conf]
gs_guc reload: max_connections=800:
[/home/gbase/data/coord/cn1/postgresql.conf]
server signaled
Total instances: 1.
Success to perform gs_guc!
示例2:将已设置的数据库允许的最大连接数值修改为默认值。修改后需要重启数据库
才能生效。
[gbase@gbasehost ~]$ gs_guc set-Z coordinator -D /home/gbase/data/coord/cn1 -c
"max_connections "
The gs_guc run with the following arguments: [gs_guc -Z coordinator -D
/home/gbase/data/coord/cn1 -c max_connections
set].
expected instance path: [/home/gbase/data/coord/cn1/postgresql.conf]
gs_guc reload: #max_connections: [/home/gbase/data/coord/cn1/postgresql.conf]

GBase 8c 工具参考手册
南大通用数据技术股份有限公司
164
server signaled
Total instances: 1.
Success to perform gs_guc!
示例3:设置客户端认证策略。
[gbase@gbasehost ~]$ gs_guc set -Z coordinator -N all -I all -h "host replication
testuser 10.252.95.191/32 sha256"
The gs_guc run with the following arguments: [gs_guc -Z coordinator -N all -I all
-h host replication testuser 10.252.95.191/32 sha256 set ].
Begin to perform the total nodes: 1.
Popen count is 1, Popen success count is 1, Popen failure count is 0.
Begin to perform gs_guc for coordinators.
Command count is 1, Command success count is 1, Command failure count is 0.
Total instances: 1.
ALL: Success to perform gs_guc!
示例4:注释清理已经设置的客户端认证策略。
[gbase@gbasehost ~]$ gs_guc set -Z coordinator -N all -I all -h "host replication
testuser 10.252.95.191/32"
The gs_guc run with the following arguments: [gs_guc -Z coordinator -N all -I all
-h host replication testuser 10.252.95.191/32 set ].
Begin to perform the total nodes: 1.
Popen count is 1, Popen success count is 1, Popen failure count is 0.
Begin to perform gs_guc for coordinators.
Command count is 1, Command success count is 1, Command failure count is 0.
Total instances: 1.
ALL: Success to perform gs_guc!
示例5:加密服务器端存储用户密码的明文,避免密码泄露。
[gbase@gbasehost ~]$ gs_guc encrypt -K GBase@123 -D /home/gbase/data
The gs_guc run with the following arguments: [gs_guc -K ******** -D
/home/gbase/data encrypt ].
gs_guc encrypt -K ***
示例6:检查GBase 8c 中各个实例的参数配置情况。

GBase 8c 工具参考手册
南大通用数据技术股份有限公司
165
[gbase@gbasehost ~]$ gs_guc check -Z datanode -D /home/gbase/data/dn1/dn1_1 -c
"max_connections"
The gs_guc run with the following arguments: [gs_guc -Z datanode -D
/home/gbase/data/dn1/dn1_1 -c max_connections check ].
expected guc information: gbase: max_connections=NULL:
[/home/gbase/data/dn1/dn1_1/postgresql.conf]
gs_guc check: gbase: max_connections=800:
[/home/gbase/data/dn1/dn1_1/postgresql.conf]
Total GUC values: 1.
The value of parameter max_connections is same on all instances.
max_connections=800
示例7:通过用户输入的明文密码,生自定义的test.key.cipher 和test.key.rand 文件。
[gbase@gbasehost ~]$ gs_guc generate -S GBase@123 -D /home/gbase/data/ -o test
The gs_guc run with the following arguments: [gs_guc -S ******** -D
/home/gbase/data/ -o test generate ].
gs_guc generate -S ***