-
Stolon에서 locale, encoding 설정카테고리 없음 2019. 12. 3. 08:49
개요
Stolon의 locale, encoding, dataChecksums 설정에 대해 알아본다.
관련 문서는 https://github.com/sorintlab/stolon/blob/master/doc/cluster_spec.md에 있다.
해당 내용만 발췌하면 다음과 같다.
NewConfig Name Description Required Type Default locale Defines the locale to be used when initializing a new postgres db cluster (initdb --locale option). This option isn't validated by stolon so initdb will fail if a wrong option is provided. no string encoding Defines the encoding to be used when initializing a new postgres db cluster (initdb --encoding option). This option isn't validated by stolon so initdb will fail if a wrong option is provided. no string dataChecksums Defines if data checksums should be enabled when initializing a new postgres db cluster (initdb --data-checksums option). This option isn't validated by stolon so initdb will fail if a wrong option is provided. no bool locale, encoding를 설정하지 않으면 운영체제의 locale 정보를 가져와서 Stolon이 자동으로 설정한다. 가져오지 못하는 경우에는 SQL_ASCII, C로 각각 설정된다.
설정
Stolon에서 locale(collate), encoding를 변경하는 방법은 다음과 같다.
$ stolonctl init '{ "initMode": "new", "newConfig": { "locale": "en_US.UTF-8", "encoding": "UTF8" }}'
위와 같이 하면 다음과 같은 결과를 확인할 수 있다.
... 2019-12-02T08:45:22.095Z INFO cmd/keeper.go:1053 initializing the database cluster The files belonging to this database system will be owned by user "agens". This user must also own the server process. The database cluster will be initialized with locale "en_US.UTF-8". The default text search configuration will be set to "english". Data page checksums are disabled. creating directory /home/agens/stolon_0_12_0/agens0/postgres ... ok creating subdirectories ... ok selecting default max_connections ... 100 selecting default shared_buffers ... 128MB selecting dynamic shared memory implementation ... posix creating configuration files ... ok running bootstrap script ... ok performing post-bootstrap initialization ... ok syncing data to disk ... 2019-12-02T08:45:24.587Z ERROR cmd/keeper.go:650 cannot get configured pg parameters {"error": "dial unix /tmp/.s.PGSQL.5532: connect: connection refused"} ok 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/agens/agensgraph/bin/ag_ctl -D /home/agens/stolon_0_12_0/agens0/postgres -l logfile start 2019-12-02T08:45:26.280Z INFO postgresql/postgresql.go:287 starting database ...
locale: ko_KR.UTF-8 적용 예
... 2019-12-02T08:31:52.167Z INFO cmd/keeper.go:1053 initializing the database cluster The files belonging to this database system will be owned by user "agens". This user must also own the server process. The database cluster will be initialized with locale "ko_KR.UTF-8". initdb: could not find suitable text search configuration for locale "ko_KR.UTF-8" The default text search configuration will be set to "simple". Data page checksums are disabled. creating directory /home/agens/stolon_0_12_0/agens0/postgres ... ok creating subdirectories ... ok selecting default max_connections ... 100 selecting default shared_buffers ... 128MB selecting dynamic shared memory implementation ... posix creating configuration files ... ok running bootstrap script ... ok performing post-bootstrap initialization ... ok syncing data to disk ... 2019-12-02T08:31:54.645Z ERROR cmd/keeper.go:650 cannot get configured pg parameters {"error": "dial unix /tmp/.s.PGSQL.5532: connect: connection refused"} 2019-12-02T08:31:57.146Z ERROR cmd/keeper.go:650 cannot get configured pg parameters {"error": "dial unix /tmp/.s.PGSQL.5532: connect: connection refused"} ok 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/agens/agensgraph/bin/ag_ctl -D /home/agens/stolon_0_12_0/agens0/postgres -l logfile start 2019-12-02T08:31:57.718Z INFO postgresql/postgresql.go:287 starting database ...
위 내용의 중간에서 "initdb: could not find suitable text search configuration for locale "ko_KR.UTF-8"" 와 같은 내용이 출력되지만 \l 명령시 Collate은 "ko_KR.UTF-8" 설정된다.