OrientDB分布式模式:数据不会分布在各个节点上

时间:2016-08-23 19:01:32

标签: orientdb graph-databases orientdb2.2

我已经启动了一个带有两个节点的OrientDB Enterprise 2.7。以下是我的设置外观。

CONFIGURED SERVERS
+----+------+------+-----------+-------------------+---------------+---------------+-----------------+-----------------+---------+
|#   |Name  |Status|Connections|StartedOn          |Binary         |HTTP           |UsedMemory       |FreeMemory       |MaxMemory|
+----+------+------+-----------+-------------------+---------------+---------------+-----------------+-----------------+---------+
|0   |Batman|ONLINE|3          |2016-08-16 15:28:23|10.0.0.195:2424|10.0.0.195:2480|480.98MB (94.49%)|28.02MB (5.51%)  |509.00MB |
|1   |Robin |ONLINE|3          |2016-08-16 15:29:40|10.0.0.37:2424 |10.0.0.37:2480 |403.50MB (79.35%)|105.00MB (20.65%)|508.50MB |
+----+------+------+-----------+-------------------+---------------+---------------+-----------------+-----------------+---------+
orientdb {db=SocialPosts3}> clusters

现在我有两个Vertex类User和Notes。边缘类型已发布。所有顶点和边都有属性。 Vertex类上也有唯一的索引。

我开始使用Java API推送数据:

while (retry++ != MAX_RETRY) {
        try {
            properties.put(uniqueIndexname, uniqueIndexValue);
            Iterable<Vertex> resultset = graph.getVertices(className, new String[] { uniqueIndexname },
                    new Object[] { uniqueIndexValue });
            if (resultset != null) {
                vertex = resultset.iterator().hasNext() ? resultset.iterator().next() : null;
            }
            if (vertex == null) {
                vertex = graph.addVertex("class:" + className, properties);
                graph.commit();
                return vertex;
            } else {
                for (String key : properties.keySet()) {
                    vertex.setProperty(key, properties.get(key));
                }
            }
            logger.info("Completed upserting vertex " + uniqueIndexValue);
            graph.commit();
            break;
        } catch (ONeedRetryException ex) {
            logger.warn("Retry for exception - " + uniqueIndexValue);
        } catch (Exception e) {
            logger.error("Can not create vertex - " + e.getMessage());
            graph.rollback();
            break;
        }
    }

同样适用于Notes和边缘。 我填充了大约20万用户和3.5M笔记。现在我注意到所有数据只发送到一个节点。

在运行“clusters”命令时,我看到所有集群都在同一节点上创建,因此所有数据仅存在于一个节点上。

|22  |note       |  26|Note     |                 |     75|   Robin    |  [Batman]   |        true        |
|23  |note_1     |  27|Note     |                 |1750902|   Batman   |   [Robin]   |        true        |
|24  |note_2     |  28|Note     |                 |1750789|   Batman   |   [Robin]   |        true        |
|25  |note_3     |  29|Note     |                 |     75|   Robin    |  [Batman]   |        true        |
|26  |posted     |  34|Posted   |                 |      0|   Robin    |  [Batman]   |        true        |
|27  |posted_1   |  35|Posted   |                 |      1|   Robin    |  [Batman]   |        true        |
|28  |posted_2   |  36|Posted   |                 |1739823|   Batman   |   [Robin]   |        true        |
|29  |posted_3   |  37|Posted   |                 |1749250|   Batman   |   [Robin]   |        true        |
|30  |user       |  30|User     |                 | 102059|   Batman   |   [Robin]   |        true        |
|31  |user_1     |  31|User     |                 |      1|   Robin    |  [Batman]   |        true        |
|32  |user_2     |  32|User     |                 |      0|   Robin    |  [Batman]   |        true        |
|33  |user_3     |  33|User     |                 | 102127|   Batman   |   [Robin]   |        true        |

我看到一个节点的CPU是99%,其他是<1%。

如何确保数据在群集中的所有节点上均匀分布?

更新: 数据库传播到两个节点。我可以登录node studio并查看列出的数据库。查询任何节点也会得到相同的结果,因此节点是同步的。

服务器从其中一个节点记录,在另一个节点上几乎相同。

2016-08-18 19:28:49:668 INFO  [Robin]<-[Batman] Received new status Batman.SocialPosts3=SYNCHRONIZING [OHazelcastPlugin]
2016-08-18 19:28:49:670 INFO  [Robin] Current node started as MASTER for database 'SocialPosts3' [OHazelcastPlugin]
2016-08-18 19:28:49:671 INFO  [Robin] New distributed configuration for database: SocialPosts3 (version=2)

CLUSTER CONFIGURATION (LEGEND: X = Owner, o = Copy)
+--------+-----------+----------+-------------+
|        |           |          |   MASTER    |
|        |           |          |SYNCHRONIZING|
+--------+-----------+----------+-------------+
|CLUSTER |writeQuorum|readQuorum|   Batman    |
+--------+-----------+----------+-------------+
|*       |     1     |    1     |      X      |
|internal|     1     |    1     |             |
+--------+-----------+----------+-------------+

 [OHazelcastPlugin]
2016-08-18 19:28:49:671 INFO  [Robin] Saving distributed configuration file for database 'SocialPosts3' to: /mnt/ebs/orientdb/orientdb-enterprise-2.2.7/databases/SocialPosts3/distributed-config.json [OHazelcastPlugin]
2016-08-18 19:28:49:766 INFO  [Robin] Adding node 'Robin' in partition: SocialPosts3 db=[*] v=3 [ODistributedDatabaseImpl$1]
2016-08-18 19:28:49:767 INFO  [Robin] New distributed configuration for database: SocialPosts3 (version=3)

CLUSTER CONFIGURATION (LEGEND: X = Owner, o = Copy)
+--------+-----------+----------+-------------+-------------+
|        |           |          |   MASTER    |   MASTER    |
|        |           |          |SYNCHRONIZING|SYNCHRONIZING|
+--------+-----------+----------+-------------+-------------+
|CLUSTER |writeQuorum|readQuorum|   Batman    |    Robin    |
+--------+-----------+----------+-------------+-------------+
|*       |     2     |    1     |      X      |      o      |
|internal|     2     |    1     |             |             |
+--------+-----------+----------+-------------+-------------+

 [OHazelcastPlugin]
2016-08-18 19:28:49:767 INFO  [Robin] Saving distributed configuration file for database 'SocialPosts3' to: /mnt/ebs/orientdb/orientdb-enterprise-2.2.7/databases/SocialPosts3/distributed-config.json [OHazelcastPlugin]
2016-08-18 19:28:49:769 WARNI [Robin]->[[Batman]] Requesting deploy of database 'SocialPosts3' on local server... [OHazelcastPlugin]
2016-08-18 19:28:52:192 INFO  [Robin]<-[Batman] Copying remote database 'SocialPosts3' to: /tmp/orientdb/install_SocialPosts3.zip [OHazelcastPlugin]
2016-08-18 19:28:52:193 INFO  [Robin]<-[Batman] Installing database 'SocialPosts3' to: /mnt/ebs/orientdb/orientdb-enterprise-2.2.7/databases/SocialPosts3... [OHazelcastPlugin]
2016-08-18 19:28:52:193 INFO  [Robin] - writing chunk #1 offset=0 size=43.38KB [OHazelcastPlugin]
2016-08-18 19:28:52:194 INFO  [Robin] Database copied correctly, size=43.38KB [ODistributedAbstractPlugin$3]
2016-08-18 19:28:52:279 WARNI {db=SocialPosts3} Storage 'SocialPosts3' was not closed properly. Will try to recover from write ahead log [OEnterpriseLocalPaginatedStorage]
2016-08-18 19:28:52:279 SEVER {db=SocialPosts3} Restore is not possible because write ahead log is empty. [OEnterpriseLocalPaginatedStorage]
2016-08-18 19:28:52:279 INFO  {db=SocialPosts3} Storage data recover was completed [OEnterpriseLocalPaginatedStorage]
2016-08-18 19:28:52:294 INFO  {db=SocialPosts3} [Robin] Installed database 'SocialPosts3' (LSN=OLogSequenceNumber{segment=0, position=24}) [OHazelcastPlugin]
2016-08-18 19:28:52:304 INFO  [Robin] Reassigning cluster ownership for database SocialPosts3 [OHazelcastPlugin]
2016-08-18 19:28:52:305 INFO  [Robin] New distributed configuration for database: SocialPosts3 (version=3)

CLUSTER CONFIGURATION (LEGEND: X = Owner, o = Copy)
+--------+----+-----------+----------+-------------+-------------+
|        |    |           |          |   MASTER    |   MASTER    |
|        |    |           |          |SYNCHRONIZING|SYNCHRONIZING|
+--------+----+-----------+----------+-------------+-------------+
|CLUSTER |  id|writeQuorum|readQuorum|   Batman    |    Robin    |
+--------+----+-----------+----------+-------------+-------------+
|*       |    |     2     |    1     |      X      |      o      |
|internal|   0|     2     |    1     |             |             |
+--------+----+-----------+----------+-------------+-------------+

 [OHazelcastPlugin]
2016-08-18 19:28:52:305 INFO  [Robin] Distributed servers status:

+------+------+------------------------------------+-----+-------------------+---------------+---------------+--------------------------+
|Name  |Status|Databases                           |Conns|StartedOn          |Binary         |HTTP           |UsedMemory                |
+------+------+------------------------------------+-----+-------------------+---------------+---------------+--------------------------+
|Batman|ONLINE|GoodBoys=ONLINE (MASTER)            |5    |2016-08-16 15:28:23|10.0.0.195:2424|10.0.0.195:2480|426.47MB/509.00MB (83.79%)|
|      |      |SocialPosts=ONLINE (MASTER)         |     |                   |               |               |                          |
|      |      |GratefulDeadConcerts=ONLINE (MASTER)|     |                   |               |               |                          |
|Robin*|ONLINE|GoodBoys=ONLINE (MASTER)            |3    |2016-08-16 15:29:40|10.0.0.37:2424 |10.0.0.37:2480 |353.77MB/507.50MB (69.71%)|
|      |      |SocialPosts=ONLINE (MASTER)         |     |                   |               |               |                          |
|      |      |GratefulDeadConcerts=ONLINE (MASTER)|     |                   |               |               |                          |
|      |      |SocialPosts3=SYNCHRONIZING (MASTER) |     |                   |               |               |                          |
|      |      |SocialPosts2=ONLINE (MASTER)        |     |                   |               |               |                          |
+------+------+------------------------------------+-----+-------------------+---------------+---------------+--------------------------+

0 个答案:

没有答案