I am having an issue adding an instance to my ReplicationSet with MySQL 8.0.28 and MySQL Shell
rs.addInstance('a.b.c.d:3306')
the response I get is
Adding instance to the replicaset...
* Performing validation checks
This instance reports its own address as a.b.c.d:3306
a.b.c.d:3306: Instance configuration is suitable.
* Checking async replication topology...
* Checking transaction state of the instance...
WARNING: A GTID set check of the MySQL instance at 'a.b.c.d:3306' determined that it contains transactions that do not originate from the replicaset, which must be discarded before it can join the replicaset.
a.b.c.d:3306 has the following errant GTIDs that do not exist in the replicaset:
2b575744-e07d-11ec-ada9-00ff6b3adad4:1-67
WARNING: Discarding these extra GTID events can either be done manually or by completely overwriting the state of a.b.c.d:3306 with a physical snapshot from an existing replicaset member. To use this method by default, set the 'recoveryMethod' option to 'clone'.
Having extra GTID events is not expected, and it is recommended to investigate this further and ensure that the data can be removed prior to choosing the clone recovery method.
Please select a recovery method [C]lone/[A]bort (default Abort): C
* Updating topology
Waiting for clone process of the new member to complete. Press ^C to abort the operation.
* Waiting for clone to finish...
NOTE: a.b.c.d:3306 is being cloned from x.y.z.x:3306
ERROR: The clone process has failed: Clone Donor Error: 1184 : Aborted connection 554 to db: 'unconnected' user: 'mysql_innodb_rs_10' host: 'xxx' (init_connect command failed). (3862)
ERROR: Error adding instance to replicaset: Clone Donor Error: 1184 : Aborted connection 554 to db: 'unconnected' user: 'mysql_innodb_rs_10' host: xxx' (init_connect command failed).
Reverting topology changes...
Changes successfully reverted.
ERROR: a.b.c.d:3306 could not be added to the replicaset
ReplicaSet.addInstance: Clone Donor Error: 1184 : Aborted connection 554 to db: 'unconnected' user: 'mysql_innodb_rs_10' host: 'xxx' (init_connect command failed). (RuntimeError)
I can't find any information on how to proceed with this, any help would be appreciated?
Assuming that your user has all of the required permissions, then the first thing to check based on (init_connect command failed) in your description would be the init_connect variable on both master and slave:
SHOW GLOBAL VARIABLES LIKE 'init_connect';
It should be the same on both servers.
(The 'unconnected' in your subject will simply be referring to the db - which is not an issue).
Related
I'm migrating a database from MySQL to Postgres. This question has been very helpful. When running the python manage.py dumpdata --exclude contenttypes --indent=4 --natural-foreign > everything_else.json to create a json fixture the connection is aborted by the database server. All other steps have been successful.
The MySQL database is hosted on RDS and the connection is aborted at the same point in the file each time I try to run this (file size is always 12288 bytes). Logs from the RDS instance state the problem as follows (db, user and host changed to dummy values):
[Note] Aborted connection 600000 to db: 'mydb' user: 'myUsername' host: '127.0.0.1' (Got an error writing communication packets)
In the terminal the message is simply killed.
Why would this error be happening and how can I create this json fixture?
Update
To test for timeout issues I've followed the advice in this post to change default timeout values. This has no effect on the problem.
I've also tried modifying the DB instance to one with more memory etc. This had no effect.
Further update
I didn't get to the bottom of this but instead took a different route and used AWS database migration service (DMS). There's a good walkthrough for this here. For my small ~5GB database the migration process took 5 minutes with negligible costs on the smallest DMS instance.
Mysql 8.0.28 Replication slave was created multiple times. He started giving the following error. Even though I made stop slave and start slave, the same error continues. how to make slave stand up?
Coordinator stopped because there were error(s) in the worker(s). The most recent failure being: Worker 1 failed executing transaction 'ANONYMOUS' at master log , end_log_pos 345612577. See error log and/or performance_schema.replication_applier_status_by_worker table for more details about this failure or others, if any.
Likely caused by importing data, then starting replication leading to inconsistent states. Can also be permission issues or whatnot.
To see what was attempted you should do something like this:
mysqlbinlog --read-from-remote-server -h <masterip> -u replicateuser <binfile> --verbose --base64-output=DECODE-ROWS -p|grep -A10 -B10 345612577
This will give you information on the query that caused the issue.
I am trying to analyze MySQL error logs that are generated on my OSSEC agent and raise alerts using OSSEC server.
here is the code block added to /var/ossec/etc/ossec.conf on the agent side to read the error logs of MySQL from the agent:
<localfile>
<log_format>mysql_log</log_format>
<location>/var/log/mysql/error.log</location>
</localfile>
After doing so I have restarted the agent and server but unable test any error logs that are getting generated on the agent side like:
2020-09-15T04:09:24.164859Z 12 [Note] Access denied for user 'root'#'localhost' (using password: YES)
As per doc https://ossec-docs.readthedocs.io/en/latest/docs/programs/ossec-logtest.html under Caveats we need to add MySQL log: to the log generated for the ossec-logtest.
This will be added automatically when we send these logs to the OSSEC server for analysis from the agent.
ossec-logtest result for MySQL error log
ossec-logtest is working fine after adding MySQL log: to the beginning but they are not working in the realtime.
Can anyone please help me through this problem.
The fact that ossec-logtest trigger an alert means that mysql decoder and rules are working fine
Check on Agent
MySql is running. systemctl status mysqld.service
MySql configuration (loglevel and output file) allow to log that kind of event . See here
If the value is greater than 1, aborted connections are written to the
error log, and access-denied errors for new connection attempts are
written.
MySql is effectively logging 'Access denied': grep "Access denied" /var/log/mysql/error.log
Ossec and their processes is running ok: /var/ossec/bin/ossec-control status
Check on Manager
log_alert_level field in /var/ossec/etc/ossec.conf is lower o equal than 9 (loglevel showed in your ossec-logtest)
I'm trying to purge JBatch repository with ./asadmin purge-jbatch-repository server-config:jobs_/jobs but I get the following error:
remote failure: com.ibm.jbatch.container.exception.PersistenceException: java.sql.SQLException: You can't specify target table 'STEPEXECUTIONINSTANCEDATA' for update in FROM clause
java.sql.SQLException: You can't specify target table 'STEPEXECUTIONINSTANCEDATA' for update in FROM clause
Command purge-jbatch-repository failed.
My datasource comes from a MySQL connection pool, connected to a server version 5.7.27-0ubuntu0.18.04.1
I done messed something up.
I am working on a Node / Express app that is using the Sequelize ORM to write to a local mysql DB for development. I loaded it up this morning, and it was fine. At some point in working today, I attempted to reset my mysql root password (for unrelated reasons). I did so, then attempted to restart the node server for my app, and it now fails to load. When running
node app.js
I get
TypeError: Uncaught, unspecified "error" event.
at TypeError (<anonymous>)
at EventEmitter.emit (events.js:74:15)
at module.exports.finish (/Users/DrHall/Desktop/gitRepos/CRPinit/node_modules/sequelize/lib/query-chainer.js:142:30)
at exec (/Users/DrHall/Desktop/gitRepos/CRPinit/node_modules/sequelize/lib/query-chainer.js:96:16)
at onError (/Users/DrHall/Desktop/gitRepos/CRPinit/node_modules/sequelize/lib/query-chainer.js:72:11)
at EventEmitter.emit (events.js:95:17)
at null.<anonymous> (/Users/DrHall/Desktop/gitRepos/CRPinit/node_modules/sequelize/lib/dao-factory.js:299:42)
at EventEmitter.emit (events.js:95:17)
at null.<anonymous> (/Users/DrHall/Desktop/gitRepos/CRPinit/node_modules/sequelize/lib/query-interface.js:224:17)
at EventEmitter.emit (events.js:98:17)
I have found other people reporting this error message, but its vague enough that it has been for different reasons that the spesific failures I am getting. I am too new at this whole process to know what I did in the process of reset my root password that is not making Sequelize fail to load.
Mysql root loads fine with the new password. The app does not use the root user, it uses a separate user, who can also log in fine.
Any ideas what I did wrong?
Extra info to address questions asked:
TO reset the password I did use '-skip-grant-tables'. Running grep i saw that mysql was still running with that command, so I killed it and started it up again. Running ps -Af | grep mysql I get
501 7563 1 0 4:31PM ttys000 0:00.02 /bin/sh /usr/local/Cellar/mysql/5.6.14/bin/mysqld_safe --datadir=/usr/local/var/mysql --pid-file=/usr/local/var/mysql/Lil-Coder.pid
501 7662 7563 0 4:31PM ttys000 0:00.44 /usr/local/Cellar/mysql/5.6.14/bin/mysqld --basedir=/usr/local/Cellar/mysql/5.6.14 --datadir=/usr/local/var/mysql --plugin-dir=/usr/local/Cellar/mysql/5.6.14/lib/plugin --log-error=/usr/local/var/mysql/Lil-Coder.err --pid-file=/usr/local/var/mysql/Lil-Coder.pid
501 7677 7460 0 4:32PM ttys000 0:00.00 grep mysql
Which seems right? But the same error on trying to boot node.
I'm just going to file this one under 'W' for WTF. In the end what fixed it was basically nothing. I was connecting to the MySQL DB via Sequelize via:
sequelize = new Sequelize(config.database, config.username, config.password, {
dialect: 'mysql',
port: 3306
}),
with config being an external file I was requiring. I replaced all of the config. variables with the actual strings from the config file (copy/paste) and it worked. Copied them back, and it still worked. It's all voodoo to me.