问题
First time using cassandra, I have attempted to configue the yaml file according to other related posts but had no luck so far. Any idea how do so on the localhost?
The specified host(s) could not be reached.
All host(s) tried for query failed (tried: localhost/0:0:0:0:0:0:0:1:9042 (com.datastax.driver.core.TransportException: [localhost/0:0:0:0:0:0:0:1:9042] Cannot connect), localhost/127.0.0.1:9042 (com.datastax.driver.core.TransportException: [localhost/127.0.0.1:9042] Cannot connect))
  [localhost/0:0:0:0:0:0:0:1:9042] Cannot connect
  [localhost/127.0.0.1:9042] Cannot connect
回答1:
Inverse the process(s) you already executed. To run cassandra on localhost, you don't need to change anything so far. You don't need to change cassandra.yaml. It'll run by default on localhost. Read the documents carefully.
Learn more about cassandra.yaml:https://docs.datastax.com/en/cassandra/2.1/cassandra/configuration/configCassandra_yaml_r.html
回答2:
Maybe you can stop the Cassandra server and start it again.
bin/cassandra -f -R
Further this link helps understand https://docs.datastax.com/en/cassandra/2.1/cassandra/configuration/configCassandra_yaml_r.html
cassandra.yaml config parameters.
You can also make sure that the ports are set correctly native_transport(9042),native_transport_port_ssl(9142),Storage_port(7000),roc_port(9160) and JMX port(7199).
Lastly,
seeds - "127.0.0.1"
assuming you are working on single node cassandra setup.
回答3:
Might be your DataStax Cassandra Community Server windows service is stopped. So, start it and reconnect. i hope you get success. 
While you are trying to start this service and if it would stopped again then you have to delete the logs folder (where DataStax installed) and restart this service.
来源:https://stackoverflow.com/questions/40239278/cannot-connect-to-cassandra-on-localhost