-
-
Notifications
You must be signed in to change notification settings - Fork 555
Convert from MySQL with Docker installation
Run command docker run -it --rm alpine /sbin/ip route|awk '/default/ { print $3 }'
That'll give you ip address of the host. Probably it'll be 172.17.0.1
The alpine
image will be downloaded to your host, and if it isn't needed for you after database migration just remove it:
docker rmi alpine
.
On Mac OS you can just use docker.for.mac.host.internal
instead of the IP address.
Find mysqld.cnf
file invoking locate mysqld.cnf
command.
You'll get a line or few lines with paths to the configuration file. For example this one: /etc/mysql/mysql.conf.d/mysqld.cnf
.
Open this file with editor, find a line contains bind-address
and change it to *
.
Restart mysql server via systemctl restart mysql
.
Also check PRIVILEGES
for the desired user-database-table triad (Command SHOW GRANTS FOR 'username'@'hostname';
can help you.
For Psql version 9.5 check the file /etc/postgresql/9.5/main/postgresql.conf
. You can find it with locate
command as well.
Open this file and change the listen_addresses
to *
.
Locate pg_hba.conf
file and edit it:
Add line host all all <host-ip>/16 trust
to the end of file and restart the server:
systemctl restart postgresql.service
Now it's possible to launch pgloader:
docker run --security-opt seccomp=unconfined \
--rm \
--name pgloader \
dimitri/pgloader:latest pgloader \
mysql://user:pass@<host-ip>/dbname postgresql://user:pass@<host-ip>/dbname
If you want to use a command file on your host, you have to use bind mounts (see Docker documentation for details: https://docs.docker.com/storage/bind-mounts/). For example, if your command file has the path /Users/xyz/command-file.txt
, here is how you can use it:
docker run --security-opt seccomp=unconfined \
--rm \
-v /Users/xyz:/mnt \
--name pgloader \
dimitri/pgloader:latest pgloader /mnt/command-file.txt