Coder Social home page Coder Social logo

Couldn't execute 'FLUSH TABLES WITH READ LOCK': Access denied for user 'root'@'%' (using password: YES) (1045) about go-mysql-elasticsearch HOT 17 CLOSED

go-mysql-org avatar go-mysql-org commented on May 18, 2024
Couldn't execute 'FLUSH TABLES WITH READ LOCK': Access denied for user 'root'@'%' (using password: YES) (1045)

from go-mysql-elasticsearch.

Comments (17)

siddontang avatar siddontang commented on May 18, 2024

I knew that we have no proper privilege to run mysqldump with --master-data flag in AWS RDS, so it is not allowed in AWS RDS.

from go-mysql-elasticsearch.

tpeng avatar tpeng commented on May 18, 2024

I had same issue when use go-mysql-elasticsearch with Amazon RDS MySQL server. managed to workaround it by following:

  1. use mysqldump to dump the RDS MySQL server and restore it to local MySQL db.
  2. shutdown RDS MySQL server
  3. start go-mysql-elasticsearch with my_addr set to local db and wait until it's finished
  4. stop go-mysql-elasticsearch and delete var/master.info
  5. restart RDS MySQL server
  6. restart go-mysql-elasticsearch with my_addr to set to RDS MySQL server and mysqldump to empty

it seems working properly, @siddontang any thoughts on this? thanks

from go-mysql-elasticsearch.

siddontang avatar siddontang commented on May 18, 2024

@tpeng

go-mysql-elasticsearch will try to use mysqldump to dump all data then sync with the position saved in mysqldump.

We can support starting from a binlog position to avoid using mysqldump.
Btw if the binlog is truncated, we may have not enough data to sync.

from go-mysql-elasticsearch.

tpeng avatar tpeng commented on May 18, 2024

@siddontang thanks for your reply.

the problem is as you posted above: "no proper privilege to run mysqldump with --master-data flag in AWS RDS, so it is not allowed in AWS RDS."

from what i tried yesterday, it seems still the case. is go-mysql-elasticsearch has way to avoid using --master-data flag to dump all the data?

starting from binlog position sounds good, but if i run show binary logs; it only show 2 rows. i would expect there should be more rows to keep all the binlog files, does RDS delete obsolete binlog files?

from go-mysql-elasticsearch.

siddontang avatar siddontang commented on May 18, 2024

Hi @tpeng

go-mysql-elasticsearch doesn't support starting from a position now, but you can update the master.info directly to let it work.

I have another way if possible:

  1. Get the current binlog position with show master status
  2. Dump the MySQl without --master-data
  3. Sync from the got postion in step 1.

This can work well even you insert new data when do step 2 because binlog is row format, so any change synced to elasticsearch is idempotent.

from go-mysql-elasticsearch.

tpeng avatar tpeng commented on May 18, 2024

Hey @siddontang

just to clarity, the 3 steps above still requires dump the initial data from MySQL server (e.g. run mysqldump from command line), right?

from go-mysql-elasticsearch.

siddontang avatar siddontang commented on May 18, 2024

@tpeng

No, we can guarantee it.

from go-mysql-elasticsearch.

siddontang avatar siddontang commented on May 18, 2024

I will support this later if mysqldump with --master-data failed. Maybe this week.

from go-mysql-elasticsearch.

tpeng avatar tpeng commented on May 18, 2024

thanks @siddontang, that would be great. but i wonder how is it going to work when RDS MySQL deleted expired binlog files?

from go-mysql-elasticsearch.

siddontang avatar siddontang commented on May 18, 2024

@tpeng

If the binlog files are deleted after we dumping the data, we may meet an error, sadly.

from go-mysql-elasticsearch.

tpeng avatar tpeng commented on May 18, 2024

@siddontang

let me know when you done with the change, i'm happy to test it!

thanks,

from go-mysql-elasticsearch.

siddontang avatar siddontang commented on May 18, 2024

Hi @tpeng
Can you help me to make sure we can run show master status in RDS?

from go-mysql-elasticsearch.

tpeng avatar tpeng commented on May 18, 2024

from go-mysql-elasticsearch.

siddontang avatar siddontang commented on May 18, 2024

Hi @tpeng

I post a new branch siddontang/skip-master-data to fix this problem, see #116

Can you help me to check in RDS, you should set skip_master_data = true in the config file then run.

from go-mysql-elasticsearch.

tpeng avatar tpeng commented on May 18, 2024

it seems working quite well. see the following logs:

...
2017/07/16 23:37:31 status.go:52: [info] run status http server 127.0.0.1:12800
2017/07/16 23:37:31 dump.go:114: [info] skip master data, get current binlog position (mysql-bin-changelog.023727, 422)
2017/07/16 23:37:31 dump.go:120: [info] try dump MySQL and parse
mysqldump: [Warning] Using a password on the command line interface can be insecure.
2017/07/16 23:39:52 dump.go:126: [info] dump MySQL and parse OK, use 140.72 seconds, start binlog replication at (mysql-bin-changelog.023727, 422)
2017/07/16 23:39:52 sync.go:21: [info] start sync binlog at (mysql-bin-changelog.023727, 422)
2017/07/16 23:39:52 binlogsyncer.go:268: [info] begin to sync binlog from position (mysql-bin-changelog.023727, 422)
...

thanks @siddontang

however seems to me using show master status to get binlog position seems superior than run mysqldump with --master-data, would it be better to always use it, so skip_master_data can be avoid?

from go-mysql-elasticsearch.

siddontang avatar siddontang commented on May 18, 2024

Hi @tpeng

Skipping master data will sync duplicated data if we insert new data before dumping although this may be not a big problem for ES.

The old mechanism has been running for a long time and it works well, I will remove the config later. Btw, you can send me a PR to do this :-)

from go-mysql-elasticsearch.

siddontang avatar siddontang commented on May 18, 2024

I will close the issue, it is fixed now.

from go-mysql-elasticsearch.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.