Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MYSQL- multi database host. MySQL client is not connected #248

Open
jagadeeshvidexcel opened this issue Apr 18, 2024 · 0 comments
Open

MYSQL- multi database host. MySQL client is not connected #248

jagadeeshvidexcel opened this issue Apr 18, 2024 · 0 comments

Comments

@jagadeeshvidexcel
Copy link

jagadeeshvidexcel commented Apr 18, 2024

Steps to reproduce

I have modified the apartment configuration to connect two different hosts. When active record get rollback. I got "MySQL client is not connected" error
Screenshot 2024-04-18 at 5 51 51 PM

/home/ubuntu/.rvm/gems/ruby-3.0.4@gemsetname/gems/mysql2-0.5.6/lib/mysql2/client.rb:151:in `_query': MySQL client is not connected (Mysql2::Error)
3.0.4 :009 >

Expected behavior

Should not disconnect MYSQL connection. Should return validation message.

System configuration

vendor: Amazon EC2 (ubuntu)
product: m5.xlarge

  • Database: (mysql Ver 8.0.36-0ubuntu0.20.04.1 for Linux on x86_64 ((Ubuntu)).)

  • Apartment version: ros-apartment (2.11.0)

  • Apartment config (in config/initializers/apartment.rb or so):

Apartment.configure do |config| 
  config.use_schemas = false
  config.database_schema_file = nil
  config.with_multi_server_setup = true
  config.tenant_names = { tenant1: {
          adapter:  'mysql2',
          database: 'tenant1',
          password: 'override_password',
          username: 'appuser',
          host:     'RDS-1-URL'
        },
        tenant2: {
          adapter:  'mysql2',
          database: 'tenant2',
          username: 'appuser',
         password: 'override_password',
         host:   'RDS-2-URL'
        }
      }.with_indifferent_access 
end
  • Rails (or ActiveRecord) version: activerecord (6.1.7.6)

  • Ruby version: ruby 3.0.4p208 (2022-04-12 revision 3fa771dded) [x86_64-linux]

If got any solution. Kindly correct me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant