次のリビジョン | 前のリビジョン |
linux:podman:postgres [2024/05/31 11:19] – 作成 ともやん | linux:podman:postgres [2024/06/03 11:16] (現在) – [PostgreSQL] ともやん |
---|
====== PostgreSQL ====== | ====== pgAdmin - PostgreSQL Tools ====== |
| <WRAP zoomimg w600 x1_3> |
| {{:linux:podman:pgadmin_000.png|pgAdmin 000}} |
| </WRAP> |
| 公式: [[https://www.pgadmin.org/|pgAdmin - PostgreSQL Tools]]\\ |
| ソースコード: [[git>pgadmin-org/pgadmin4/|pgadmin-org/pgadmin4: pgAdmin is the most popular and feature rich Open Source administration and development platform for PostgreSQL, the most advanced Open Source database in the world.]]\\ |
| |
| ===== podman compose の設定 ===== |
| <WRAP color_term> |
| <WRAP color_command><html><pre> |
| <font color="#0087FF"><b>$</b></font> <font color="#26A269">nano</font> <u style="text-decoration-style:solid">d</u><font color="#999999"><u style="text-decoration-style:solid">ocker-compose.yml</u></font> |
| </pre></html></WRAP> |
| <WRAP color_mincode><html><pre> |
| <font color="#F92672">services</font><font color="#F8F8F2">:</font> |
| <font color="#F8F8F2"> </font><font color="#F92672">postgres</font><font color="#F8F8F2">:</font> |
| <font color="#F8F8F2"> </font><font color="#F92672">image</font><font color="#F8F8F2">: </font><font color="#E6DB74">postgres:16-alpine</font> |
| <font color="#F8F8F2"> </font><font color="#F92672">container_name</font><font color="#F8F8F2">: </font><font color="#E6DB74">postgres</font> |
| <font color="#F8F8F2"> </font><font color="#F92672">environment</font><font color="#F8F8F2">:</font> |
| <font color="#F8F8F2"> </font><font color="#F92672">POSTGRES_USER</font><font color="#F8F8F2">: </font><font color="#E6DB74">${POSTGRES_USER}</font> |
| <font color="#F8F8F2"> </font><font color="#F92672">POSTGRES_PASSWORD</font><font color="#F8F8F2">: </font><font color="#E6DB74">${POSTGRES_PASSWORD}</font> |
| <font color="#F8F8F2"> </font><font color="#F92672">POSTGRES_DB</font><font color="#F8F8F2">: </font><font color="#E6DB74">${POSTGRES_DB}</font> |
| <font color="#F8F8F2"> </font><font color="#F92672">volumes</font><font color="#F8F8F2">:</font> |
| <font color="#F8F8F2"> - </font><font color="#E6DB74">"./pgdata:/var/lib/postgresql/data"</font> |
| <font color="#F8F8F2"> </font><font color="#F92672">ports</font><font color="#F8F8F2">:</font> |
| <font color="#F8F8F2"> - </font><font color="#E6DB74">5432:5432</font> |
| |
| <font color="#F8F8F2"> </font><font color="#F92672">pgadmin</font><font color="#F8F8F2">:</font> |
| <font color="#F8F8F2"> </font><font color="#F92672">image</font><font color="#F8F8F2">: </font><font color="#E6DB74">dpage/pgadmin4</font> |
| <font color="#F8F8F2"> </font><font color="#F92672">container_name</font><font color="#F8F8F2">: </font><font color="#E6DB74">pgadmin</font> |
| <font color="#F8F8F2"> </font><font color="#F92672">ports</font><font color="#F8F8F2">:</font> |
| <font color="#F8F8F2"> - </font><font color="#E6DB74">"5480:80"</font> |
| <font color="#F8F8F2"> </font><font color="#F92672">environment</font><font color="#F8F8F2">:</font> |
| <font color="#F8F8F2"> </font><font color="#F92672">PGADMIN_DEFAULT_EMAIL</font><font color="#F8F8F2">: </font><font color="#E6DB74">${PGADMIN_DEFAULT_EMAIL}</font> |
| <font color="#F8F8F2"> </font><font color="#F92672">PGADMIN_DEFAULT_PASSWORD</font><font color="#F8F8F2">: </font><font color="#E6DB74">${PGADMIN_DEFAULT_PASSWORD}</font> |
| <font color="#F8F8F2"> </font><font color="#F92672">volumes</font><font color="#F8F8F2">:</font> |
| <font color="#F8F8F2"> - </font><font color="#E6DB74">"./pgadmin/data:/var/lib/pgadmin"</font> |
| <font color="#F8F8F2"> - </font><font color="#E6DB74">"./pgadmin/log:/var/log/pgadmin"</font> |
| </pre></html></WRAP> |
| </WRAP> |
| |
| <WRAP color_term> |
| <WRAP color_command><html><pre> |
| <font color="#0087FF"><b>$</b></font> <font color="#26A269">nano</font> <u style="text-decoration-style:solid">.e</u><font color="#999999"><u style="text-decoration-style:solid">nv</u></font> |
| </pre></html></WRAP> |
| <WRAP color_mincode><html><pre> |
| <font color="#FFFFFF">POSTGRES_USER</font><font color="#F92672">=</font><font color="#F8F8F2">root</font> |
| <font color="#FFFFFF">POSTGRES_PASSWORD</font><font color="#F92672">=</font><font color="#F8F8F2">pgsql596!</font> |
| <font color="#FFFFFF">POSTGRES_DB</font><font color="#F92672">=</font><font color="#F8F8F2">imgman_db</font> |
| |
| <font color="#FFFFFF">PGADMIN_DEFAULT_EMAIL</font><font color="#F92672">=</font><font color="#F8F8F2">username@domain.com</font> |
| <font color="#FFFFFF">PGADMIN_DEFAULT_PASSWORD</font><font color="#F92672">=</font><font color="#F8F8F2">pgsql596!</font> |
| </pre></html></WRAP> |
| </WRAP> |
| |
| ディレクトリ作成🤔\\ |
| <WRAP color_term> |
| <WRAP color_command><html><pre> |
| <font color="#0087FF"><b>$</b></font> <font color="#26A269">mkdir</font><font color="#999999"> </font><font color="#A347BA">-p</font><font color="#999999"> </font><font color="#999999"><u style="text-decoration-style:solid">pgdata</u></font><font color="#999999"> pgadmin/</font><font color="#12488B"><b>{</b></font><font color="#999999">data,log</font><font color="#12488B"><b>}</b></font><font color="#999999"> </font><font color="#12488B"><b>&&</b></font><font color="#999999"> </font><font color="#26A269">chmod</font><font color="#999999"> 775 </font><font color="#A347BA">-R</font><font color="#999999"> </font><font color="#999999"><u style="text-decoration-style:solid">pgadmin</u></font> |
| </pre></html></WRAP> |
| </WRAP> |
| |
| ===== コンテナの起動 ===== |
| <WRAP color_term> |
| <WRAP color_command><html><pre> |
| <font color="#0087FF"><b>$</b></font> <font color="#26A269">podman</font><font color="#999999"> compose up</font> |
| </pre></html></WRAP> |
| <WRAP color_result_hlong><html><pre> |
| <u style="text-decoration-style:solid">>>>> Executing external compose provider "/usr/libexec/docker/cli-plugins/docker-compose". Please refer to the documentation for details. <<<<</u> |
| |
| <font color="#12488B">[+] Running 2/2</font> |
| <font color="#26A269">✔</font> Container pgadmin <font color="#26A269">Created</font> <font color="#12488B">0.0s </font> |
| <font color="#26A269">✔</font> Container postgres <font color="#26A269">Recreated</font> <font color="#12488B">0.9s </font> |
| Attaching to pgadmin, postgres |
| <font color="#A2734C">postgres | </font>The files belonging to this database system will be owned by user "postgres". |
| <font color="#A2734C">postgres | </font>This user must also own the server process. |
| <font color="#A2734C">postgres | </font> |
| <font color="#A2734C">postgres | </font>The database cluster will be initialized with locale "en_US.utf8". |
| <font color="#A2734C">postgres | </font>The default database encoding has accordingly been set to "UTF8". |
| <font color="#A2734C">postgres | </font>The default text search configuration will be set to "english". |
| <font color="#A2734C">postgres | </font> |
| <font color="#A2734C">postgres | </font>Data page checksums are disabled. |
| <font color="#A2734C">postgres | </font> |
| <font color="#A2734C">postgres | </font>fixing permissions on existing directory /var/lib/postgresql/data ... ok |
| <font color="#A2734C">postgres | </font>creating subdirectories ... ok |
| <font color="#A2734C">postgres | </font>selecting dynamic shared memory implementation ... posix |
| <font color="#A2734C">postgres | </font>selecting default max_connections ... 100 |
| <font color="#A2734C">postgres | </font>selecting default shared_buffers ... 128MB |
| <font color="#A2734C">postgres | </font>selecting default time zone ... UTC |
| <font color="#A2734C">postgres | </font>creating configuration files ... ok |
| <font color="#A2734C">postgres | </font>running bootstrap script ... ok |
| <font color="#A2734C">postgres | </font>sh: locale: not found |
| <font color="#A2734C">postgres | </font>2024-06-02 01:53:30.692 UTC [26] WARNING: no usable system locales were found |
| <font color="#A2734C">postgres | </font>performing post-bootstrap initialization ... ok |
| <font color="#2AA1B3">pgadmin | </font>NOTE: Configuring authentication for SERVER mode. |
| <font color="#2AA1B3">pgadmin | </font> |
| <font color="#2AA1B3">pgadmin | </font>pgAdmin 4 - Application Initialisation |
| <font color="#2AA1B3">pgadmin | </font>====================================== |
| <font color="#2AA1B3">pgadmin | </font> |
| <font color="#A2734C">postgres | </font>syncing data to disk ... ok |
| <font color="#A2734C">postgres | </font> |
| <font color="#A2734C">postgres | </font>initdb: warning: enabling "trust" authentication for local connections |
| <font color="#A2734C">postgres | </font>initdb: hint: 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. |
| <font color="#A2734C">postgres | </font> |
| <font color="#A2734C">postgres | </font>Success. You can now start the database server using: |
| <font color="#A2734C">postgres | </font> |
| <font color="#A2734C">postgres | </font> pg_ctl -D /var/lib/postgresql/data -l logfile start |
| <font color="#A2734C">postgres | </font> |
| <font color="#A2734C">postgres | </font>waiting for server to start....2024-06-02 01:54:14.330 UTC [32] LOG: starting PostgreSQL 16.3 on x86_64-pc-linux-musl, compiled by gcc (Alpine 13.2.1_git20231014) 13.2.1 20231014, 64-bit |
| <font color="#A2734C">postgres | </font>2024-06-02 01:54:14.404 UTC [32] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432" |
| <font color="#A2734C">postgres | </font>2024-06-02 01:54:14.620 UTC [35] LOG: database system was shut down at 2024-06-02 01:53:32 UTC |
| <font color="#A2734C">postgres | </font>2024-06-02 01:54:14.684 UTC [32] LOG: database system is ready to accept connections |
| <font color="#A2734C">postgres | </font> done |
| <font color="#A2734C">postgres | </font>server started |
| <font color="#A2734C">postgres | </font>CREATE DATABASE |
| <font color="#A2734C">postgres | </font> |
| <font color="#A2734C">postgres | </font> |
| <font color="#A2734C">postgres | </font>/usr/local/bin/docker-entrypoint.sh: ignoring /docker-entrypoint-initdb.d/* |
| <font color="#A2734C">postgres | </font> |
| <font color="#A2734C">postgres | </font>waiting for server to shut down....2024-06-02 01:54:16.036 UTC [32] LOG: received fast shutdown request |
| <font color="#A2734C">postgres | </font>2024-06-02 01:54:16.064 UTC [32] LOG: aborting any active transactions |
| <font color="#A2734C">postgres | </font>2024-06-02 01:54:16.068 UTC [32] LOG: background worker "logical replication launcher" (PID 38) exited with exit code 1 |
| <font color="#A2734C">postgres | </font>2024-06-02 01:54:16.069 UTC [33] LOG: shutting down |
| <font color="#A2734C">postgres | </font>2024-06-02 01:54:16.121 UTC [33] LOG: checkpoint starting: shutdown immediate |
| <font color="#A2734C">postgres | </font>.................2024-06-02 01:54:33.289 UTC [33] LOG: checkpoint complete: wrote 924 buffers (5.6%); 0 WAL file(s) added, 0 removed, 0 recycled; write=0.216 s, sync=16.541 s, total=17.221 s; sync files=301, longest=0.324 s, average=0.055 s; distance=4267 kB, estimate=4267 kB; lsn=0/191A9F0, redo lsn=0/191A9F0 |
| <font color="#A2734C">postgres | </font>2024-06-02 01:54:33.306 UTC [32] LOG: database system is shut down |
| <font color="#A2734C">postgres | </font> done |
| <font color="#A2734C">postgres | </font>server stopped |
| <font color="#A2734C">postgres | </font> |
| <font color="#A2734C">postgres | </font>PostgreSQL init process complete; ready for start up. |
| <font color="#A2734C">postgres | </font> |
| <font color="#A2734C">postgres | </font>2024-06-02 01:54:33.511 UTC [1] LOG: starting PostgreSQL 16.3 on x86_64-pc-linux-musl, compiled by gcc (Alpine 13.2.1_git20231014) 13.2.1 20231014, 64-bit |
| <font color="#A2734C">postgres | </font>2024-06-02 01:54:33.511 UTC [1] LOG: listening on IPv4 address "0.0.0.0", port 5432 |
| <font color="#A2734C">postgres | </font>2024-06-02 01:54:33.511 UTC [1] LOG: listening on IPv6 address "::", port 5432 |
| <font color="#A2734C">postgres | </font>2024-06-02 01:54:33.704 UTC [1] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432" |
| <font color="#A2734C">postgres | </font>2024-06-02 01:54:33.844 UTC [48] LOG: database system was shut down at 2024-06-02 01:54:33 UTC |
| <font color="#A2734C">postgres | </font>2024-06-02 01:54:33.918 UTC [1] LOG: database system is ready to accept connections |
| <font color="#2AA1B3">pgadmin | </font>postfix/postlog: starting the Postfix mail system |
| <font color="#2AA1B3">pgadmin | </font>[2024-06-02 01:55:31 +0000] [1] [INFO] Starting gunicorn 20.1.0 |
| <font color="#2AA1B3">pgadmin | </font>[2024-06-02 01:55:31 +0000] [1] [INFO] Listening at: http://[::]:80 (1) |
| <font color="#2AA1B3">pgadmin | </font>[2024-06-02 01:55:31 +0000] [1] [INFO] Using worker: gthread |
| <font color="#2AA1B3">pgadmin | </font>[2024-06-02 01:55:32 +0000] [109] [INFO] Booting worker with pid: 109 |
| </pre></html></WRAP> |
| </WRAP> |
| |
| ===== pgAdmin のログイン ===== |
| [[http://localhost:5480/|]] にアクセスする🤔\\ |
| mail: username@domain.com\\ |
| password: pgsql596!\\ |
| <WRAP zoomimg w500 x1_3> |
| {{:linux:podman:pgadmin_001.png|pgAdmin 001}} |
| {{:linux:podman:pgadmin_002.png|pgAdmin 002}} |
| </WRAP> |
| |
| 新しいサーバーの追加🤔 |
| <WRAP zoomimg w350 x1_3> |
| 名前: postgres\\ |
| ホスト名: postgres\\ |
| ユーザー名: root\\ |
| パスワード: pgsql596!\\ |
| {{:linux:podman:pgadmin_003.png|pgAdmin 003}} |
| {{:linux:podman:pgadmin_004.png|pgAdmin 004}} |
| </WRAP> |
| |
===== podman compose の定義 ===== | |