运行 AWS 分布式模式下的 OrientDB 不工作

Running OrientDB in distributed mode on AWS does not work

我在 AWS 上设置了 3 个 OrientDB (2.2.7) 节点。它们 运行 处于分布式模式。

每当我连接到端口 2424 上的服务器时,连接都会锁定在 pyorient

根据这个问题,我知道关于 运行在分布式模式下使用 OrientDB 的一些问题: Creating a database in Orientdb in distributed mode

为了避免任何问题,我运行按照文档的建议设置永久实例。

我还按照 hazelcast EC2 白皮书的建议将 EC2 实例配置为 "c3.4xlarge" 实例。 (Amazon_EC2_Deployment_Guide_v0.3_web.pdf)

我将 hazelcast.xml 配置为使用 tcp-ip 和 aws 发现策略,两者都提供了相同的结果。可以看到服务器通过 hazelcast 相互连接,发现工作正常。

我的用户附加了以下政策。

{
"Version": "2012-10-17",
"Statement": [
    {
        "Sid": "Stm7747196888759",
        "Action": [
            "ec2:DescribeInstances"
        ],
        "Effect": "Allow",
        "Resource": "*"
    }
]
}

每个都有 hazelcast.xml 配置如下:

<?xml version="1.0" encoding="UTF-8"?>
<hazelcast xsi:schemaLocation="http://www.hazelcast.com/schema/config hazelcast-config-3.7.xsd"
       xmlns="http://www.hazelcast.com/schema/config"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <group>
            <name>orientdb</name>
            <password>xxxxxxxxx</password>
    </group>
    <properties>
            <property name="hazelcast.local.localAddress">{{LOCAL_IP}}</property>
            <property name="hazelcast.icmp.enabled">true</property>
    </properties>
    <network>
            <public-address>{{PUBLIC_IP}}</public-address>
            <port auto-increment="true">2434</port>
            <join>
                    <multicast enabled="false">
                            <multicast-group>235.1.1.1</multicast-group>
                            <multicast-port>2434</multicast-port>
                    </multicast>
                    <tcp-ip enabled="true">
                            <member>57.xx.xx.165</member>
                            <member>57.xx.xx.236</member>
                            <member>57.xx.xx.133</member>
                    </tcp-ip>
                    <aws enabled="false">
                            <access-key>xxxx</access-key>
                            <secret-key>xxxx</secret-key>
                            <host-header>ec2.amazonaws.com</host-header>
                            <region>eu-west-1</region>
                    </aws>
            </join>
            <interfaces enabled="false">
                    <interface>{{LOCAL_IP}}</interface>
            </interfaces>
    </network>
    <executor-service>
            <pool-size>16</pool-size>
    </executor-service>
</hazelcast>

从我的hazelcast.xml可以看出,我也尝试将hazelcast升级到3.7版本。无论我使用哪个版本的 hazelcast,结果都是一样的。

我一连接到服务器,连接就被锁定了。服务器仍然可以在端口 2480 上正常工作。您仍然可以在浏览器中使用前端,但无法通过 pyorient 打开连接。

我们有一个大型数据库,每个月收集大约 250 万个顶点数据和大约 500 万条边。在分布式模式下 运行 对我们来说至关重要,因为单个服务器无法扩展到超出该容量的范围。目前的情况是,OrientDB 似乎有能力 运行 作为分布式数据库,但该功能似乎不起作用。

我们运行正在使用码头工具,但为了升级到 hazelcast 3.7,我们切换到了二进制文件。

有没有人能够让 OrientDB 以分布式方式在生产环境中工作,我们还缺少什么?

您使用的是 ec2 public ip 地址,而不是 ec2 私有 ip 地址。 Public IP 地址通常以 57 或 54 开头。私有 IP 地址通常以 10 开头。

这似乎不是 Hazelcast 或 AWS 的问题。 我的设置有 2 个问题。 第一个问题与 OrientDB 有关,没有刷新我的 distributed-config.json 的设置 默认分布式数据库-config.json。结果是,曾经连接到我的数据库的每个节点都被附加到该文件,并且我的默认分布式数据库的 none-config.json 设置反映在该配置中。

我添加了一个启动脚本来删除分布式的-config.json 每次我的服务器启动以刷新节点列表并更新我的设置。

第二个问题与 Pyorient 有关。 Pyorient 有一个错误,在分布式模式下它无法解析从 OrientDB 返回的消息。这会导致连接进入无限循环。

目前在 pyorient 上有一个开发分支,它实现了缺少的二进制序列化程序 (OrientSerialization.Binary)。我有另一个分支,其中合并了一些修复程序。

安装:

pip install https://github.com/anber500/pyorient/tarball/17f5e42e83859a661c6483f7fa812226194694dd#egg=pyorient

按如下方式设置序列化程序:

client = pyorient.OrientDB("localhost", 2424, serialization_type=pyorient.OrientSerialization.Binary)

您还需要 pyorient_native 的更新版本。第一个版本有内存泄漏,所以使用 master 分支的版本:

pip install https://github.com/nikulukani/pyorient_native/tarball/master#egg=pyorient_native

这在 AWS 上以分布式模式完美运行,并且比 CSV 序列化程序快得多。

希望对您有所帮助。