sorintlab / stolon

PostgreSQL cloud native High Availability and more.
https://talk.stolon.io
Apache License 2.0
4.62k stars 443 forks source link

stolon (keeper) does not work if started as root user #877

Open chipitsine opened 2 years ago

chipitsine commented 2 years ago

What happened:

I followed this guide. I started ./bin/stolon-keeper as root, it ended with

# id
uid=0(root) gid=0(root) groups=0(root) context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023
[root@stolon1 stolon-v0.17.0-linux-amd64]#
[root@stolon1 stolon-v0.17.0-linux-amd64]# ./bin/stolon-keeper --pg-bin-path /usr/pgsql-12/bin --store-endpoints=http://10.0.0.10:2379,http://10.0.0.11:2379,http://10. 0.0.12:2379 --cluster-name stolon-cluster --store-backend=etcdv3 --uid postgres --data-dir /var/lib/pgsql/12/data --pg-su-password=supassword --pg-repl-username=replus er --pg-repl-password=replpassword --pg-listen-address=127.0.0.1
2022-06-03T10:30:59.115Z        WARN    cmd/keeper.go:1987      provided --pg-listen-address "127.0.0.1" is a loopback ip. This will be advertized to the other compone nts and communication will fail if they are on different hosts
2022-06-03T10:30:59.115Z        INFO    cmd/keeper.go:2091      exclusive lock on data dir taken
2022-06-03T10:30:59.117Z        INFO    cmd/keeper.go:569       keeper uid      {"uid": "postgres"}
2022-06-03T10:30:59.128Z        INFO    cmd/keeper.go:1080      our keeper data is not available, waiting for it to appear
2022-06-03T10:31:04.132Z        INFO    cmd/keeper.go:1080      our keeper data is not available, waiting for it to appear
2022-06-03T10:31:09.136Z        INFO    cmd/keeper.go:1141      current db UID different than cluster data db UID       {"db": "", "cdDB": "e7009d16"}
2022-06-03T10:31:09.136Z        INFO    cmd/keeper.go:1148      initializing the database cluster
2022-06-03T10:31:09.153Z        ERROR   cmd/keeper.go:1174      failed to stop pg instance      {"error": "cannot get instance state: exit status 1"}
2022-06-03T10:31:14.157Z        ERROR   cmd/keeper.go:1110      db failed to initialize or resync
2022-06-03T10:31:14.160Z        ERROR   cmd/keeper.go:1113      failed to stop pg instance      {"error": "cannot get instance state: exit status 1"}
2022-06-03T10:31:19.163Z        ERROR   cmd/keeper.go:1110      db failed to initialize or resync
2022-06-03T10:31:19.165Z        ERROR   cmd/keeper.go:1113      failed to stop pg instance      {"error": "cannot get instance state: exit status 1"}
2022-06-03T10:31:24.168Z        ERROR   cmd/keeper.go:1110      db failed to initialize or resync
2022-06-03T10:31:24.170Z        ERROR   cmd/keeper.go:1113      failed to stop pg instance      {"error": "cannot get instance state: exit status 1"}
...

What you expected to happen:

either stolon should start or report appropriate issue

How to reproduce it (as minimally and precisely as possible):

start stolon keeper as root

Anything else we need to know?:

Earth is not flat

Environment: