hsgubert / cassandra_migrations

Cassandra Migrations is a Cassandra database schema migration library for Rails applications.
MIT License
45 stars 43 forks source link

cassandra:create does not work using a production system #76

Closed gabosgab closed 8 years ago

gabosgab commented 8 years ago

cassandra:create does not work in a production environment due to parameter checking on the NetworkToplogy strategy.

eprothro commented 8 years ago

Thanks @gabosgab. Could you be more specific about the issue or error?

It's typical for the initial database configuration (e.g. replication strategy, etc) to be migrated shortly after creation to a production configuration (e.g. via scripts managed in an ops repo). We use Cassandra Migrations to manage schema migrations (which are typically the same across environments), but manage database configuration migrations with other mechanisms.

gabosgab commented 8 years ago

@eprothro Yep!

I've had to work around the provider since the validation checks fail when using a provider such as Instaclustr for hosting. The username/password wasn't being picked up out of the cassandra.yml and the configuration validator would fail if you used NetworkTopologyStrategy and have a username/password. I wrote my own authenticator to get around the limitation. If you want, I can try and reproduce it again for you.

instaclustr_auth_provider.rb

require 'cassandra'

class InstaclustrAuthProvider < Cassandra::Auth::Providers::Password
  def create_authenticator(_)
    Authenticator.new(@username, @password)
  end
end

cassandra.yml

production:
  hosts:
    - "xxx.xx.xx.xx"
    - "xxx.xx.xx.xx"
    - "xxx.xx.xx.xx"
  port: 9042
  datacenter: xxxxxxx
  keyspace: xxxxx
  ssl: true
  username: xxxxxxxxx
  password: xxxxxxxxx
  auth_provider: InstaclustrAuthProivder
  replication:
    class: NetworkTopologyStrategy
    US_EAST_1: 3
bsbodden commented 8 years ago

It looks like #81 closes this. Reopen if incorrect. Thanks.