Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/cassandra/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ubuntu 无法从远程主机连接到Cassandra_Ubuntu_Cassandra - Fatal编程技术网

Ubuntu 无法从远程主机连接到Cassandra

Ubuntu 无法从远程主机连接到Cassandra,ubuntu,cassandra,Ubuntu,Cassandra,我的主题行可能会说这是一个重复的问题,但事实并非如此。我已经尝试了所有可能的方法来搜索这个问题,但没有解决我的问题 我的电脑上运行的是Windows 8.1。我在上面使用Hyper-V安装了Ubuntu 16.04版本作为虚拟机。我已经在我的Ubuntu系统上安装了Cassandra 3.7 卡桑德拉能够从本地主机即Ubuntu系统进行连接。我创建了键空间和所有内容,但当我试图从下面的golang代码连接Casandra时,出现了错误 包干管 import ( "fmt" "lo

我的主题行可能会说这是一个重复的问题,但事实并非如此。我已经尝试了所有可能的方法来搜索这个问题,但没有解决我的问题

我的电脑上运行的是Windows 8.1。我在上面使用Hyper-V安装了Ubuntu 16.04版本作为虚拟机。我已经在我的Ubuntu系统上安装了Cassandra 3.7

卡桑德拉能够从本地主机即Ubuntu系统进行连接。我创建了键空间和所有内容,但当我试图从下面的golang代码连接Casandra时,出现了错误

包干管

import (
    "fmt"
    "log"

    "github.com/gocql/gocql"
)

func main() {
    // connect to the cluster
    cluster := gocql.NewCluster("192.168.137.217") //Put comma separated IPs in case of multiple cluster
    cluster.Keyspace = "broker_keyspace"
    cluster.Consistency = gocql.Quorum
    session, _ := cluster.CreateSession()
    defer session.Close()
}
192.168.137.217是我的虚拟机的IP地址。我得到的错误是不允许连接9042端口。这段代码是我试图从Windows8.1系统(Cassandra运行的虚拟机的主机)运行的。我确实尝试过telnet,但发现9042端口未打开,主机无法连接

我开始使用cassandra.yaml配置文件,但现在它甚至不适用于Ubuntu系统。我无法使用获取节点状态

nodetool status
我在cassandra.yaml文件中的公共配置如下所示

rpc_address: localhost
listen_address: localhost
我还取消了/etc/cassandra/cassandra-env.sh文件中下面一行的注释,并将公共名称更新为127.0.0.1

# add this if you're having trouble connecting:
JVM_OPTS="$JVM_OPTS -Djava.rmi.server.hostname=127.0.0.1"
我使用服务cassandra restart重新启动了cassandra,但是当我尝试nodetool status时,它给出了以下错误

nodetool:无法连接到“127.0.0.1:7199”-连接异常:“连接被拒绝”。

很抱歉问了这么长的问题,但请帮助我,我真的受够了这个问题,在过去的6-7个小时里一直在努力


谢谢..

您是否尝试过不使用本地主机,而是实际使用192.168.137.217地址来处理所有内容-JMX、rpc、listen等。。?那会是个问题吗?另外,假设这只是您电脑上的一个开发虚拟机-也许可以检查防火墙是否关闭?

您可以按照以下步骤解决上述问题

更改cassandra.yaml中的以下参数(
etc/cassandra/cassandra.yaml

和取消注释

broadcast_rpc_address: 1.2.3.4

谢谢你的回答。我不得不再次安装新的卡桑德拉版本。我确实把监听地址、广播地址改成了我提到的IP地址,它开始工作了。看起来像是我做了一些配置更改,但未能恢复。
broadcast_rpc_address: 1.2.3.4