首页 文章

如何在Windows上更改与Cassandra的连接并使其远程?

提问于
浏览
1

我在Windows上设置了Cassandra并收到了几个问题:

它工作,但只有localy . 我该怎么改变它?

一些解释:

要运行cassandra,我正在运行cassandra.bat文件(来自C:\ Cassandra \ bin) . 它显示了一些信息,但也显示了这一点:

Starting listening for CQL client on localhost/127.0.0.1:9042
Binding thrift service to localhost/127.0.0.1:9060
Listhening for thrift clients...

据我了解,这意味着casssandra正在运行localy .

在我的应用程序中我有第二个代码:

using (var cluster = Cluster.Builder().AddContactPoint("localhost").Build())
            {
                using (var session = cluster.Connect())
                {
                    session.CreateKeyspaceIfNotExists("autoparks");
                    session.ChangeKeyspace("autoparks");

                    session.GetTable<tvehicle>().CreateIfNotExists();
                    session.GetTable<tvehicletype>().CreateIfNotExists();
                    session.GetTable<tdriver>().CreateIfNotExists();
                    session.GetTable<tfirma>().CreateIfNotExists();
                }
            }

我的问题是,现在我需要从另一台计算机运行我的应用程序,然后以某种方式进入运行cassandra的计算机 .

我读到我需要在防火墙中打开几个端口:9042和9160.但据我了解,我还需要将localhost更改为...到什么?它看起来怎么样?我还应该为它创建一些VPN连接吗?

请原谅我的愚蠢问题,但这对我来说真的很难 .

1 回答

  • 0

    编辑C:\ Cassandr \ conf文件夹中的cassandra.yaml文件 .

    具体来说,listen_address和rpc_address到您的公共或VPN IP地址而不是localhost . 另外,将start_rpc和start_native_transport值设置为“true” . 我认为您需要更改的最后一件事是“种子”属性,以反映群集中种子节点的相应IP地址 .

    当然,正如您所提到的,您需要打开特定端口(http://docs.datastax.com/en/cassandra/2.0/cassandra/security/secureFireWall_r.html)来执行各种任务,例如远程监视,连接到群集以及执行rpc命令或cql会话 .

相关问题