【问题标题】:How to change connection to Cassandra on Windows and make it remote?如何在 Windows 上更改与 Cassandra 的连接并使其远程?
【发布时间】:2015-06-16 17:15:00
【问题描述】:

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

它正在工作,但仅限于本地。怎么改?

一些解释:

要运行 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 正在本地运行。

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

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 连接吗?

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

【问题讨论】:

    标签: windows cassandra vpn nosql


    【解决方案1】:

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

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

    当然,正如你所提到的,你需要打开特定的端口(@98​​7654321@)来执行各种任务,例如远程监控、连接到集群以及执行 rpc 命令或 cql 会话。

    【讨论】:

      猜你喜欢
      • 2015-07-10
      • 1970-01-01
      • 1970-01-01
      • 2018-06-21
      • 2010-12-15
      • 2015-11-28
      • 2014-12-07
      • 2016-07-08
      • 1970-01-01
      相关资源
      最近更新 更多