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

getting error with cassandra-migrate status #37

Closed
DruGity opened this issue Aug 22, 2018 · 4 comments
Closed

getting error with cassandra-migrate status #37

DruGity opened this issue Aug 22, 2018 · 4 comments

Comments

@DruGity
Copy link

DruGity commented Aug 22, 2018

I have installed cassandra-migrate and created some default config file with migrations folder.
Config file:

#cassandra-migrate.yml
keyspace: mail_storage
profiles:
  dev:
    replication:
      class: SimpleStrategy
      replication_factor: 2
migrations_path: ./migrations 

And when i am trying commands like cassandra-migrate migrate <my .cql file> or cassandra-migrate status i am getting this error:
WARNING:cassandra.cluster:Cluster.init called with contact_points specified, but no load_balancing_policy. In the next major version, this will raise an error; please specify a load-balancing policy. (contact_points = [u'127.0.0.1'], lbp = None)
Traceback (most recent call last):
File "/home/aleksey-chudak/.local/bin/cassandra-migrate", line 18, in
main()
File "/home/aleksey-chudak/.local/lib/python2.7/site-packages/cassandra_migrate/cli.py", line 149, in main
cmd_method(opts)
File "/home/aleksey-chudak/.local/lib/python2.7/site-packages/cassandra_migrate/migrator.py", line 580, in status
ignore_concurrent=True)
File "/home/aleksey-chudak/.local/lib/python2.7/site-packages/cassandra_migrate/migrator.py", line 304, in _verify_migrations
'SELECT * FROM "{keyspace}"."{table}"'))
File "/home/aleksey-chudak/.local/lib/python2.7/site-packages/cassandra_migrate/migrator.py", line 236, in _execute
return self.session.execute(query, *args, **kwargs)
File "cassandra/cluster.py", line 2141, in cassandra.cluster.Session.execute
File "cassandra/cluster.py", line 4033, in cassandra.cluster.ResponseFuture.result
cassandra.cluster.NoHostAvailable: ('Unable to complete the operation against any hosts', {<Host: 127.0.0.1 datacenter1>: Unavailable('Error from server: code=1000 [Unavailable exception] message="Cannot achieve consistency level ALL" info={'required_replicas': 2, 'alive_replicas': 1, 'consistency': 'ALL'}',)})

May be i am missing some configs in my cassandra-migrate.yml?
By the way i am getting a warning like in an issue #32

@danielkza
Copy link
Contributor

danielkza commented Aug 22, 2018

The error you are seeing is coming from Cassandra itself: you are trying to create a keyspace with a replication factor of 2 in a cluster with only 1 node. While that is possible (if you are going to add more nodes afterwards), it is rarely the correct thing to do, and Cassandra-migrate tries to execute migrations with consistency level ALL, causing the creation to fail immediately.

You either need to add more nodes to your local cluster (ideally 3 to be able to form a quorum) or reduce the replication factor to 1. The load-balancing policy warning is inconsequential and unrelated to the error you are seeing.

I created #38 to track support for setting a custom consistency level. If you really did mean to create a keyspace in a partially configured cluster, please add a comment there to let me know. Cheers!

@DruGity
Copy link
Author

DruGity commented Aug 23, 2018

Thanx for reply @danielkza, but i have the same error with replication factor: 1.
Surprisingly for me problem was in dev environment. I just changed it to prod and all is ok.

@danielkza
Copy link
Contributor

@DruGity Did you change the replication factor of the dev profile to 1? In your example it is set to 2, and, as I said, that won't work with a 1-node cluster.

@DruGity
Copy link
Author

DruGity commented Aug 28, 2018

@danielkza Yeap, my fault. In dev profile it works only with replication factor set to 1 in my case. Thanks for help.

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

2 participants