Migração de Sqlite para Postgres
Visão geral
Se você começou a usar o Yucca com Sqlite e, depois, os recursos necessários cresceram, é possível migrar os dados do banco Sqlite para o Postgres. A migração reversa não é suportada.
Migração
-
Implante e prepare o postgres com antecedência.
-
Pare o servidor Yucca:
sudo systemctl stop yucca -
Execute o comando de migração informando o caminho do banco de origem e do banco de destino:
/opt/yucca/yucca admin migrateA lista de todos os parâmetros pode ser vista na ajuda:
/opt/yucca/yucca admin migrate --helpMigrate state from SQLite to PostgreSQLUsage:yucca admin migrate [flags]Flags:--config string Path to configuration file (default "/opt/yucca/yucca.toml")--data-dir string The data directory used to store state and other persistent data (default "data")--database-busy-timeout int Timeout in seconds for waiting for an SQLite table to become unlocked (default 500)--database-ca-cert-path string The path to the CA certificate to use (default "/etc/ssl/certs")--database-cache-mode string Shared cache setting used for connecting to the database (private, shared) (default "shared")--database-client-cert-path string The path to the client cert--database-client-key-path string The path to the client key--database-conn-max-lifetime duration Sets the maximum amount of time a connection may be reused (default 0s)--database-host string Database host (not applicable for sqlite3) (default "127.0.0.1:5432")--database-max-idle-conn int The maximum number of connections in the idle connection pool (default 2)--database-max-open-conn int The maximum number of open connections to the database--database-name string The name of the Yucca database (default "yucca")--database-password string The database user's password (not applicable for sqlite3) (default "postgres")--database-path string SQLite database location--database-ssl-mode string SSL mode for Postgres (disable, require or verify-full) (default "disable")--database-user string The database user (not applicable for sqlite3) (default "postgres")-h, --help Help for migrate--state-dir string The directory used to store state and other persistent data (default "<data-dir>/state") -
Informe na configuração o novo tipo de banco de dados postgres e informe as credenciais de conexão.
-
Inicie o servidor Yucca:
sudo systemctl start yucca -
Certifique-se de que o Yucca agora está usando o postgres; isso pode ser visto na seção de configuração
/ui/administration/configou no log durante a inicialização do servidor.