File Hierarchy

    CA FHS

    Pigsty’s self-signed CA is located on directory under pigsty home.

    YOU HAVE TO SECURE THE CA KEY PROPERLY: files/pki/ca/ca.key, which is generated by the ca role during install.yml or infra.yml.

    1. # pigsty/files/pki
    2. # ^-----@ca # self-signed CA key & cert
    3. # ^-----@ca.key # VERY IMPORTANT: keep it secret
    4. # ^-----@ca.crt # VERY IMPORTANT: trusted everywhere
    5. # ^-----@csr # signing request csr
    6. # ^-----@misc # misc certs, issued certs
    7. # ^-----@etcd # etcd server certs
    8. # ^-----@minio # minio server certs
    9. # ^-----@nginx # nginx SSL certs
    10. # ^-----@infra # infra client certs
    11. # ^-----@pgsql # pgsql server certs

    The prometheus bin / rules are located on files/prometheus/ directory under pigsty home.

    While the main config file is located on and rendered to /etc/prometheus/prometheus.yml on infra nodes.

    1. #------------------------------------------------------------------------------
    2. # Config FHS
    3. #------------------------------------------------------------------------------
    4. # /etc/prometheus/
    5. # ^-----prometheus.yml # prometheus main config file
    6. # ^-----@bin # util scripts: check,reload,status,new
    7. # ^-----@rules # record & alerting rules definition
    8. # ^-----infra.yml # infra rules & alert
    9. # ^-----node.yml # node rules & alert
    10. # ^-----pgsql.yml # pgsql rules & alert
    11. # ^-----redis.yml # redis rules & alert
    12. # ^-----etcd.yml # etcd rules & alert
    13. # ^-----@targets # file based service discovery targets definition
    14. # ^-----@node # nodes static targets definition
    15. # ^-----@etcd # etcd static targets definition
    16. # ^-----@minio # minio static targets definition
    17. # ^-----@ping # blackbox ping targets definition
    18. # ^-----@pgsql # pgsql static targets definition
    19. # ^-----@redis # redis static targets definition
    20. # ^-----@..... # other targets
    21. # /etc/alertmanager.yml # alertmanager main config file
    22. # /etc/blackbox.yml # blackbox exporter main config file
    23. #------------------------------------------------------------------------------

    Postgres FHS

    • : Postgres default user’s home dir, default is /var/lib/pgsql.
    • pg_bin_dir: Postgres binary dir, defaults to /usr/pgsql/bin/.
    • : Postgres database dir, default is /pg/data.
    • pg_fs_main: Postgres main data disk mount point, default is /data.
    • : Postgres backup disk mount point, default is /data/backups (used when using local backup repo).

    Data FHS

    1. # basic
    2. {{ pg_fs_main }} /data # top level data directory, usually a SSD mountpoint
    3. {{ pg_dir_main }} /data/postgres # contains postgres data
    4. {{ pg_cluster_dir }} /data/postgres/pg-test-15 # contains cluster `pg-test` data (of version 13)
    5. /data/postgres/pg-test-15/bin # bin scripts
    6. /data/postgres/pg-test-15/log # logs: postgres/pgbouncer/patroni/pgbackrest
    7. /data/postgres/pg-test-15/tmp # tmp, sql files, rendered results
    8. /data/postgres/pg-test-15/cert # postgres server certificates
    9. /data/postgres/pg-test-15/conf # patroni config, links to related config
    10. /data/postgres/pg-test-15/data # main data directory
    11. /data/postgres/pg-test-15/stat # stats information, summary, log report
    12. /data/postgres/pg-test-15/change # changing records
    13. /data/postgres/pg-test-15/backup # soft link to backup dir
    14. {{ pg_fs_bkup }} /data/backups # could be a cheap & large HDD mountpoint
    15. /var/backups/postgres/pg-test-15/backup # local backup repo path
    16. # links
    17. /pg -> /data/postgres/pg-test-15 # pg root link
    18. /pg/data -> /data/postgres/pg-test-15/data # real data dir
    19. /pg/backup -> /var/backups/postgres/pg-test-15/backup # base backup

    Binary FHS

    On EL releases, the default path for PostgreSQL bin is:

    1. /usr/pgsql-${pg_version}/

    Pigsty will create a softlink /usr/pgsql to the currently installed version specified by pg_version.

    1. export PATH="/usr/pgsql/bin:/pg/bin:$PATH"
    2. export PGHOME=/usr/pgsql
    3. export PGDATA=/pg/data

    Pgbouncer is run using the Postgres user, and the config file is located in /etc/pgbouncer. The config file includes.

    • pgbouncer.ini: pgbouncer main config
    • database.txt: pgbouncer database list
    • userlist.txt: pgbouncer user list
    • useropts.txt: pgbouncer user options (user-level parameter overrides)
    • pgb_hba.conf: lists the access privileges of the connection pool users

    Redis FHS

    Pigsty provides essential support for Redis deployment and monitoring.

    Redis binaries are installed in /bin/ using RPM-packages or copied binaries, including:

    1. redis-server
    2. redis-server
    3. redis-cli
    4. redis-sentinel
    5. redis-check-rdb
    6. redis-check-aof
    7. redis-benchmark

    For a Redis instance named redis-test-1-6379, the resources associated with it are shown below: