lightdb实例初始化

[lightdb@hs-10-20-30-199 ~]$ lt_initdb -p9876 -D lightdb22.1-data
The files belonging to this database system will be owned by user "lightdb".
This user must also own the server process.

The database cluster will be initialized with locale "C".
The default database encoding has accordingly been set to "SQL_ASCII".
initdb: warning: specified text search configuration "simple" might not match locale "C"
The default text search configuration will be set to "simple".

Data page checksums are disabled.
Data encryption is disabled.

creating directory lightdb22.1-data ... ok
creating subdirectories ... ok
selecting dynamic shared memory implementation ... posix
selecting default max_connections ... 100
selecting default shared_buffers ... 128MB
selecting default time zone ... Asia/Shanghai
creating configuration files ... ok
running bootstrap script ... 2022-05-26 14:56:17.842069T  @  not initialized  00000[2022-05-26 14:56:17 CST] 0 [259431] LOG:  checkpoint starting: shutdown immediate
2022-05-26 14:56:17.843277T  @  not initialized  00000[2022-05-26 14:56:17 CST] 0 [259431] LOG:  checkpoint complete: wrote 211 buffers (1.3%); 0 WAL file(s) added, 0 removed, 0 recycled; write=0.002 s, sync=0.001 s, total=0.002 s; sync files=0, longest=0.000 s, average=0.000 s; distance=725 kB, estimate=725 kB
ok
performing post-bootstrap initialization ... 2022-05-26 14:56:18.173448T  @  not initialized  00000[2022-05-26 14:56:17 CST] 480 [259445] LOG:  checkpoint starting: immediate force wait flush-all
2022-05-26 14:56:18.173448T  @  not initialized  00000[2022-05-26 14:56:17 CST] 480 [259445] STATEMENT:  CREATE DATABASE template0 IS_TEMPLATE = true ALLOW_CONNECTIONS = false;
    
2022-05-26 14:56:18.178813T  @  not initialized  00000[2022-05-26 14:56:17 CST] 480 [259445] LOG:  checkpoint complete: wrote 845 buffers (5.2%); 0 WAL file(s) added, 0 removed, 0 recycled; write=0.005 s, sync=0.001 s, total=0.006 s; sync files=0, longest=0.000 s, average=0.000 s; distance=7606 kB, estimate=7606 kB
2022-05-26 14:56:18.178813T  @  not initialized  00000[2022-05-26 14:56:17 CST] 480 [259445] STATEMENT:  CREATE DATABASE template0 IS_TEMPLATE = true ALLOW_CONNECTIONS = false;
    
2022-05-26 14:56:18.190468T  @  not initialized  00000[2022-05-26 14:56:17 CST] 480 [259445] LOG:  checkpoint starting: immediate force wait
2022-05-26 14:56:18.190468T  @  not initialized  00000[2022-05-26 14:56:17 CST] 480 [259445] STATEMENT:  CREATE DATABASE template0 IS_TEMPLATE = true ALLOW_CONNECTIONS = false;
    
2022-05-26 14:56:18.191312T  @  not initialized  00000[2022-05-26 14:56:17 CST] 480 [259445] LOG:  checkpoint complete: wrote 0 buffers (0.0%); 0 WAL file(s) added, 0 removed, 0 recycled; write=0.001 s, sync=0.000 s, total=0.001 s; sync files=0, longest=0.000 s, average=0.000 s; distance=0 kB, estimate=6845 kB
2022-05-26 14:56:18.191312T  @  not initialized  00000[2022-05-26 14:56:17 CST] 480 [259445] STATEMENT:  CREATE DATABASE template0 IS_TEMPLATE = true ALLOW_CONNECTIONS = false;
    
2022-05-26 14:56:18.191902T  @  not initialized  00000[2022-05-26 14:56:17 CST] 485 [259445] LOG:  checkpoint starting: immediate force wait flush-all
2022-05-26 14:56:18.191902T  @  not initialized  00000[2022-05-26 14:56:17 CST] 485 [259445] STATEMENT:  CREATE DATABASE postgres;
    
2022-05-26 14:56:18.192810T  @  not initialized  00000[2022-05-26 14:56:17 CST] 485 [259445] LOG:  checkpoint complete: wrote 11 buffers (0.1%); 0 WAL file(s) added, 0 removed, 0 recycled; write=0.001 s, sync=0.001 s, total=0.001 s; sync files=0, longest=0.000 s, average=0.000 s; distance=42 kB, estimate=6165 kB
2022-05-26 14:56:18.192810T  @  not initialized  00000[2022-05-26 14:56:17 CST] 485 [259445] STATEMENT:  CREATE DATABASE postgres;
    
2022-05-26 14:56:18.202844T  @  not initialized  00000[2022-05-26 14:56:17 CST] 485 [259445] LOG:  checkpoint starting: immediate force wait
2022-05-26 14:56:18.202844T  @  not initialized  00000[2022-05-26 14:56:17 CST] 485 [259445] STATEMENT:  CREATE DATABASE postgres;
    
2022-05-26 14:56:18.203554T  @  not initialized  00000[2022-05-26 14:56:17 CST] 485 [259445] LOG:  checkpoint complete: wrote 0 buffers (0.0%); 0 WAL file(s) added, 0 removed, 0 recycled; write=0.001 s, sync=0.000 s, total=0.001 s; sync files=0, longest=0.000 s, average=0.000 s; distance=0 kB, estimate=5549 kB
2022-05-26 14:56:18.203554T  @  not initialized  00000[2022-05-26 14:56:17 CST] 485 [259445] STATEMENT:  CREATE DATABASE postgres;
    
2022-05-26 14:56:18.203657T  @  not initialized  00000[2022-05-26 14:56:17 CST] 0 [259445] LOG:  checkpoint starting: shutdown immediate
2022-05-26 14:56:18.203954T  @  not initialized  00000[2022-05-26 14:56:17 CST] 0 [259445] LOG:  checkpoint complete: wrote 3 buffers (0.0%); 0 WAL file(s) added, 0 removed, 0 recycled; write=0.001 s, sync=0.000 s, total=0.001 s; sync files=0, longest=0.000 s, average=0.000 s; distance=1 kB, estimate=4994 kB
ok
syncing data to disk ... ok

initdb: warning: enabling "trust" authentication for local connections
You can change this by editing pg_hba.conf or using the option -A, or
--auth-local and --auth-host, the next time you run initdb.

Success. You can now start the database server using:

    /home/lightdb/base0524/lightdb-x/13.3-22.1/bin/lt_ctl -D lightdb22.1-data -l logfile start

Notice: It is recommended to use lt_initdb, otherwise some functions are unavailable.
        If you are run initdb directly, you can using like:
            $PGHOME/scripts/5_lightdb_modify_para.sh $PGHOME $PGDATA OLTP/OLAP shared_buffers(MB) effective_cache_size(MB) $PGPORT
            $PGHOME/scripts/6_lightdb_start.sh $PGHOME $PGDATA (if not started)
            $PGHOME/scripts/8_lightdb_create_extension.sh $PGHOME $PGPORT
        for optimised performance.

INFO modify effective_cache_size successfully
INFO modify wal_buffers successfully
INFO modify max_wal_size successfully
INFO modify min_wal_size successfully
INFO modify random_page_cost successfully
INFO modify max_parallel_maintenance_workers successfully
INFO modify default_statistics_target successfully
INFO modify min_parallel_index_scan_size successfully
INFO modify transform_null_equals successfully
INFO modify max_worker_processes successfully
INFO modify max_parallel_workers successfully
INFO modify logging_collector successfully
INFO modify enable_partitionwise_aggregate successfully
INFO modify shared_buffers successfully
INFO modify pg_stat_statements.track_planning successfully
INFO modify bgwriter_lru_maxpages successfully
INFO modify max_slot_wal_keep_size successfully
INFO modify parallel_setup_cost successfully
INFO modify shared_preload_libraries successfully
INFO modify track_io_timing successfully
INFO modify log_min_messages successfully
INFO modify temp_buffers successfully
INFO modify commit_siblings successfully
INFO modify canopy.shard_count successfully
INFO modify cron.database_name successfully
INFO modify min_parallel_table_scan_size successfully
CREATE SCHEMA
GRANT
CREATE EXTENSION
CREATE EXTENSION
CREATE EXTENSION
CREATE EXTENSION
CREATE EXTENSION
CREATE EXTENSION
CREATE EXTENSION
CREATE EXTENSION
CREATE EXTENSION
CREATE EXTENSION
CREATE EXTENSION
CREATE EXTENSION
CREATE EXTENSION
CREATE EXTENSION
CREATE EXTENSION
CREATE EXTENSION
CREATE EXTENSION
CREATE EXTENSION
CREATE TEXT SEARCH CONFIGURATION
ALTER TEXT SEARCH CONFIGURATION
ALTER TEXT SEARCH DICTIONARY
CREATE EXTENSION
CREATE EXTENSION
CREATE EXTENSION
CREATE EXTENSION
CREATE SCHEMA
GRANT
CREATE EXTENSION
CREATE EXTENSION
CREATE EXTENSION
CREATE EXTENSION
CREATE EXTENSION
CREATE EXTENSION
CREATE EXTENSION
CREATE EXTENSION
CREATE EXTENSION
CREATE EXTENSION
CREATE EXTENSION
CREATE EXTENSION
CREATE EXTENSION
CREATE EXTENSION
CREATE EXTENSION
CREATE EXTENSION
CREATE EXTENSION
CREATE EXTENSION
CREATE TEXT SEARCH CONFIGURATION
ALTER TEXT SEARCH CONFIGURATION
ALTER TEXT SEARCH DICTIONARY
CREATE EXTENSION
CREATE EXTENSION
CREATE EXTENSION
CREATE EXTENSION
CREATE EXTENSION
CREATE EXTENSION
CREATE EXTENSION
CREATE EXTENSION
 schedule 
----------
        1
(1 row)

 schedule 
----------
        2
(1 row)

 schedule 
----------
        3
(1 row)

 schedule 
----------
        4
(1 row)

 schedule 
----------
        5
(1 row)

waiting for server to shut down.... done
server stopped
lt_initdb success
[lightdb@hs-10-20-30-199 ~]$ lt_ctl -D lightdb22.1-data start
waiting for server to start....2022-05-26 14:58:12.819141T  @  postmaster  00000[2022-05-26 14:58:12 CST] 0 [1040] LOG:  LightDB autoprewarm: prewarm dbnum=0
2022-05-26 14:58:12.820401T  @  postmaster  00000[2022-05-26 14:58:12 CST] 0 [1040] LOG:  pgaudit extension initialized
2022-05-26 14:58:13.542666T  @  postmaster  00000[2022-05-26 14:58:12 CST] 0 [1040] LOG:  redirecting log output to logging collector process
2022-05-26 14:58:13.542666T  @  postmaster  00000[2022-05-26 14:58:12 CST] 0 [1040] HINT:  Future log output will appear in directory "log".
 done
server started
[lightdb@hs-10-20-30-199 ~]$ ltsql -p9876      
ltsql (13.3-22.2)
Type "help" for help.

lightdb@postgres=# show %port%;
                  name                  | setting |                      description                      
----------------------------------------+---------+-------------------------------------------------------
 jit_debugging_support                  | off     | Register JIT compiled function with debugger.
 jit_profiling_support                  | off     | Register JIT compiled function with perf profiler.
 port                                   | 9876    | Sets the TCP port the server listens on.
 ssl_passphrase_command_supports_reload | off     | Also use ssl_passphrase_command during server reload.
(4 rows)

 lt_initdb走的是bootstrap模式的postgres进程启动,通过直接读取postgres.bki文件(由genbki.pl在编译的时候生成,虽然维护麻烦了点,但是避免了头文件和初始化数据硬编码两边需要同时维护的麻烦)创建执行SQL所需的所有系统目录,所以创建bki模式的对象不会插入数据字典。

也可以直接创建bki模式的表,只要建表的时候指定bootstrap子句即可。

注:虽然genbki使用pl写的,从pg 9.0 开始官方文档第一次提及,但是在2020年之前,python完全不可和perl比拟,所以你可以认为每个大型系统至今为止选型在当初一定是最佳的,同时当下也还有开发可以维护,否则它就会被替换掉。比如pg16计划替换autoconf。

posted @ 2022-05-26 15:04  zhjh256  阅读(67)  评论(0编辑  收藏  举报