Replication from MariaDB (master) to MySQL 5.6 (slave)
When I try to connect to remote MariaDB host on slave server, I get this error:
ERROR 1130 (HY000): Host '[slave server ip]' is not allowed to connect
to this MariaDB server
What's wrong?
I've solved the problem. The slave server ip address is wrong! It's ridiculous, the slave server has another ip address, and I have to grant database user for the other one.
Related
I have an AWS postgres instance and an AWS ec2 instance (running as bastion host). From my local machine I want to connect to that AWS postgres instance via a python script. But it's not working (see below).
My setup is:
with SSHTunnelForwarder(
('internet-adress-of-the-basion-host', 22),
ssh_private_key=r"the-private-key.pem",
ssh_username="ec2-user",
local_bind_address=('localhost', 6543),
remote_bind_address=('internet-adress-of-the-postgres-server', 5432)) as server:
server.start()
print("server connected")
self.conpostgres = psycopg2.connect(host='localhost', port=server.local_bind_port, database="the-database",
user="the-user", password="the-password")
I can sucessfully connect via the sshtunnel (the "server connected" messages is printed to the console), but I get an ERROR in the when excecuting psycopg2.connect.
The connect ERROR is:
could not connect to server: Connection refused (0x0000274D/10061)
Is the server running on host "localhost" (::1) and accepting
TCP/IP connections on port 6543?
FATAL: password authentication failed for user "the-user"
FATAL: no pg_hba.conf entry for host "x.x.x.x", user "the-user", database "the-database", SSL off
Two remarks:
1.) In the line "no pg_hba.conf entry for host "x.x.x.x"". Here the "x.x.x.x" address is NOT localhost (127.0.0.1). It's a normal ip4 internet address. But I have no idea where this address is coming from!
2.) !!!! With the exact same configuration mentioned above I can successfully connect to the database via the database tool built in IntelliJ Idea. So there is a way to connect to the postgres server without changing pg_hba.conf. So maybe I have to configure the tunnel differently?
I am setting up a pglogical replication between an on-premise PostgreSQL 10.14 (publisher and AWS RDS Postgresql 10.16 (subscriber), but after setting up a subscription, I only get to connection resets. Can anyone spot what I'm doing wrong?
Network setup:
On-premise postgres < jumphost > <-- ssh tunnel --> AWS RDS
internal-ip 10.2.0.8 db01.some.tld
I have verified that the ssh tunnel is working:
I can connect to the on-premise postgres from AWS using psql connecting to the tunnel
I can even connect to the on-premise postgres from AWS RDS when using postgres_fwd
Pglogical setup:
on-premise:
create node with dsn host=10.2.0.8 dbname=... user=... password=...
AWS:
create node with dsn host=db01.some.tld dbname=... user=... password=...
create subscription with dsn host=10.2.0.8 dbname=... user=... password=...
Once that is done:
pglogical processes are running on both the provider and subscriber
but I get to the following errors:
AWS:
LOG: could not receive data from client: Connection reset by peer
LOG: unexpected EOF on client connection with an open transaction
On-premise:
LOG: unexpected EOF on client connection with an open transaction
I have tried fiddling around with logging parameters, but couldn't get to anything useful. Similarly I couldn't get anything helpful from the ssh tunnel logs.
Any idea what I could be doing wrong?
Figured it out. In this case:
The connection was fine. However, there was an issue with the schema of one table on the replica, causing the replication to die.
I am trying to fetch data from the Postgres server which is remotely available from Amazon EC2 instance. When I try to telnet the remote server, it is connected.
But when I am running a kafka connector which connects to the remote Postgres server it throws an error stating
FATAL: no pg_hba.conf entry for host, SSL off for configuration Couldn't open a connection to jdbc:postgresql://<url>
I tried changing the connection string from
jdbc:postgresql://host:5432/schema_name?user=******&password=******&defaultFetchSize=250000&useCursorFetch=true
to
jdbc:postgresql://host:5432/schema_name?ssl=true&user=******&password=******&defaultFetchSize=250000&useCursorFetch=true
then it throws another error which is
The server does not support SSL. for configuration Couldn't open a connection to jdbc:postgresql://<url>
There is no SSL support in the Postgres server because I can connect to the server through any DB connector without ssh. I am sure it has to do something with the security access group of EC2(considering I can telnet to the server from the instance). Any help would be much appreciated.
Looks like error is in the pg_hba.conf. I would have put this as a comment but not enough rep.
When you telnet to the server did you use the db port?
Can you post your pg_hba.conf file. This is one off my home dev server. You'll need to add a line similar to this: host all all 192.168.1.1/24 md5 with your IP addr and details.
If you're using this in a corporate network I'd highly recommend looking at a amazon VPC and not to expose your database to the internet.
# TYPE DATABASE USER ADDRESS METHOD
# "local" is for Unix domain socket connections only
local all all peer
# IPv4 local connections:
host all all 127.0.0.1/32 md5
host all all 10.10.187.1/24 md5
I'm getting Server doesn't listen (Img1) every time a try to connect to db server in pgAdmin III. It started after a network adjustment related to local machines IP number in our company.
I'm also receiving Error connecting to the server. (Img2)
Here's pg_hba.conf file and the ip adress of the computer.
I have an openshift app, and I just installed a postgresql DB on the same cartridge.
I have the postgresql DB installed but now I want to connect to the DB from my PC so I can start creating new tables.
Using port forwarding I found my IP for the postgresql db to be
127.3.146.2:5432
under my webaccount I see my
Database: txxx
User: admixxx
Password: xxxx
Then Using RazorSQl I try to setup a new connection
keeps coming as user password incorrect.
If I try and use the local IP to connect such as the 127.0.0.1 then I can connect fine.
How can I resolve this issue, all I am trying to do is connect to this DB so that I can create new tables.
As shown below, after running the "rhc port-forward $appname" command, you would need to connect to the ip address of 127.0.0.1 and port that shows up next to it to connect to the service you want to reach, such as postgresql. In the below example, i would connect to 127.0.0.1, port 5432. If you already have something running locally on the postgresql port, it will select another port and display it in the table. But the connection will be forwarded to your openshift gear and postgresql on your gear.
Corey-Red-Hat:~ cdaley$ rhc port-forward rt2
Checking available ports ... done
Forwarding ports ...
To connect to a service running on OpenShift, use the Local address
Service Local OpenShift
---------- -------------- ---- ---------------
httpd 127.0.0.1:8080 => 127.7.74.1:8080
postgresql 127.0.0.1:5432 => 127.7.74.2:5432
Press CTRL-C to terminate port forwarding
You can refer to the OpenShift Developer Portal for more information about using the PostgreSQL cartridge here: https://developers.openshift.com/en/databases-postgresql.html