I am trying to access my database via a GUI (Psequel).
I forwarded the port setting from my container as such:
app.yml:
expose:
<standard definitions>
- "15432:5432" # PostgreSQL
Also changed my password as such:
./launcher enter app
su - postgres
psql
ALTER ROLE postgres WITH PASSWORD '<your password>';
And I am unable to access the database. Any suggestions?
If you only need a static snap shot of the database then from https://<site>/admin/backups download a backup. It should be a *.tar.gz file and when uncompressed will be a *.sql file. Create a PostgreSQL database on another machine, which could even be your laptop, and then import the *.sql file.
Now you should be able to access the data all you want with any means that can connect to a PostgreSQL database.
I use the above but access the Discourse database in PostgreSQL via ODBC.
Volevo ricontrollare con te, per favore. Quando esporto il dump.sql in un database postgresql, mi ritrovo con tabelle vuote. Non è chiaro il perchÊ. Ecco i passaggi che seguo dopo aver scaricato il file di backup:
Apri pgAdmin
Crea un nuovo database
Apri Query Tool
Usa âApriâ in Query Tool e seleziona il file dump.sql
Esegui lo script di dump
Dice che tutto è andato a buon fine, ma quando faccio âvisualizza datiâ nelle tabelle, sono vuote.
Inoltre, probabilmente è gestito dallâistanza, ma sembra che la tabella degli utenti non sia inclusa, ma ho bisogno di quella tabella per sapere chi ha fatto cosa.
Qual è la dimensione di dump.sql? Dovrebbe essere di dimensioni considerevoli (almeno qualche MB). Puoi dare unâocchiata allâinterno del file? Ad esempio:
Usando la pagina di amministrazione https:///admin/backup ho richiesto un download e seguito i passaggi, câerano diversi passaggi che includevano la verifica tramite email e il download di un file.
Il file scaricato era un file gz ad esempio abc-2025-01-23-095947-v20250122131007.sql.gz. Su Windows ho decompresso il file usando 7-zip che ha creato una directory con lo stesso nome meno il .gz alla fine.
Usando lo stesso prompt dei comandi di Windows utilizzato per digitare il comando per elencare lâinizio del file sql.
type /a | more
C:\Users\Groot\Downloads\abc-2025-01-23-095947-v20250122131007.sql>type "abc-2025-01-23-095947-v20250122131007.sql" /a | more
abc-2025-01-23-095947-v20250122131007.sql
--
-- PostgreSQL database dump
--
-- Dumped from database version 15.8 (Debian 15.8-1.pgdg110+1)
-- Dumped by pg_dump version 15.10 (Debian 15.10-1.pgdg120+1)
-- Started on 2025-01-23 09:59:47 UTC
SET statement_timeout = 0;
SET lock_timeout = 0;
SET idle_in_transaction_session_timeout = 0;
SET client_encoding = 'UTF8';
Spero che questo ti porti al punto in cui puoi usare il file SQL con PGAdmin per importare i dati.
NB
Quando ho pubblicato a riguardo circa 5 anni fa, il tipo di file scaricato era tar.gz, ora è sql.gz. Lâunica differenza è che ora è necessario un passaggio di decompressione in meno.
Grazie mille per il tuo aiuto! Ho seguito tutti gli stessi passaggi (con uno in piĂš poichĂŠ il mio file ha ancora tar.gz). Ho raggiunto lo stesso risultato con il file sql:
--
-- PostgreSQL database dump
--
.........
SET statement_timeout = 0;
SET lock_timeout = 0;
SET idle_in_transaction_session_timeout = 0;
SET client_encoding = 'UTF8';
Tuttavia, il problema è che quando uso PgAdmin per ottenere i dati, tutte le tabelle sono vuote e la tabella Users è semplicemente mancante.
Mi dispiace, non posso aiutarti con PgAdmin. Non uso PgAdmin e dovrei installarlo per provare. Installare PgAdmin non è un passo che mi interessa fare.
Lâunica volta che ho avuto accesso a un database Discourse esportato è stato per installare PostgreSQL, odbc-postgresql e usare iusql come indicato qui.
Grazie mille per tutto il tuo aiuto! Lo apprezzo molto. Si scopre che stavo cercando di usare lâultima versione di postgresql mentre dump.sql proveniva da una versione precedente. Lâho scoperto mentre cercavo di seguire la guida che hai usato. Grazie!