Maxscale looses users sync after node restart - mariadb-10.4

I have Maxscale as a ReadWriteSplit for 3 Galera nodes.
Node 1 is MASTER and other 2 are SLAVES.
I always create my users on master with:
mysql -e "CREATE DATABASE ${DB_NAME} CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;"
mysql -e "CREATE USER IF NOT EXISTS '${DB_NAME}'#'10.1.0.%' IDENTIFIED BY '${DB_PASS}';"
mysql -e "GRANT ALL PRIVILEGES ON ${DB_NAME}.* TO '${DB_NAME}'#'10.1.0.%';"
Since any nod is not restarted (for MariaDB upgrades or other reasons) everything goes fine.
But if the node is restarted, when any query hits the SLAVES Maxscale claims that:
error : (2648715) [mariadbbackend] Invalid authentication message from backend 'sql3'. Error code: 1044, Msg : #42000Access denied for user '${DB_NAME}'#'10.1.0.%' to database '${DB_NAME}'
warning: (2648715) [readwritesplit] Refresh rate limit (once every 30 seconds) exceeded for load of users' table.
To fix it, at MASTER, I need to GRANT ALL PRIVILEGES again:
mysql -e "GRANT ALL PRIVILEGES ON ${DB_NAME}.* TO '${DB_NAME}'#'10.1.0.%';"
And the error stops. Is this a bug or I'm not doing things correctly?

It looks like something going wrong at the database level. To test this, you could try connecting to that node manually after restarting it to see if it works or not.

Related

Problem connecting to my Database when setting up my first node

When I try to execute this command:
cd ~/.chainlink-kovan && docker run -p 6688:6688 -v ~/.chainlink-kovan:/chainlink -it --env-file=.env smartcontract/chainlink: local n
(I entered ut with my version of course)
I get this error:
The node and the database are both hosted on AWS.
This is my environment:
the issue is related to the configuration of your postgresql server.
To connect to the database you need a specially created USER with a PASSWORD, which then locks this database by starting the Chainlink node. The default postgres USER and DATABASE will not work because it is used for administrative purposes. These credentials are then added to the environmental variable where you have the correct syntax:
DATABASE_URL=postgresql://$USERNAME:$PASSWORD#$SERVER:5432/$DATABASE
You can follow those steps to create the USER with credentials:
access the postgresql server/ host via psql command line interface:
psql --host=mypostgresql.c6c8mwvfdgv0.us-west-2.rds.amazonaws.com --port=5432
Create the USER and grant all privileges:
CREATE USER youruser WITH PASSWORD 'yourpass';
GRANT ALL PRIVILEGES ON DATABASE yourdbname TO youruser;
Now you just need to change the DATABASE_URL configuration in your environmenal file (.env) and kill & restart the Chainlink node
In addition and in order to access the postgresql server hosted on AWS, you can have a look at the official documentation: https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_ConnectToPostgreSQLInstance.html

Connecting to MongoDB from mongo shell and Robo 3T

All,
I'm new to MongoDB and I was pulled into it when the vendor who setup our website left which means I'm learning everything from basic with a strong SQLServer DBA background.
On our Dev MongoDB V3.4.2 Windows installation, the vendor gave me a user named Monguser defined in admin with root as role and after they left I noticed Robo 3T as part of the installation.
When I try to connect via the mongo shell as below, I get an error with the message "Authentication failed". C:>mongo --username monguser --password mongold!234. I tried connecting to it via the Robo 3T and I'm able to connect via the same login/password.
Also, I was asked to create a backup of a database and I tried the following but it failed with the error Server returned error on SASL authentication step: Authentication failed for database MiningDB
C:\mongodump --username monguser --password mongold!234 --dbMiningDB
But if I run C:\mongodump --username monguser --password mongold!234 then it backs up all the databases in the installation without returning any error.
In both the cases, why am I getting the error? Any help will be deeply appreciated.
Thanks,
rgn
OK. From the below link I figured out that I need to include "--authenticationDatabase admin"
Referred Link

Oracle 11g Enterprise Manager Login Fail Internal Error has Occured

I have installed Oracle 11g on my Windows 10 machine. I followed all preinstallation requirements.
When trying to log in to the Enterprise manager via this link:
https://localhost:1158/em
I get the error:
Internal Error has occurred. Check the log file for details.
I have found log files and it looks like this is the relevant entry:
2017-09-17 07:36:53,631 [MetricCollector:HOMETAB_THREAD600:60] ERROR rt.DbMetricCollectorTarget _getAllData.344 - java.lang.NullPointerException
java.lang.NullPointerException
at oracle.sysman.emSDK.emd.comm.EMDClient.getURL(EMDClient.java:1570)
at oracle.sysman.emSDK.emd.comm.EMDClient.getConnection(EMDClient.java:1266)
at oracle.sysman.emSDK.emd.comm.EMDClient.getConnection(EMDClient.java:1242)
at oracle.sysman.emSDK.emd.comm.EMDClient.getResponseForRequest(EMDClient.java:1689)
at oracle.sysman.emSDK.emd.comm.EMDClient.getMetrics(EMDClient.java:981)
at oracle.sysman.emo.perf.metric.rt.DbHomeTab._getAllData(DbHomeTab.java:340)
at oracle.sysman.emo.perf.metric.rt.DbHomeTab.getData(DbHomeTab.java:154)
at oracle.sysman.emo.perf.metric.eng.MetricCached.collectCachedData(MetricCached.java:416)
at oracle.sysman.emo.perf.metric.eng.MetricCollectorThread._collectCachedData(MetricCollectorThread.java:605)
at oracle.sysman.emo.perf.metric.eng.MetricCollectorThread.run(MetricCollectorThread.java:325)
at java.lang.Thread.run(Thread.java:595)
I have tried to set the unique name in environment variables, I thought maybe Java was the problem so I updated my JDK to 8. I am still getting the same error, and my SQL Plus will not open, as soon as I put in the correct credentials it closes. Also I have configured a Listener and tested, test was successful.
I managed to fix the issue, turns out it was a time zone issue. The DB time zone and computer time zone were different. Thus the DB Console would not start and was giving the error "EM daemon is not running".
I fixed it by following instructions here.
Also note before I did that I completely uninstalled Oracle and reinstalled it. There were some issues on that install that were causing SQL not to run. But the above is what fixed the Internal Error I was getting.
Make sure the SYSMAN database user is not locked.
select username, account_status from dba_users where username = 'SYSMAN';
If the account status is not OPEN then
alter user SYSMAN account unlock;
Try restarting dbconsole
$ emctl stop dbconsole
$ emctl start dbconsole

DB2 Express in MAC SQL0805N issue

I have db2 express on mac, db2start works, and db2 connect works.
However when I do anything on the database it gives me an error (eg. db2 list tables):
SQL0805N Package "NULLID.SQLC2J23 0X4141414141564962" was not found.
SQLSTATE=51002
I try doing this:
/Users/myuser/sqllib/bnd> db2 bind #db2ubind.lst blocking all grant public
And get these errors:
LINE MESSAGES FOR db2ubind.lst
------ --------------------------------------------------------------------
SQL0061W The binder is in progress.
LINE MESSAGES FOR db2ajgrt.bnd
------ --------------------------------------------------------------------
SQL0551N "TESTDB" does not have the required authorization or
privilege to perform operation "BIND" on object
"NULLID.SQLABJ02". SQLSTATE=42501
LINE MESSAGES FOR db2ueiwi.bnd
------ --------------------------------------------------------------------
SQL0551N "TESTDB" does not have the required authorization or
privilege to perform operation "BIND" on object
"NULLID.SQLUAJ19". SQLSTATE=42501
I also already did this (which seems to not help):
sudo chown root /Users/$(whoami)/sqllib/security/db2ckpw
sudo chmod u+rxs /Users/$(whoami)/sqllib/security/db2ckpw
sudo chmod o+rx /Users/$(whoami)/sqllib/security/db2ckpw
Did I miss something?
#client
> db2level
DB21085I Instance "blahblah" uses "64" bits and DB2 code release "SQL10010"
with level identifier "0201010E".
Informational tokens are "DB2 v10.1.0.0", "s120905", "DARWIN64101", and Fix
Pack "0".
Product is installed at "/Users/username/sqllib".
#server
Instance server = DB2/AIX64 10.5.5
Is it not possible to connect from a 10.1 client to 10.5.x server?
The meesage says that you do not have the BIND right in the database.
So ask your DBA to grant you the bind right and redo the bind command.
The DBA has to issue
grant bindadd on database to user testdb
grant bind on database to user testdb
Alternatively the right could be granted to a group or role or the DBA has to run the bind under his authority.

CruiseControl.rb throwing exception with Postgres

In a VPS I have Postgres installed and 2 Rails projects. Both are running on production mode and connecting PG as different users.
Now I want to set CruiseControl.rb for one of them. Everything went perfectly, except when cruise is trying to run the test it's throwing this error:
PGError: ERROR: permission denied to create database
: CREATE DATABASE "myProject" ENCODING = 'utf8'
This test database is created with a different owner name, and all of them are specified correctly in ~/.cruise/projects/myProject/work/config/database.yml.
When I am running these following series of commands manually inside ~/.cruise/projects/myProject/work, they are working perfectly.
RAILS_ENV=test rake db:migrate
rake test
I've created the database using these following commands:
create user test_user with password 'abcxyz';
create database test_database TEMPLATE template0 owner test_user;
grant all privileges on database test_database to test_user;
After hitting the Build Now button, the test_database is getting deleted, and then its trying to create it again and throwing that exception.
I'm puzzled, why the test db is getting deleted on the first place? Is there anything I'm missing here?
It sounds like you haven't granted access to your test user to create a new database, even though you issued permissions for the test_user on the existing test_database.
You may need to grant privileges to create a new DB like so:
GRANT CREATE ON SCHEMA public TO test_user;
The commands you executed before created the test_user and so must have been executed as an admin or the postgres user.
TL;DR
You should compare the permissions for your cruise user to the user you executed these steps with manually, something is wrong preventing the test db creation during db:test:prepare

Resources