目录
安装tbase5.21.6.1数据库
安装包版本:tbase_pgxz-5.21.6.1-i.x86_64.rpm
1、创建用户:
groupadd -g 54320 postgres
useradd -u 54320 -g postgres tbase
passwd tbase
2、创建目录
mkdir -p /u01/tbase/package/
mkdir -p /u01/tbase/data/
chown -R tbase:postgres /u01
chmod -R 775 /u01
3、安装
上传安装包到/u01/tbase/package/
目录下
rpm -ivh /u01/tbase/package/tbase_pgxz-5.21.6.1-i.x86_64.rpm
3、查看安装的目录
ls -l /usr/local/install/tbase_pgxz/
4、创建initdb
查看安装的目录:
find /usr/ -name 'psql'
输出:/usr/local/install/tbase_pgxz/bin/psql
切换tbase用户配置环境变量:
vi ~/.bash_profile
~/.bash_profile:
export PATH=/usr/local/install/tbase_pgxz/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/install/tbase_pgxz/lib:$LD_LIBRARY_PATH
使变量生效:
source ~/.bash_profile
执行创建dn001:
mkdir -p /u01/tbase/data/dn001
initdb --locale=zh_CN.UTF-8 -U tbase -E utf8 -D /u01/tbase/data/dn001 --nodename=dn001 --nodetype=datanode --master_gtm_nodename gtm_1 --master_gtm_ip 127.0.0.1 --master_gtm_port 21000
5、修改配置文件
新增的数据库:/u01/tbase/data/dn001/
5.1、修改postgresql.conf
vi /u01/tbase/data/dn001/postgresql.conf
新增配置:
V506版本:
set_global_snapshot = off
allow_dml_on_datanode = on
use_local_sequence = on
V521版本:
allow_dml_on_datanode = on
is_centralized_mode = on
通用参数:
listen_addresses='*'
port = 5432
max_connections = 2000
max_pool_size = 65535
superuser_reserved_connections = 20
tcp_keepalives_idle = 60
tcp_keepalives_interval = 10
tcp_keepalives_count = 6
##取物理内存的25%
shared_buffers = 16GB
max_prepared_transactions = 20000
work_mem = 4MB
maintenance_work_mem = 1GB
wal_level = logical
max_wal_senders = 64
max_replication_slots = 64
max_logical_replication_workers = 64
wal_keep_segments = 1000
checkpoint_timeout = 10min
max_wal_size = 10GB
min_wal_size = 2GB
checkpoint_completion_target = 0.93
archive_mode = on
archive_command = '/bin/date'
max_standby_archive_delay = 1800s
max_standby_streaming_delay = 1800s
log_destination = 'csvlog'
logging_collector = on
log_directory = 'log'
log_file_mode = 0600
log_truncate_on_rotation = 'on'
log_rotation_age = 120
log_rotation_size = 1024MB
track_activity_query_size = 4096
log_min_duration_statement = 1000
log_checkpoints = on
log_autovacuum_min_duration = 0
log_statement = 'none'
log_timezone = 'PRC'
log_filename = 'postgresql-%A-%H.log'
track_counts = on
autovacuum = on
autovacuum_max_workers = 3
autovacuum_naptime = 1min
autovacuum_vacuum_scale_factor = 0.002
autovacuum_analyze_scale_factor = 0.001
shared_preload_libraries = 'pg_stat_statements,pg_errcode_stat'
pg_stat_statements.max = 1000
pg_stat_statements.track = all
5.2、修改pg_hba.conf
vi /u01/tbase/data/dn001/pg_hba.conf
pg_hba.conf新增如下配置:
## add
host all all 0.0.0.0/0 md5
host all all 127.0.0.1/32 trust
6、启动数据库
pg_ctl -Z datanode -D /u01/tbase/data/dn001/ start
7、创建group
psql -h ipxxxx -p5432 -dpostgres -Utbase
create DEFAULT node group default_group with (dn001);
create sharding group to group default_group;
clean sharding;
8、设置用户的密码
登录:
psql -U tbase -d postgres
登录后执行sql:
ALTER USER tbase WITH PASSWORD 'newPWD';
标签:dn001,log,tbase,max,数据库,tbase5.21,pg,6.1,u01
From: https://www.cnblogs.com/lgxdev/p/18122285