From 1c3794f151a99f9697de636cd30a4e509edf30a1 Mon Sep 17 00:00:00 2001 From: 145425491 <1245294786@qq.com> Date: Tue, 2 Jul 2024 10:17:48 +0800 Subject: [PATCH 01/40] fix(server): Random generate default jwt secret key --- .../apache/hugegraph/auth/StandardAuthManager.java | 1 + .../org/apache/hugegraph/config/AuthOptions.java | 12 +++++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/auth/StandardAuthManager.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/auth/StandardAuthManager.java index 6f84cbf290..8f05775ee7 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/auth/StandardAuthManager.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/auth/StandardAuthManager.java @@ -107,6 +107,7 @@ public StandardAuthManager(HugeGraphParams graph) { HugeAccess::fromEdge); this.tokenGenerator = new TokenGenerator(config); + LOG.info("Key of default JWT token is generated randomly now"); this.ipWhiteList = new HashSet<>(); diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/config/AuthOptions.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/config/AuthOptions.java index af04934610..045f00e65b 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/config/AuthOptions.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/config/AuthOptions.java @@ -21,6 +21,9 @@ import static org.apache.hugegraph.config.OptionChecker.rangeDouble; import static org.apache.hugegraph.config.OptionChecker.rangeInt; +import java.security.SecureRandom; +import java.util.Base64; + public class AuthOptions extends OptionHolder { private AuthOptions() { @@ -82,7 +85,7 @@ public static synchronized AuthOptions instance() { "through rpc forwarding. The remote url can be set to " + "multiple addresses, which are concat by ','.", null, - "" + generateRandomBase64Key() ); public static final ConfigOption AUTH_TOKEN_SECRET = @@ -126,4 +129,11 @@ public static synchronized AuthOptions instance() { rangeInt(0L, Long.MAX_VALUE), (3600 * 24L) ); + + private static String generateRandomBase64Key() { + SecureRandom random = new SecureRandom(); + byte[] bytes = new byte[32]; // 32 bytes for HMAC-SHA256 + random.nextBytes(bytes); + return Base64.getEncoder().encodeToString(bytes); + } } From 146046913f45be5076fa8893a5463eac8969f5be Mon Sep 17 00:00:00 2001 From: 145425491 <1245294786@qq.com> Date: Fri, 5 Jul 2024 15:16:43 +0800 Subject: [PATCH 02/40] fix(server): random generate default jwt secret key --- .../main/java/org/apache/hugegraph/config/AuthOptions.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/config/AuthOptions.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/config/AuthOptions.java index 045f00e65b..3cd27bf3f4 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/config/AuthOptions.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/config/AuthOptions.java @@ -85,7 +85,7 @@ public static synchronized AuthOptions instance() { "through rpc forwarding. The remote url can be set to " + "multiple addresses, which are concat by ','.", null, - generateRandomBase64Key() + "" ); public static final ConfigOption AUTH_TOKEN_SECRET = @@ -93,7 +93,7 @@ public static synchronized AuthOptions instance() { "auth.token_secret", "Secret key of HS256 algorithm.", disallowEmpty(), - "FXQXbJtbCLxODc6tGci732pkH1cyf8Qg" + generateRandomBase64Key() ); public static final ConfigOption AUTH_AUDIT_LOG_RATE = From 85c2b6df2e45279b6f25b34d2366ea77a2a53470 Mon Sep 17 00:00:00 2001 From: imbajin Date: Sat, 13 Jul 2024 20:28:51 +0800 Subject: [PATCH 03/40] Apply suggestions from code review --- .../java/org/apache/hugegraph/auth/StandardAuthManager.java | 2 +- .../src/main/java/org/apache/hugegraph/config/AuthOptions.java | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/auth/StandardAuthManager.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/auth/StandardAuthManager.java index 8f05775ee7..103c58afca 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/auth/StandardAuthManager.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/auth/StandardAuthManager.java @@ -107,7 +107,7 @@ public StandardAuthManager(HugeGraphParams graph) { HugeAccess::fromEdge); this.tokenGenerator = new TokenGenerator(config); - LOG.info("Key of default JWT token is generated randomly now"); + LOG.info("Randomly generate a JWT secret key now"); this.ipWhiteList = new HashSet<>(); diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/config/AuthOptions.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/config/AuthOptions.java index 3cd27bf3f4..c996082dab 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/config/AuthOptions.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/config/AuthOptions.java @@ -132,7 +132,8 @@ public static synchronized AuthOptions instance() { private static String generateRandomBase64Key() { SecureRandom random = new SecureRandom(); - byte[] bytes = new byte[32]; // 32 bytes for HMAC-SHA256 + // 32 bytes for HMAC-SHA256 + byte[] bytes = new byte[32]; random.nextBytes(bytes); return Base64.getEncoder().encodeToString(bytes); } From 0d507583c8a330b83abd021f7dfee6dff1b2d7de Mon Sep 17 00:00:00 2001 From: 145425491 <1245294786@qq.com> Date: Sun, 4 Aug 2024 20:45:00 +0800 Subject: [PATCH 04/40] feat(it): add basic miniCluster supports SimpleEnv --- hugegraph-it/hg-it-minicluster/pom.xml | 40 ++++ .../hugegraph/it/base/ClusterConstant.java | 52 +++++ .../org/apache/hugegraph/it/base/EnvType.java | 28 +++ .../hugegraph/it/base/HGTestLogger.java | 29 +++ .../hugegraph/it/config/ClusterConf.java | 22 ++ .../hugegraph/it/config/ClusterConfImpl.java | 22 ++ .../apache/hugegraph/it/env/AbstractEnv.java | 93 +++++++++ .../org/apache/hugegraph/it/env/BaseEnv.java | 31 +++ .../apache/hugegraph/it/env/SimpleEnv.java | 96 +++++++++ .../it/node/AbstractNodeWrapper.java | 189 ++++++++++++++++++ .../hugegraph/it/node/BaseNodeWrapper.java | 35 ++++ .../hugegraph/it/node/PDNodeWrapper.java | 152 ++++++++++++++ .../hugegraph/it/node/ServerNodeWrapper.java | 119 +++++++++++ .../hugegraph/it/node/StoreNodeWrapper.java | 130 ++++++++++++ hugegraph-it/pom.xml | 54 +++++ 15 files changed, 1092 insertions(+) create mode 100644 hugegraph-it/hg-it-minicluster/pom.xml create mode 100644 hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/base/ClusterConstant.java create mode 100644 hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/base/EnvType.java create mode 100644 hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/base/HGTestLogger.java create mode 100644 hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/config/ClusterConf.java create mode 100644 hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/config/ClusterConfImpl.java create mode 100644 hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/env/AbstractEnv.java create mode 100644 hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/env/BaseEnv.java create mode 100644 hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/env/SimpleEnv.java create mode 100644 hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/node/AbstractNodeWrapper.java create mode 100644 hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/node/BaseNodeWrapper.java create mode 100644 hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/node/PDNodeWrapper.java create mode 100644 hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/node/ServerNodeWrapper.java create mode 100644 hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/node/StoreNodeWrapper.java create mode 100644 hugegraph-it/pom.xml diff --git a/hugegraph-it/hg-it-minicluster/pom.xml b/hugegraph-it/hg-it-minicluster/pom.xml new file mode 100644 index 0000000000..e6eefd779b --- /dev/null +++ b/hugegraph-it/hg-it-minicluster/pom.xml @@ -0,0 +1,40 @@ + + + + + 4.0.0 + hg-it-minicluster + + + org.apache.hugegraph + hugegraph-it + ${revision} + + + + + 11 + 11 + UTF-8 + 2.17.0 + + + + diff --git a/hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/base/ClusterConstant.java b/hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/base/ClusterConstant.java new file mode 100644 index 0000000000..7b0eb27274 --- /dev/null +++ b/hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/base/ClusterConstant.java @@ -0,0 +1,52 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.hugegraph.it.base; + +import java.io.File; + +import org.apache.commons.lang3.SystemUtils; + +public class ClusterConstant { + + public static final String USER_DIR = "user.dir"; + public static final String TARGET = "target"; + public static final String LOG = "logs"; + + public static final String LIB_DIR = "lib"; + public static final String EXT_DIR = "ext"; + public static final String PLUGINS_DIR = "plugins"; + public static final String CONF_DIR = "conf"; + public static final String LOGS_DIR = "logs"; + public static final boolean OPEN_SECURITY_CHECK = true; + public static final boolean OPEN_TELEMETRY = false; + + public static final String TEMPLATE_NODE_DIR = + System.getProperty(USER_DIR) + File.separator + TARGET + File.separator + + "template-node"; + + public static final String JAVA_CMD = + System.getProperty("java.home") + + File.separator + + "bin" + + File.separator + + (SystemUtils.IS_OS_WINDOWS ? "java.exe" : "java"); + + private ClusterConstant() { + throw new IllegalStateException("Utility class"); + } +} diff --git a/hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/base/EnvType.java b/hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/base/EnvType.java new file mode 100644 index 0000000000..50194b1822 --- /dev/null +++ b/hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/base/EnvType.java @@ -0,0 +1,28 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.hugegraph.it.base; + +public enum EnvType { + Simple, + MultiNode; + + public static EnvType getSystemEnvType() { + String envType = System.getProperty("TestEnv", Simple.name()); + return EnvType.valueOf(envType); + } +} diff --git a/hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/base/HGTestLogger.java b/hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/base/HGTestLogger.java new file mode 100644 index 0000000000..66cef5b0bd --- /dev/null +++ b/hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/base/HGTestLogger.java @@ -0,0 +1,29 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.hugegraph.it.base; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import lombok.extern.slf4j.Slf4j; + +@Slf4j +public class HGTestLogger { + + public static Logger LOG = LoggerFactory.getLogger(HGTestLogger.class); +} diff --git a/hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/config/ClusterConf.java b/hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/config/ClusterConf.java new file mode 100644 index 0000000000..1e8a0cd257 --- /dev/null +++ b/hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/config/ClusterConf.java @@ -0,0 +1,22 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.hugegraph.it.config; + +public interface ClusterConf { + +} diff --git a/hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/config/ClusterConfImpl.java b/hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/config/ClusterConfImpl.java new file mode 100644 index 0000000000..569804b252 --- /dev/null +++ b/hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/config/ClusterConfImpl.java @@ -0,0 +1,22 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.hugegraph.it.config; + +public class ClusterConfImpl implements ClusterConf { + +} diff --git a/hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/env/AbstractEnv.java b/hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/env/AbstractEnv.java new file mode 100644 index 0000000000..25d5c7f23f --- /dev/null +++ b/hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/env/AbstractEnv.java @@ -0,0 +1,93 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.hugegraph.it.env; + +import java.util.ArrayList; +import java.util.List; + +import org.apache.hugegraph.it.base.HGTestLogger; +import org.apache.hugegraph.it.config.ClusterConf; +import org.apache.hugegraph.it.config.ClusterConfImpl; +import org.apache.hugegraph.it.node.PDNodeWrapper; +import org.apache.hugegraph.it.node.ServerNodeWrapper; +import org.apache.hugegraph.it.node.StoreNodeWrapper; +import org.slf4j.Logger; + +import lombok.extern.slf4j.Slf4j; + +@Slf4j +public abstract class AbstractEnv implements BaseEnv { + + private static final Logger LOG = HGTestLogger.LOG; + private final ClusterConf clusterConf; + protected List pdNodeWrappers; + protected List serverNodeWrappers; + protected List storeNodeWrappers; + protected int cluster_id = 0; + + public AbstractEnv() { + this.clusterConf = new ClusterConfImpl(); + this.pdNodeWrappers = new ArrayList<>(); + this.serverNodeWrappers = new ArrayList<>(); + this.storeNodeWrappers = new ArrayList<>(); + } + + protected void addPDNode(PDNodeWrapper pdNodeWrapper) { + this.pdNodeWrappers.add(pdNodeWrapper); + } + + protected void addStoreNode(StoreNodeWrapper storeNodeWrapper) { + this.storeNodeWrappers.add(storeNodeWrapper); + } + + protected void addServerNode(ServerNodeWrapper serverNodeWrapper) { + this.serverNodeWrappers.add(serverNodeWrapper); + } + + @Override + public void initCluster() { + for (PDNodeWrapper pdNodeWrapper : pdNodeWrappers) { + pdNodeWrapper.start(); + } + for (StoreNodeWrapper storeNodeWrapper : storeNodeWrappers) { + storeNodeWrapper.start(); + } + for (ServerNodeWrapper serverNodeWrapper : serverNodeWrappers) { + serverNodeWrapper.start(); + } + } + + @Override + public void clearCluster() { + for (PDNodeWrapper pdNodeWrapper : pdNodeWrappers) { + pdNodeWrapper.stop(); + } + for (StoreNodeWrapper storeNodeWrapper : storeNodeWrappers) { + storeNodeWrapper.stop(); + } + for (ServerNodeWrapper serverNodeWrapper : serverNodeWrappers) { + serverNodeWrapper.stop(); + } + } + + @Override + public ClusterConf getConf() { + return this.clusterConf; + } + +} diff --git a/hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/env/BaseEnv.java b/hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/env/BaseEnv.java new file mode 100644 index 0000000000..85c31a61e4 --- /dev/null +++ b/hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/env/BaseEnv.java @@ -0,0 +1,31 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.hugegraph.it.env; + +import org.apache.hugegraph.it.config.ClusterConf; + +public interface BaseEnv { + + /* init the cluster environment with simple mode */ + void initCluster(); + + /* clear the cluster env and all config*/ + void clearCluster(); + + ClusterConf getConf(); +} diff --git a/hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/env/SimpleEnv.java b/hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/env/SimpleEnv.java new file mode 100644 index 0000000000..f5f0bc03c7 --- /dev/null +++ b/hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/env/SimpleEnv.java @@ -0,0 +1,96 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.hugegraph.it.env; + +import java.io.File; + +import org.apache.hugegraph.it.node.PDNodeWrapper; +import org.apache.hugegraph.it.node.ServerNodeWrapper; +import org.apache.hugegraph.it.node.StoreNodeWrapper; + +public class SimpleEnv extends AbstractEnv { + + String pdWorkPath, pdConfigPath, storeWorkPath, storeConfigPath, serverWorkPath, + serverConfigPath; + + public SimpleEnv() { + PDNodeWrapper pdNodeWrapper = new PDNodeWrapper("127.0.0.1", 8686, 1, 1); + StoreNodeWrapper storeNodeWrapper = new StoreNodeWrapper(1, 1); + ServerNodeWrapper serverNodeWrapper = new ServerNodeWrapper(1, 1); + + pdWorkPath = + System.getProperty("user.dir") + + File.separator + + "hugegraph-pd" + + File.separator + + "dist" + + File.separator; + File directory = new File(pdWorkPath); + String osName = System.getProperty("os.name").toLowerCase(); + if (directory.exists() && directory.isDirectory() && !osName.contains("win")) { + File[] files = directory.listFiles(); + for (File file : files) { + if (file.getName().startsWith("hugegraph-pd") && file.isDirectory()) { + pdWorkPath += file.getName() + File.separator; + break; + } + } + } + pdNodeWrapper.updateWorkPath(pdWorkPath); + pdNodeWrapper.updateConfigPath(pdWorkPath); + super.addPDNode(pdNodeWrapper); + + storeWorkPath = System.getProperty("user.dir") + + File.separator + + "hugegraph-store" + + File.separator + + "dist" + + File.separator; + directory = new File(storeWorkPath); + if (directory.exists() && directory.isDirectory() && !osName.contains("win")) { + File[] files = directory.listFiles(); + for (File file : files) { + if (file.getName().startsWith("hugegraph-store") && file.isDirectory()) { + storeWorkPath += file.getName() + File.separator; + break; + } + } + } + storeNodeWrapper.updateWorkPath(storeWorkPath); + storeNodeWrapper.updateConfigPath(storeWorkPath); + super.addStoreNode(storeNodeWrapper); + + serverConfigPath = System.getProperty("user.dir") + + File.separator + + "hugegraph-server" + + File.separator; + directory = new File(serverConfigPath); + if (directory.exists() && directory.isDirectory() && !osName.contains("win")) { + File[] files = directory.listFiles(); + for (File file : files) { + if (file.getName().startsWith("apache-hugegraph") && file.isDirectory()) { + serverConfigPath += file.getName() + File.separator; + break; + } + } + } + serverNodeWrapper.updateWorkPath(serverConfigPath); + serverNodeWrapper.updateConfigPath(serverConfigPath); + super.addServerNode(serverNodeWrapper); + } +} diff --git a/hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/node/AbstractNodeWrapper.java b/hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/node/AbstractNodeWrapper.java new file mode 100644 index 0000000000..3105fd3098 --- /dev/null +++ b/hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/node/AbstractNodeWrapper.java @@ -0,0 +1,189 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.hugegraph.it.node; + +import static org.apache.hugegraph.it.base.ClusterConstant.TARGET; +import static org.apache.hugegraph.it.base.ClusterConstant.TEMPLATE_NODE_DIR; +import static org.apache.hugegraph.it.base.ClusterConstant.USER_DIR; + +import java.io.File; +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.LinkOption; +import java.nio.file.NoSuchFileException; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.nio.file.StandardCopyOption; +import java.util.Properties; +import java.util.concurrent.TimeUnit; +import java.util.stream.Stream; + +import org.apache.commons.io.FileUtils; +import org.apache.commons.io.file.PathUtils; +import org.apache.hugegraph.it.base.ClusterConstant; +import org.apache.hugegraph.it.base.HGTestLogger; +import org.slf4j.Logger; + +public abstract class AbstractNodeWrapper implements BaseNodeWrapper { + + protected static final Logger LOG = HGTestLogger.LOG; + + protected final String host; + protected final int port; + protected final Properties properties = new Properties(); + protected final long startTime; + protected int clusterIndex; + protected String workPath; + protected String configPath; + protected Process instance; + protected int cnt; + + public AbstractNodeWrapper() { + this.startTime = System.currentTimeMillis(); + this.clusterIndex = 1; + this.host = "127.0.0.1"; + this.port = 8086; + } + + protected AbstractNodeWrapper(String host, int port, int clusterIndex, int cnt) { + this.host = host; + this.port = port; + this.clusterIndex = clusterIndex; + this.startTime = System.currentTimeMillis(); + this.cnt = cnt; + } + + /** + * Node Dir should be created before changing Config + */ + @Override + public void createNodeDir() { + String destDir = getNodePath(); + try { + try { + if (new File(destDir).exists()) { + PathUtils.delete(Paths.get(destDir)); + } + } catch (NoSuchFileException fileException) { + //no need to handle + } + // To avoid following symbolic links + try (Stream stream = Files.walk(Paths.get(TEMPLATE_NODE_DIR))) { + stream.forEach( + source -> { + Path destination = + Paths.get(destDir, + source.toString() + .substring(TEMPLATE_NODE_DIR.length())); + try { + Files.copy(source, + destination, + LinkOption.NOFOLLOW_LINKS, + StandardCopyOption.COPY_ATTRIBUTES); + } catch (IOException ioException) { + LOG.error("Fail to copy files to node dest dir", ioException); + throw new RuntimeException(ioException); + } + } + ); + } + } catch (IOException ioException) { + LOG.error("Got error copying files to node dest dir", ioException); + throw new AssertionError(); + } + } + + @Override + public void createLogDir() { + String logPath = getLogPath(); + try { + FileUtils.createParentDirectories(new File(logPath)); + } catch (IOException e) { + LOG.error("Create log dir failed", e); + throw new AssertionError(); + } + } + + public void deleteDir() { + try { + PathUtils.deleteDirectory(Paths.get(getNodePath())); + } catch (IOException ex) { + try { + TimeUnit.SECONDS.sleep(1); + } catch (InterruptedException e) { + Thread.currentThread().interrupt(); + ex.printStackTrace(); + throw new AssertionError("Delete node dir failed. " + e); + } + } + } + + /** + * @return (user.dir).target.id + */ + public String getNodePath() { + return System.getProperty(USER_DIR) + File.separator + TARGET + File.separator + + getID(); + } + + public String getLogPath() { + return System.getProperty(USER_DIR) + File.separator + TARGET + File.separator + + getID() + File.separator + ClusterConstant.LOG; + } + + protected boolean isJava11OrHigher() { + String version = System.getProperty("java.version"); + if (version.startsWith("1.")) { + version = version.substring(2, 3); + } else { + int dot = version.indexOf("."); + if (dot != -1) { + version = version.substring(0, dot); + } + } + int versionNumber = Integer.parseInt(version); + return versionNumber >= 11; + } + + public void updateWorkPath(String workPath) { + this.workPath = workPath; + } + + public void updateConfigPath(String ConfigPath) { + this.configPath = ConfigPath; + } + + public void stop() { + if (this.instance == null) { + return; + } + this.instance.destroy(); + try { + if (!this.instance.waitFor(20, TimeUnit.SECONDS)) { + this.instance.destroyForcibly().waitFor(10, TimeUnit.SECONDS); + } + } catch (InterruptedException e) { + Thread.currentThread().interrupt(); + LOG.error("Waiting node to shutdown error.", e); + } + } + + public boolean isAlive() { + return this.instance.isAlive(); + } +} diff --git a/hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/node/BaseNodeWrapper.java b/hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/node/BaseNodeWrapper.java new file mode 100644 index 0000000000..a3da50830e --- /dev/null +++ b/hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/node/BaseNodeWrapper.java @@ -0,0 +1,35 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.hugegraph.it.node; + +public interface BaseNodeWrapper { + + void createNodeDir(); + + void createLogDir(); + + void deleteDir(); + + void start(); + + void stop(); + + boolean isAlive(); + + String getID(); +} diff --git a/hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/node/PDNodeWrapper.java b/hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/node/PDNodeWrapper.java new file mode 100644 index 0000000000..4d7552b085 --- /dev/null +++ b/hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/node/PDNodeWrapper.java @@ -0,0 +1,152 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.hugegraph.it.node; + +import static org.apache.hugegraph.it.base.ClusterConstant.JAVA_CMD; + +import java.io.File; +import java.io.IOException; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import org.apache.commons.io.FileUtils; +import org.apache.hugegraph.pd.config.PDConfig; + +public class PDNodeWrapper extends AbstractNodeWrapper { + + private PDConfig pdConfig; + + public PDNodeWrapper() { + pdConfig = new PDConfig(); + } + + public PDNodeWrapper(String host, int grpcPort, int clusterIndex, int cnt) { + super(host, grpcPort, clusterIndex, cnt); + } + + @Override + public void createNodeDir() { + super.createNodeDir(); + } + + @Override + public void createLogDir() { + super.createLogDir(); + } + + @Override + public void deleteDir() { + super.deleteDir(); + } + + public void updatePDConfig(PDConfig pdConfig) { + this.pdConfig = pdConfig; + } + + public void updateServerPost(int serverPort) { + this.pdConfig.getRaft().setPort(serverPort); + } + + public void updateDataPath(String dataPath) { + this.pdConfig.setDataPath(dataPath); + } + + public void updatePatrolInterval(int patrolInterval) { + this.pdConfig.setPatrolInterval(patrolInterval); + } + + public void updateInitialStoreList(String storeList) { + this.pdConfig.setInitialStoreList(storeList); + } + + public void updateInitialStoreCount(int minStoreCount) { + this.pdConfig.setMinStoreCount(minStoreCount); + } + + public void updateRaftAddress(String raftAdd) { + this.pdConfig.getRaft().setAddress(raftAdd); + } + + public void updatePeersList(String peersList) { + this.pdConfig.getRaft().setPeersList(peersList); + } + + /* + workPath is path of JAR package, configPath is path of config files + */ + @Override + public void start() { + try { + File stdoutFile = new File(getLogPath()); + List startCmd = new ArrayList<>(); + startCmd.add(JAVA_CMD); + if (!isJava11OrHigher()) { + LOG.error("Please make sure that the JDK is installed and the version >= 11"); + return; + } + String pdNodeJarPath = workPath + "lib" + File.separator; + File jarDir = new File(pdNodeJarPath); + File[] jarFiles = jarDir.listFiles(); + for (File jarFile : jarFiles) { + if (jarFile.getName().startsWith("hg-pd-service")) { + pdNodeJarPath += jarFile.getName(); + break; + } + } + startCmd.addAll( + Arrays.asList( + "-Dname=HugeGraphPD" + this.cnt, + "-Xms512m", + "-Xmx4g", + "-XX:+HeapDumpOnOutOfMemoryError", + "-XX:HeapDumpPath=" + workPath + "logs", + "-Dlog4j.configurationFile=" + configPath + "conf" + File.separator + + "log4j2.xml", + "-Dspring.config.location=" + configPath + "conf" + File.separator + + "application.yml", + "-jar", pdNodeJarPath)); + FileUtils.write( + stdoutFile, String.join(" ", startCmd) + "\n\n", StandardCharsets.UTF_8, true); + ProcessBuilder processBuilder = + new ProcessBuilder(startCmd) + .redirectOutput(ProcessBuilder.Redirect.appendTo(stdoutFile)) + .redirectError(ProcessBuilder.Redirect.appendTo(stdoutFile)); + processBuilder.directory(new File(configPath)); + this.instance = processBuilder.start(); + } catch (IOException ex) { + throw new AssertionError("Start node failed. " + ex); + } + } + + @Override + public void stop() { + super.stop(); + } + + @Override + public boolean isAlive() { + return super.isAlive(); + } + + @Override + public String getID() { + return "PD" + this.cnt; + } +} diff --git a/hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/node/ServerNodeWrapper.java b/hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/node/ServerNodeWrapper.java new file mode 100644 index 0000000000..fb2870ca66 --- /dev/null +++ b/hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/node/ServerNodeWrapper.java @@ -0,0 +1,119 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.hugegraph.it.node; + +import static org.apache.hugegraph.it.base.ClusterConstant.EXT_DIR; +import static org.apache.hugegraph.it.base.ClusterConstant.JAVA_CMD; +import static org.apache.hugegraph.it.base.ClusterConstant.LIB_DIR; +import static org.apache.hugegraph.it.base.ClusterConstant.PLUGINS_DIR; + +import java.io.File; +import java.io.IOException; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import org.apache.commons.io.FileUtils; + +public class ServerNodeWrapper extends AbstractNodeWrapper { + + public ServerNodeWrapper(int clusterIndex, int cnt) { + this.clusterIndex = clusterIndex; + this.cnt = cnt; + } + + private static void addJarsToClasspath(File directory, List classpath) { + if (directory.exists() && directory.isDirectory()) { + File[] files = directory.listFiles((dir, name) -> name.endsWith(".jar")); + if (files != null) { + for (File file : files) { + classpath.add(file.getAbsolutePath()); + } + } + } + } + + @Override + public void createNodeDir() { + super.createNodeDir(); + } + + @Override + public void createLogDir() { + super.createLogDir(); + } + + @Override + public void deleteDir() { + super.deleteDir(); + } + + @Override + public void start() { + try { + File stdoutFile = new File(getLogPath()); + List startCmd = new ArrayList<>(); + startCmd.add(JAVA_CMD); + if (!isJava11OrHigher()) { + LOG.error("Please make sure that the JDK is installed and the version >= 11"); + return; + } + + List classpath = new ArrayList<>(); + addJarsToClasspath(new File(configPath + LIB_DIR), classpath); + addJarsToClasspath(new File(configPath + EXT_DIR), classpath); + addJarsToClasspath(new File(configPath + PLUGINS_DIR), classpath); + String storeClassPath = + String.join(":", classpath); + startCmd.addAll( + Arrays.asList( + "-Dname=HugeGraphServer" + this.cnt, + "--add-exports=java.base/jdk.internal.reflect=ALL-UNNAMED", + "-cp", storeClassPath, + "org.apache.hugegraph.dist.HugeGraphServer", + "conf/gremlin-server.yaml", + "conf/rest-server.properties")); + FileUtils.write( + stdoutFile, String.join(" ", startCmd) + "\n\n", StandardCharsets.UTF_8, true); + ProcessBuilder processBuilder = + new ProcessBuilder(startCmd) + .redirectOutput(ProcessBuilder.Redirect.appendTo(stdoutFile)) + .redirectError(ProcessBuilder.Redirect.appendTo(stdoutFile)); + processBuilder.directory(new File(configPath)); + this.instance = processBuilder.start(); + } catch (IOException ex) { + throw new AssertionError("Start node failed. " + ex); + } + } + + @Override + public void stop() { + super.stop(); + } + + @Override + public boolean isAlive() { + return super.isAlive(); + } + + @Override + public String getID() { + return "Server" + this.cnt; + } +} diff --git a/hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/node/StoreNodeWrapper.java b/hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/node/StoreNodeWrapper.java new file mode 100644 index 0000000000..1befa3b5e5 --- /dev/null +++ b/hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/node/StoreNodeWrapper.java @@ -0,0 +1,130 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.hugegraph.it.node; + +import static org.apache.hugegraph.it.base.ClusterConstant.JAVA_CMD; + +import java.io.File; +import java.io.IOException; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import org.apache.commons.io.FileUtils; + +public class StoreNodeWrapper extends AbstractNodeWrapper { + + protected StoreNodeWrapper(String host, int port, int clusterIndex, int cnt) { + super(host, port, clusterIndex, cnt); + } + + public StoreNodeWrapper(int clusterId, int cnt) { + this.clusterIndex = clusterId; + this.cnt = cnt; + } + + @Override + public void createNodeDir() { + super.createNodeDir(); + } + + @Override + public void createLogDir() { + super.createLogDir(); + } + + @Override + public void deleteDir() { + super.deleteDir(); + } + + @Override + public void start() { + try { + File stdoutFile = new File(getLogPath()); + List startCmd = new ArrayList<>(); + startCmd.add(JAVA_CMD); + if (!isJava11OrHigher()) { + LOG.error("Please make sure that the JDK is installed and the version >= 11"); + return; + } + //String libPath = + // System.getProperty("user.dir") + // + File.separator + // + "hugegraph-pd" + // + File.separator + // + "dist" + // + File.separator; + //File directory = new File(workPath); + //String osName = System.getProperty("os.name").toLowerCase(); + String storeNodeJarPath = workPath + "lib" + File.separator; + File jarDir = new File(storeNodeJarPath); + File[] jarFiles = jarDir.listFiles(); + for (File jarFile : jarFiles) { + if (jarFile.getName().startsWith("hg-store-node")) { + storeNodeJarPath += jarFile.getName(); + break; + } + } + startCmd.addAll( + Arrays.asList( + "-Dname=HugeGraphStore" + this.cnt, + "-Dlog4j.configurationFile=" + configPath + + "conf/log4j2.xml", + "-Dfastjson.parser.safeMode=true", + "-Xms512m", + "-Xmx2048m", + "-XX:MetaspaceSize=256M", + "-XX:+UseG1GC", + "-XX:+ParallelRefProcEnabled", + "-XX:+HeapDumpOnOutOfMemoryError", + "-XX:HeapDumpPath=" + workPath + "logs", + "-Xlog:gc=info:file=./logs/gc.log:tags,uptime,level:filecount=3," + + "filesize=100m", + "-Dspring.config.location=" + configPath + "conf" + File.separator + + "application.yml", + "-jar", storeNodeJarPath)); + FileUtils.write( + stdoutFile, String.join(" ", startCmd) + "\n\n", StandardCharsets.UTF_8, true); + ProcessBuilder processBuilder = + new ProcessBuilder(startCmd) + .redirectOutput(ProcessBuilder.Redirect.appendTo(stdoutFile)) + .redirectError(ProcessBuilder.Redirect.appendTo(stdoutFile)); + processBuilder.directory(new File(configPath)); + this.instance = processBuilder.start(); + } catch (IOException ex) { + throw new AssertionError("Start node failed. " + ex); + } + } + + @Override + public void stop() { + super.stop(); + } + + @Override + public boolean isAlive() { + return super.isAlive(); + } + + @Override + public String getID() { + return "Store" + this.clusterIndex; + } +} diff --git a/hugegraph-it/pom.xml b/hugegraph-it/pom.xml new file mode 100644 index 0000000000..6af5ebb84f --- /dev/null +++ b/hugegraph-it/pom.xml @@ -0,0 +1,54 @@ + + + + + 4.0.0 + + hugegraph-it + ${revision} + pom + + + org.apache.hugegraph + hugegraph + ${revision} + ../pom.xml + + + + hg-it-minicluster + + + + 11 + 11 + UTF-8 + apache-${release.name}-incubating-it-${project.version} + + + + + com.google.code.findbugs + jsr305 + 3.0.2 + + + + From d7d3fc7231116c74d8d6672e37a3f3db973a1039 Mon Sep 17 00:00:00 2001 From: 145425491 <1245294786@qq.com> Date: Wed, 7 Aug 2024 16:49:46 +0800 Subject: [PATCH 05/40] feat(it): add dist to generate configuration files --- hugegraph-it/hugegraph-it-dist/pom.xml | 49 ++++++++++++++++++++++++++ hugegraph-it/pom.xml | 1 + pom.xml | 3 +- 3 files changed, 52 insertions(+), 1 deletion(-) create mode 100644 hugegraph-it/hugegraph-it-dist/pom.xml diff --git a/hugegraph-it/hugegraph-it-dist/pom.xml b/hugegraph-it/hugegraph-it-dist/pom.xml new file mode 100644 index 0000000000..e162c7c57f --- /dev/null +++ b/hugegraph-it/hugegraph-it-dist/pom.xml @@ -0,0 +1,49 @@ + + + + + 4.0.0 + + org.apache.hugegraph + hugegraph-it + ${revision} + ../pom.xml + + + hugegraph-it-dist + + + ${project.parent.basedir} + bash + ${project.basedir}/src/assembly + ${assembly.dir}/descriptor + ${assembly.dir}/static + hg-it + + + + + org.apache.hugegraph + hg-it-minicluster + ${revision} + + + + \ No newline at end of file diff --git a/hugegraph-it/pom.xml b/hugegraph-it/pom.xml index 6af5ebb84f..313713141a 100644 --- a/hugegraph-it/pom.xml +++ b/hugegraph-it/pom.xml @@ -34,6 +34,7 @@ hg-it-minicluster + hugegraph-it-dist diff --git a/pom.xml b/pom.xml index 0f8bc3e228..5259e2e71c 100644 --- a/pom.xml +++ b/pom.xml @@ -15,7 +15,7 @@ See the License for the specific language governing permissions and limitations under the License. --> - 4.0.0 org.apache.hugegraph @@ -99,6 +99,7 @@ hugegraph-pd hugegraph-store install-dist + hugegraph-it From c21c9364a22720facca80231a6316e9730a7b6b8 Mon Sep 17 00:00:00 2001 From: 145425491 <1245294786@qq.com> Date: Thu, 8 Aug 2024 22:47:40 +0800 Subject: [PATCH 06/40] chore(it): move the path in Env Object to ClusterConstant --- .../{hugegraph-it-dist => hg-it-dist}/pom.xml | 33 ++++++- hugegraph-it/hg-it-minicluster/pom.xml | 28 +++++- .../hugegraph/it/base/ClusterConstant.java | 93 +++++++++++++++++++ .../apache/hugegraph/it/env/SimpleEnv.java | 71 +++----------- .../hugegraph/it/node/PDNodeWrapper.java | 6 ++ hugegraph-it/pom.xml | 2 +- 6 files changed, 171 insertions(+), 62 deletions(-) rename hugegraph-it/{hugegraph-it-dist => hg-it-dist}/pom.xml (62%) diff --git a/hugegraph-it/hugegraph-it-dist/pom.xml b/hugegraph-it/hg-it-dist/pom.xml similarity index 62% rename from hugegraph-it/hugegraph-it-dist/pom.xml rename to hugegraph-it/hg-it-dist/pom.xml index e162c7c57f..ded39a4529 100644 --- a/hugegraph-it/hugegraph-it-dist/pom.xml +++ b/hugegraph-it/hg-it-dist/pom.xml @@ -27,7 +27,7 @@ ../pom.xml - hugegraph-it-dist + hg-it-dist ${project.parent.basedir} @@ -38,6 +38,35 @@ hg-it + + + + maven-assembly-plugin + 2.4 + + + assembly-hugegraph-it + package + + single + + + false + false + ${dist.dir} + + + ${assembly.descriptor.dir}/assembly.xml + + + ${final.name} + + + + + + + org.apache.hugegraph @@ -46,4 +75,4 @@ - \ No newline at end of file + diff --git a/hugegraph-it/hg-it-minicluster/pom.xml b/hugegraph-it/hg-it-minicluster/pom.xml index e6eefd779b..6c082e0c9e 100644 --- a/hugegraph-it/hg-it-minicluster/pom.xml +++ b/hugegraph-it/hg-it-minicluster/pom.xml @@ -35,6 +35,32 @@ UTF-8 2.17.0 - + + + + org.apache.commons + commons-lang3 + 3.13.0 + compile + + + commons-io + commons-io + 2.12.0 + compile + + + org.slf4j + slf4j-api + 2.0.9 + compile + + + org.apache.hugegraph + hg-pd-core + 1.5.0.1 + compile + + diff --git a/hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/base/ClusterConstant.java b/hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/base/ClusterConstant.java index 7b0eb27274..dca6677951 100644 --- a/hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/base/ClusterConstant.java +++ b/hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/base/ClusterConstant.java @@ -26,14 +26,24 @@ public class ClusterConstant { public static final String USER_DIR = "user.dir"; public static final String TARGET = "target"; public static final String LOG = "logs"; + public static final String SIMPLE = "simple"; + public static final String MULTI = "multi"; public static final String LIB_DIR = "lib"; public static final String EXT_DIR = "ext"; public static final String PLUGINS_DIR = "plugins"; + public static final String CONF_DIR = "conf"; public static final String LOGS_DIR = "logs"; public static final boolean OPEN_SECURITY_CHECK = true; public static final boolean OPEN_TELEMETRY = false; + public static final boolean IS_WINDOWS = SystemUtils.IS_OS_WINDOWS; + public static final String PD_PACKAGE_PREFIX = "hugegraph-pd"; + public static final String PD_JAR_PREFIX = "hg-pd-service"; + public static final String STORE_PACKAGE_PREFIX = "hugegraph-store"; + public static final String STORE_JAR_PREFIX = "hg-store-node"; + public static final String SERVER_PACKAGE_PREFIX = "apache-hugegraph-incubating"; + public static final String IT_PACKAGE_PREFIX = "apache-hugegraph-incubating-it"; public static final String TEMPLATE_NODE_DIR = System.getProperty(USER_DIR) + File.separator + TARGET + File.separator @@ -46,7 +56,90 @@ public class ClusterConstant { + File.separator + (SystemUtils.IS_OS_WINDOWS ? "java.exe" : "java"); + public static final String PD_DIST_PATH = + System.getProperty("user.dir") + + File.separator + + "hugegraph-pd" + + File.separator + + "dist" + + File.separator; + + public static final String PD_WORK_PATH = + getFileInDir(PD_DIST_PATH, PD_PACKAGE_PREFIX) + + File.separator + + "lib" + + File.separator; + + public static final String STORE_DIST_PATH = + System.getProperty("user.dir") + + File.separator + + "hugegraph-store" + + File.separator + + "dist" + + File.separator; + + public static final String STORE_WORK_PATH = + getFileInDir(STORE_DIST_PATH, STORE_PACKAGE_PREFIX) + + File.separator + + "lib" + + File.separator; + + public static final String SERVER_DIST_PATH = + System.getProperty("user.dir") + + File.separator + + "hugegraph-server" + + File.separator; + + public static final String SERVER_WORK_PATH = + getFileInDir(SERVER_DIST_PATH, SERVER_PACKAGE_PREFIX) + + File.separator; + + public static final String IT_DIST_PATH = + System.getProperty("user.dir") + + File.separator + + "hugegraph-it" + + File.separator; + + public static final String IT_CONFIG_PATH = + getFileInDir(IT_DIST_PATH, IT_PACKAGE_PREFIX) + + File.separator + + CONF_DIR + + File.separator; + + public static final String SIMPLE_PD_CONFIG_PATH = + IT_CONFIG_PATH + + SIMPLE + + File.separator + + "pd" + + File.separator; + + public static final String SIMPLE_STORE_CONFIG_PATH = + IT_CONFIG_PATH + + SIMPLE + + File.separator + + "store" + + File.separator; + + public static final String SIMPLE_SERVER_CONFIG_PATH = + IT_CONFIG_PATH + + SIMPLE + + File.separator + + "server" + + File.separator; + private ClusterConstant() { throw new IllegalStateException("Utility class"); } + + public static String getFileInDir(String path, String fileName) { + File dir = new File(path); + if (dir.exists() && dir.isDirectory()) { + for (File file : dir.listFiles()) { + if (file.getName().startsWith(fileName)) { + return path + file.getName(); + } + } + } + return ""; + } } diff --git a/hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/env/SimpleEnv.java b/hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/env/SimpleEnv.java index f5f0bc03c7..d33724931b 100644 --- a/hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/env/SimpleEnv.java +++ b/hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/env/SimpleEnv.java @@ -17,7 +17,12 @@ package org.apache.hugegraph.it.env; -import java.io.File; +import static org.apache.hugegraph.it.base.ClusterConstant.PD_WORK_PATH; +import static org.apache.hugegraph.it.base.ClusterConstant.SERVER_WORK_PATH; +import static org.apache.hugegraph.it.base.ClusterConstant.SIMPLE_PD_CONFIG_PATH; +import static org.apache.hugegraph.it.base.ClusterConstant.SIMPLE_SERVER_CONFIG_PATH; +import static org.apache.hugegraph.it.base.ClusterConstant.SIMPLE_STORE_CONFIG_PATH; +import static org.apache.hugegraph.it.base.ClusterConstant.STORE_WORK_PATH; import org.apache.hugegraph.it.node.PDNodeWrapper; import org.apache.hugegraph.it.node.ServerNodeWrapper; @@ -25,72 +30,22 @@ public class SimpleEnv extends AbstractEnv { - String pdWorkPath, pdConfigPath, storeWorkPath, storeConfigPath, serverWorkPath, - serverConfigPath; - public SimpleEnv() { PDNodeWrapper pdNodeWrapper = new PDNodeWrapper("127.0.0.1", 8686, 1, 1); StoreNodeWrapper storeNodeWrapper = new StoreNodeWrapper(1, 1); ServerNodeWrapper serverNodeWrapper = new ServerNodeWrapper(1, 1); - pdWorkPath = - System.getProperty("user.dir") - + File.separator - + "hugegraph-pd" - + File.separator - + "dist" - + File.separator; - File directory = new File(pdWorkPath); - String osName = System.getProperty("os.name").toLowerCase(); - if (directory.exists() && directory.isDirectory() && !osName.contains("win")) { - File[] files = directory.listFiles(); - for (File file : files) { - if (file.getName().startsWith("hugegraph-pd") && file.isDirectory()) { - pdWorkPath += file.getName() + File.separator; - break; - } - } - } - pdNodeWrapper.updateWorkPath(pdWorkPath); - pdNodeWrapper.updateConfigPath(pdWorkPath); + pdNodeWrapper.updateWorkPath(PD_WORK_PATH); + pdNodeWrapper.updateConfigPath(SIMPLE_PD_CONFIG_PATH); super.addPDNode(pdNodeWrapper); - storeWorkPath = System.getProperty("user.dir") - + File.separator - + "hugegraph-store" - + File.separator - + "dist" - + File.separator; - directory = new File(storeWorkPath); - if (directory.exists() && directory.isDirectory() && !osName.contains("win")) { - File[] files = directory.listFiles(); - for (File file : files) { - if (file.getName().startsWith("hugegraph-store") && file.isDirectory()) { - storeWorkPath += file.getName() + File.separator; - break; - } - } - } - storeNodeWrapper.updateWorkPath(storeWorkPath); - storeNodeWrapper.updateConfigPath(storeWorkPath); + storeNodeWrapper.updateWorkPath(STORE_WORK_PATH); + storeNodeWrapper.updateConfigPath(SIMPLE_STORE_CONFIG_PATH); super.addStoreNode(storeNodeWrapper); - serverConfigPath = System.getProperty("user.dir") - + File.separator - + "hugegraph-server" - + File.separator; - directory = new File(serverConfigPath); - if (directory.exists() && directory.isDirectory() && !osName.contains("win")) { - File[] files = directory.listFiles(); - for (File file : files) { - if (file.getName().startsWith("apache-hugegraph") && file.isDirectory()) { - serverConfigPath += file.getName() + File.separator; - break; - } - } - } - serverNodeWrapper.updateWorkPath(serverConfigPath); - serverNodeWrapper.updateConfigPath(serverConfigPath); + serverNodeWrapper.updateWorkPath(SERVER_WORK_PATH); + serverNodeWrapper.updateConfigPath(SIMPLE_SERVER_CONFIG_PATH); super.addServerNode(serverNodeWrapper); } + } diff --git a/hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/node/PDNodeWrapper.java b/hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/node/PDNodeWrapper.java index 4d7552b085..7e3a4535b8 100644 --- a/hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/node/PDNodeWrapper.java +++ b/hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/node/PDNodeWrapper.java @@ -27,6 +27,7 @@ import java.util.List; import org.apache.commons.io.FileUtils; +import org.apache.hugegraph.it.base.ClusterConstant; import org.apache.hugegraph.pd.config.PDConfig; public class PDNodeWrapper extends AbstractNodeWrapper { @@ -135,6 +136,11 @@ public void start() { } } + @Override + public String getLogPath() { + return this.workPath + ClusterConstant.LOG + File.separator + "pd-start.log"; + } + @Override public void stop() { super.stop(); diff --git a/hugegraph-it/pom.xml b/hugegraph-it/pom.xml index 313713141a..d5b10d93da 100644 --- a/hugegraph-it/pom.xml +++ b/hugegraph-it/pom.xml @@ -34,7 +34,7 @@ hg-it-minicluster - hugegraph-it-dist + hg-it-dist From ab08c68f9cd2c8c6922c063e2268cca07d2357b5 Mon Sep 17 00:00:00 2001 From: 145425491 <1245294786@qq.com> Date: Thu, 8 Aug 2024 23:33:01 +0800 Subject: [PATCH 07/40] chore(it): move the path in Env Object to ClusterConstant --- .../hugegraph/it/base/ClusterConstant.java | 8 +++++- .../it/node/AbstractNodeWrapper.java | 5 ++-- .../hugegraph/it/node/PDNodeWrapper.java | 26 ++++------------- .../hugegraph/it/node/ServerNodeWrapper.java | 10 +++---- .../hugegraph/it/node/StoreNodeWrapper.java | 28 ++++--------------- 5 files changed, 26 insertions(+), 51 deletions(-) diff --git a/hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/base/ClusterConstant.java b/hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/base/ClusterConstant.java index dca6677951..a58c4850f6 100644 --- a/hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/base/ClusterConstant.java +++ b/hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/base/ClusterConstant.java @@ -67,7 +67,7 @@ public class ClusterConstant { public static final String PD_WORK_PATH = getFileInDir(PD_DIST_PATH, PD_PACKAGE_PREFIX) + File.separator - + "lib" + + LIB_DIR + File.separator; public static final String STORE_DIST_PATH = @@ -127,6 +127,12 @@ public class ClusterConstant { + "server" + File.separator; + public static final String IT_LOG_PATH = + getFileInDir(IT_DIST_PATH, IT_PACKAGE_PREFIX) + + File.separator + + LOG + + File.separator; + private ClusterConstant() { throw new IllegalStateException("Utility class"); } diff --git a/hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/node/AbstractNodeWrapper.java b/hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/node/AbstractNodeWrapper.java index 3105fd3098..127d610dab 100644 --- a/hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/node/AbstractNodeWrapper.java +++ b/hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/node/AbstractNodeWrapper.java @@ -17,6 +17,7 @@ package org.apache.hugegraph.it.node; +import static org.apache.hugegraph.it.base.ClusterConstant.IT_LOG_PATH; import static org.apache.hugegraph.it.base.ClusterConstant.TARGET; import static org.apache.hugegraph.it.base.ClusterConstant.TEMPLATE_NODE_DIR; import static org.apache.hugegraph.it.base.ClusterConstant.USER_DIR; @@ -35,7 +36,6 @@ import org.apache.commons.io.FileUtils; import org.apache.commons.io.file.PathUtils; -import org.apache.hugegraph.it.base.ClusterConstant; import org.apache.hugegraph.it.base.HGTestLogger; import org.slf4j.Logger; @@ -142,8 +142,7 @@ public String getNodePath() { } public String getLogPath() { - return System.getProperty(USER_DIR) + File.separator + TARGET + File.separator + - getID() + File.separator + ClusterConstant.LOG; + return IT_LOG_PATH + getID() + "-start.log"; } protected boolean isJava11OrHigher() { diff --git a/hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/node/PDNodeWrapper.java b/hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/node/PDNodeWrapper.java index 7e3a4535b8..70502ee96b 100644 --- a/hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/node/PDNodeWrapper.java +++ b/hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/node/PDNodeWrapper.java @@ -18,6 +18,8 @@ package org.apache.hugegraph.it.node; import static org.apache.hugegraph.it.base.ClusterConstant.JAVA_CMD; +import static org.apache.hugegraph.it.base.ClusterConstant.PD_JAR_PREFIX; +import static org.apache.hugegraph.it.base.ClusterConstant.getFileInDir; import java.io.File; import java.io.IOException; @@ -27,7 +29,6 @@ import java.util.List; import org.apache.commons.io.FileUtils; -import org.apache.hugegraph.it.base.ClusterConstant; import org.apache.hugegraph.pd.config.PDConfig; public class PDNodeWrapper extends AbstractNodeWrapper { @@ -102,26 +103,16 @@ public void start() { LOG.error("Please make sure that the JDK is installed and the version >= 11"); return; } - String pdNodeJarPath = workPath + "lib" + File.separator; - File jarDir = new File(pdNodeJarPath); - File[] jarFiles = jarDir.listFiles(); - for (File jarFile : jarFiles) { - if (jarFile.getName().startsWith("hg-pd-service")) { - pdNodeJarPath += jarFile.getName(); - break; - } - } + String pdNodeJarPath = getFileInDir(workPath, PD_JAR_PREFIX); startCmd.addAll( Arrays.asList( "-Dname=HugeGraphPD" + this.cnt, "-Xms512m", "-Xmx4g", "-XX:+HeapDumpOnOutOfMemoryError", - "-XX:HeapDumpPath=" + workPath + "logs", - "-Dlog4j.configurationFile=" + configPath + "conf" + File.separator + - "log4j2.xml", - "-Dspring.config.location=" + configPath + "conf" + File.separator + - "application.yml", + "-XX:HeapDumpPath=" + configPath + "logs", + "-Dlog4j.configurationFile=" + configPath + "log4j2.xml", + "-Dspring.config.location=" + configPath + "application.yml", "-jar", pdNodeJarPath)); FileUtils.write( stdoutFile, String.join(" ", startCmd) + "\n\n", StandardCharsets.UTF_8, true); @@ -136,11 +127,6 @@ public void start() { } } - @Override - public String getLogPath() { - return this.workPath + ClusterConstant.LOG + File.separator + "pd-start.log"; - } - @Override public void stop() { super.stop(); diff --git a/hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/node/ServerNodeWrapper.java b/hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/node/ServerNodeWrapper.java index fb2870ca66..b2cd20f88a 100644 --- a/hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/node/ServerNodeWrapper.java +++ b/hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/node/ServerNodeWrapper.java @@ -76,9 +76,9 @@ public void start() { } List classpath = new ArrayList<>(); - addJarsToClasspath(new File(configPath + LIB_DIR), classpath); - addJarsToClasspath(new File(configPath + EXT_DIR), classpath); - addJarsToClasspath(new File(configPath + PLUGINS_DIR), classpath); + addJarsToClasspath(new File(workPath + LIB_DIR), classpath); + addJarsToClasspath(new File(workPath + EXT_DIR), classpath); + addJarsToClasspath(new File(workPath + PLUGINS_DIR), classpath); String storeClassPath = String.join(":", classpath); startCmd.addAll( @@ -87,8 +87,8 @@ public void start() { "--add-exports=java.base/jdk.internal.reflect=ALL-UNNAMED", "-cp", storeClassPath, "org.apache.hugegraph.dist.HugeGraphServer", - "conf/gremlin-server.yaml", - "conf/rest-server.properties")); + "./gremlin-server.yaml", + "./rest-server.properties")); FileUtils.write( stdoutFile, String.join(" ", startCmd) + "\n\n", StandardCharsets.UTF_8, true); ProcessBuilder processBuilder = diff --git a/hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/node/StoreNodeWrapper.java b/hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/node/StoreNodeWrapper.java index 1befa3b5e5..16ba049607 100644 --- a/hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/node/StoreNodeWrapper.java +++ b/hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/node/StoreNodeWrapper.java @@ -18,6 +18,8 @@ package org.apache.hugegraph.it.node; import static org.apache.hugegraph.it.base.ClusterConstant.JAVA_CMD; +import static org.apache.hugegraph.it.base.ClusterConstant.STORE_JAR_PREFIX; +import static org.apache.hugegraph.it.base.ClusterConstant.getFileInDir; import java.io.File; import java.io.IOException; @@ -64,29 +66,12 @@ public void start() { LOG.error("Please make sure that the JDK is installed and the version >= 11"); return; } - //String libPath = - // System.getProperty("user.dir") - // + File.separator - // + "hugegraph-pd" - // + File.separator - // + "dist" - // + File.separator; - //File directory = new File(workPath); - //String osName = System.getProperty("os.name").toLowerCase(); - String storeNodeJarPath = workPath + "lib" + File.separator; - File jarDir = new File(storeNodeJarPath); - File[] jarFiles = jarDir.listFiles(); - for (File jarFile : jarFiles) { - if (jarFile.getName().startsWith("hg-store-node")) { - storeNodeJarPath += jarFile.getName(); - break; - } - } + String storeNodeJarPath = getFileInDir(workPath, STORE_JAR_PREFIX); startCmd.addAll( Arrays.asList( "-Dname=HugeGraphStore" + this.cnt, "-Dlog4j.configurationFile=" + configPath + - "conf/log4j2.xml", + "log4j2.xml", "-Dfastjson.parser.safeMode=true", "-Xms512m", "-Xmx2048m", @@ -94,11 +79,10 @@ public void start() { "-XX:+UseG1GC", "-XX:+ParallelRefProcEnabled", "-XX:+HeapDumpOnOutOfMemoryError", - "-XX:HeapDumpPath=" + workPath + "logs", + "-XX:HeapDumpPath=" + configPath + "logs", "-Xlog:gc=info:file=./logs/gc.log:tags,uptime,level:filecount=3," + "filesize=100m", - "-Dspring.config.location=" + configPath + "conf" + File.separator + - "application.yml", + "-Dspring.config.location=" + configPath + "application.yml", "-jar", storeNodeJarPath)); FileUtils.write( stdoutFile, String.join(" ", startCmd) + "\n\n", StandardCharsets.UTF_8, true); From efa6c9c7810e97f1a89dc4349b928b3bef45f6e1 Mon Sep 17 00:00:00 2001 From: 145425491 <1245294786@qq.com> Date: Thu, 8 Aug 2024 23:51:40 +0800 Subject: [PATCH 08/40] chore(it): move the path in Env Object to ClusterConstant --- hugegraph-it/hg-it-minicluster/pom.xml | 2 +- .../hugegraph/it/base/ClusterConstant.java | 2 +- .../hugegraph/it/node/StoreNodeWrapper.java | 4 +- hugegraph-it/hg-it-test/pom.xml | 45 +++++++++++++++++++ hugegraph-it/pom.xml | 1 + 5 files changed, 50 insertions(+), 4 deletions(-) create mode 100644 hugegraph-it/hg-it-test/pom.xml diff --git a/hugegraph-it/hg-it-minicluster/pom.xml b/hugegraph-it/hg-it-minicluster/pom.xml index 6c082e0c9e..075e1763d9 100644 --- a/hugegraph-it/hg-it-minicluster/pom.xml +++ b/hugegraph-it/hg-it-minicluster/pom.xml @@ -58,7 +58,7 @@ org.apache.hugegraph hg-pd-core - 1.5.0.1 + ${revision} compile diff --git a/hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/base/ClusterConstant.java b/hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/base/ClusterConstant.java index a58c4850f6..2df894806e 100644 --- a/hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/base/ClusterConstant.java +++ b/hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/base/ClusterConstant.java @@ -141,7 +141,7 @@ public static String getFileInDir(String path, String fileName) { File dir = new File(path); if (dir.exists() && dir.isDirectory()) { for (File file : dir.listFiles()) { - if (file.getName().startsWith(fileName)) { + if (file.getName().startsWith(fileName) && !file.getName().endsWith(".gz")) { return path + file.getName(); } } diff --git a/hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/node/StoreNodeWrapper.java b/hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/node/StoreNodeWrapper.java index 16ba049607..0106645d26 100644 --- a/hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/node/StoreNodeWrapper.java +++ b/hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/node/StoreNodeWrapper.java @@ -80,8 +80,8 @@ public void start() { "-XX:+ParallelRefProcEnabled", "-XX:+HeapDumpOnOutOfMemoryError", "-XX:HeapDumpPath=" + configPath + "logs", - "-Xlog:gc=info:file=./logs/gc.log:tags,uptime,level:filecount=3," + - "filesize=100m", + //"-Xlog:gc=info:file=./logs/gc.log:tags,uptime,level:filecount=3," + + //"filesize=100m", "-Dspring.config.location=" + configPath + "application.yml", "-jar", storeNodeJarPath)); FileUtils.write( diff --git a/hugegraph-it/hg-it-test/pom.xml b/hugegraph-it/hg-it-test/pom.xml new file mode 100644 index 0000000000..bb6d30015e --- /dev/null +++ b/hugegraph-it/hg-it-test/pom.xml @@ -0,0 +1,45 @@ + + + + + 4.0.0 + + org.apache.hugegraph + hugegraph-it + 1.5.0 + + + hg-it-test + + + 11 + 11 + UTF-8 + + + + org.apache.hugegraph + hg-it-minicluster + ${revision} + compile + + + + \ No newline at end of file diff --git a/hugegraph-it/pom.xml b/hugegraph-it/pom.xml index d5b10d93da..ce0d21cb81 100644 --- a/hugegraph-it/pom.xml +++ b/hugegraph-it/pom.xml @@ -35,6 +35,7 @@ hg-it-minicluster hg-it-dist + hg-it-test From 1ef2cd0eae388397577cfc3dfb5b420d23aba586 Mon Sep 17 00:00:00 2001 From: 145425491 <1245294786@qq.com> Date: Fri, 9 Aug 2024 15:16:00 +0800 Subject: [PATCH 09/40] feat(it): add the config and implement of multiEnv --- .../src/assembly/descriptor/assembly.xml | 64 ++++++++ .../static/multi/pd/A/conf/application.yml | 79 ++++++++++ .../multi/pd/A/conf/application.yml.template | 71 +++++++++ .../static/multi/pd/A/conf/hugegraph.license | Bin 0 -> 1499 bytes .../static/multi/pd/A/conf/log4j2.xml | 135 ++++++++++++++++ .../multi/pd/A/conf/verify-license.json | 6 + .../static/multi/pd/B/conf/application.yml | 79 ++++++++++ .../multi/pd/B/conf/application.yml.template | 71 +++++++++ .../static/multi/pd/B/conf/hugegraph.license | Bin 0 -> 1499 bytes .../static/multi/pd/B/conf/log4j2.xml | 135 ++++++++++++++++ .../multi/pd/B/conf/verify-license.json | 6 + .../static/multi/pd/C/conf/application.yml | 79 ++++++++++ .../multi/pd/C/conf/application.yml.template | 71 +++++++++ .../static/multi/pd/C/conf/hugegraph.license | Bin 0 -> 1499 bytes .../static/multi/pd/C/conf/log4j2.xml | 135 ++++++++++++++++ .../multi/pd/C/conf/verify-license.json | 6 + .../static/multi/server/A/conf/computer.yaml | 39 +++++ .../server/A/conf/graphs/hugegraph.properties | 126 +++++++++++++++ .../A/conf/gremlin-driver-settings.yaml | 25 +++ .../multi/server/A/conf/gremlin-server.yaml | 127 +++++++++++++++ .../server/A/conf/hugegraph-server.keystore | Bin 0 -> 1733 bytes .../static/multi/server/A/conf/log4j2.xml | 144 ++++++++++++++++++ .../multi/server/A/conf/remote-objects.yaml | 30 ++++ .../static/multi/server/A/conf/remote.yaml | 25 +++ .../server/A/conf/rest-server.properties | 70 +++++++++ .../static/multi/server/B/conf/computer.yaml | 39 +++++ .../server/B/conf/graphs/hugegraph.properties | 126 +++++++++++++++ .../B/conf/gremlin-driver-settings.yaml | 25 +++ .../multi/server/B/conf/gremlin-server.yaml | 127 +++++++++++++++ .../server/B/conf/hugegraph-server.keystore | Bin 0 -> 1733 bytes .../static/multi/server/B/conf/log4j2.xml | 144 ++++++++++++++++++ .../multi/server/B/conf/remote-objects.yaml | 30 ++++ .../static/multi/server/B/conf/remote.yaml | 25 +++ .../server/B/conf/rest-server.properties | 70 +++++++++ .../static/multi/server/C/conf/computer.yaml | 39 +++++ .../server/C/conf/graphs/hugegraph.properties | 126 +++++++++++++++ .../C/conf/gremlin-driver-settings.yaml | 25 +++ .../multi/server/C/conf/gremlin-server.yaml | 127 +++++++++++++++ .../server/C/conf/hugegraph-server.keystore | Bin 0 -> 1733 bytes .../static/multi/server/C/conf/log4j2.xml | 144 ++++++++++++++++++ .../multi/server/C/conf/remote-objects.yaml | 30 ++++ .../static/multi/server/C/conf/remote.yaml | 25 +++ .../server/C/conf/rest-server.properties | 70 +++++++++ .../multi/store/A/conf/application-pd.yml | 34 +++++ .../static/multi/store/A/conf/application.yml | 64 ++++++++ .../static/multi/store/A/conf/log4j2.xml | 137 +++++++++++++++++ .../multi/store/B/conf/application-pd.yml | 34 +++++ .../static/multi/store/B/conf/application.yml | 64 ++++++++ .../static/multi/store/B/conf/log4j2.xml | 137 +++++++++++++++++ .../multi/store/C/conf/application-pd.yml | 34 +++++ .../static/multi/store/C/conf/application.yml | 64 ++++++++ .../static/multi/store/C/conf/log4j2.xml | 137 +++++++++++++++++ .../static/simple/pd/conf/application.yml | 79 ++++++++++ .../simple/pd/conf/application.yml.template | 72 +++++++++ .../assembly/static/simple/pd/conf/log4j2.xml | 135 ++++++++++++++++ .../static/simple/pd/conf/verify-license.json | 6 + .../static/simple/server/conf/computer.yaml | 39 +++++ .../server/conf/graphs/hugegraph.properties | 109 +++++++++++++ .../server/conf/gremlin-driver-settings.yaml | 25 +++ .../simple/server/conf/gremlin-server.yaml | 127 +++++++++++++++ .../static/simple/server/conf/log4j2.xml | 144 ++++++++++++++++++ .../simple/server/conf/remote-objects.yaml | 30 ++++ .../static/simple/server/conf/remote.yaml | 25 +++ .../simple/server/conf/rest-server.properties | 71 +++++++++ .../simple/store/conf/application-pd.yml | 34 +++++ .../static/simple/store/conf/application.yml | 64 ++++++++ .../static/simple/store/conf/log4j2.xml | 137 +++++++++++++++++ hugegraph-it/hg-it-minicluster/pom.xml | 6 +- .../hugegraph/it/base/ClusterConstant.java | 114 ++++++++++++-- .../apache/hugegraph/it/env/SimpleEnv.java | 12 +- .../it/node/AbstractNodeWrapper.java | 14 -- .../hugegraph/it/node/PDNodeWrapper.java | 73 ++------- .../hugegraph/it/node/ServerNodeWrapper.java | 30 +--- .../hugegraph/it/node/StoreNodeWrapper.java | 36 +---- hugegraph-it/hg-it-test/pom.xml | 4 +- 75 files changed, 4629 insertions(+), 157 deletions(-) create mode 100644 hugegraph-it/hg-it-dist/src/assembly/descriptor/assembly.xml create mode 100644 hugegraph-it/hg-it-dist/src/assembly/static/multi/pd/A/conf/application.yml create mode 100644 hugegraph-it/hg-it-dist/src/assembly/static/multi/pd/A/conf/application.yml.template create mode 100644 hugegraph-it/hg-it-dist/src/assembly/static/multi/pd/A/conf/hugegraph.license create mode 100644 hugegraph-it/hg-it-dist/src/assembly/static/multi/pd/A/conf/log4j2.xml create mode 100644 hugegraph-it/hg-it-dist/src/assembly/static/multi/pd/A/conf/verify-license.json create mode 100644 hugegraph-it/hg-it-dist/src/assembly/static/multi/pd/B/conf/application.yml create mode 100644 hugegraph-it/hg-it-dist/src/assembly/static/multi/pd/B/conf/application.yml.template create mode 100644 hugegraph-it/hg-it-dist/src/assembly/static/multi/pd/B/conf/hugegraph.license create mode 100644 hugegraph-it/hg-it-dist/src/assembly/static/multi/pd/B/conf/log4j2.xml create mode 100644 hugegraph-it/hg-it-dist/src/assembly/static/multi/pd/B/conf/verify-license.json create mode 100644 hugegraph-it/hg-it-dist/src/assembly/static/multi/pd/C/conf/application.yml create mode 100644 hugegraph-it/hg-it-dist/src/assembly/static/multi/pd/C/conf/application.yml.template create mode 100644 hugegraph-it/hg-it-dist/src/assembly/static/multi/pd/C/conf/hugegraph.license create mode 100644 hugegraph-it/hg-it-dist/src/assembly/static/multi/pd/C/conf/log4j2.xml create mode 100644 hugegraph-it/hg-it-dist/src/assembly/static/multi/pd/C/conf/verify-license.json create mode 100644 hugegraph-it/hg-it-dist/src/assembly/static/multi/server/A/conf/computer.yaml create mode 100644 hugegraph-it/hg-it-dist/src/assembly/static/multi/server/A/conf/graphs/hugegraph.properties create mode 100644 hugegraph-it/hg-it-dist/src/assembly/static/multi/server/A/conf/gremlin-driver-settings.yaml create mode 100644 hugegraph-it/hg-it-dist/src/assembly/static/multi/server/A/conf/gremlin-server.yaml create mode 100644 hugegraph-it/hg-it-dist/src/assembly/static/multi/server/A/conf/hugegraph-server.keystore create mode 100644 hugegraph-it/hg-it-dist/src/assembly/static/multi/server/A/conf/log4j2.xml create mode 100644 hugegraph-it/hg-it-dist/src/assembly/static/multi/server/A/conf/remote-objects.yaml create mode 100644 hugegraph-it/hg-it-dist/src/assembly/static/multi/server/A/conf/remote.yaml create mode 100644 hugegraph-it/hg-it-dist/src/assembly/static/multi/server/A/conf/rest-server.properties create mode 100644 hugegraph-it/hg-it-dist/src/assembly/static/multi/server/B/conf/computer.yaml create mode 100644 hugegraph-it/hg-it-dist/src/assembly/static/multi/server/B/conf/graphs/hugegraph.properties create mode 100644 hugegraph-it/hg-it-dist/src/assembly/static/multi/server/B/conf/gremlin-driver-settings.yaml create mode 100644 hugegraph-it/hg-it-dist/src/assembly/static/multi/server/B/conf/gremlin-server.yaml create mode 100644 hugegraph-it/hg-it-dist/src/assembly/static/multi/server/B/conf/hugegraph-server.keystore create mode 100644 hugegraph-it/hg-it-dist/src/assembly/static/multi/server/B/conf/log4j2.xml create mode 100644 hugegraph-it/hg-it-dist/src/assembly/static/multi/server/B/conf/remote-objects.yaml create mode 100644 hugegraph-it/hg-it-dist/src/assembly/static/multi/server/B/conf/remote.yaml create mode 100644 hugegraph-it/hg-it-dist/src/assembly/static/multi/server/B/conf/rest-server.properties create mode 100644 hugegraph-it/hg-it-dist/src/assembly/static/multi/server/C/conf/computer.yaml create mode 100644 hugegraph-it/hg-it-dist/src/assembly/static/multi/server/C/conf/graphs/hugegraph.properties create mode 100644 hugegraph-it/hg-it-dist/src/assembly/static/multi/server/C/conf/gremlin-driver-settings.yaml create mode 100644 hugegraph-it/hg-it-dist/src/assembly/static/multi/server/C/conf/gremlin-server.yaml create mode 100644 hugegraph-it/hg-it-dist/src/assembly/static/multi/server/C/conf/hugegraph-server.keystore create mode 100644 hugegraph-it/hg-it-dist/src/assembly/static/multi/server/C/conf/log4j2.xml create mode 100644 hugegraph-it/hg-it-dist/src/assembly/static/multi/server/C/conf/remote-objects.yaml create mode 100644 hugegraph-it/hg-it-dist/src/assembly/static/multi/server/C/conf/remote.yaml create mode 100644 hugegraph-it/hg-it-dist/src/assembly/static/multi/server/C/conf/rest-server.properties create mode 100644 hugegraph-it/hg-it-dist/src/assembly/static/multi/store/A/conf/application-pd.yml create mode 100644 hugegraph-it/hg-it-dist/src/assembly/static/multi/store/A/conf/application.yml create mode 100644 hugegraph-it/hg-it-dist/src/assembly/static/multi/store/A/conf/log4j2.xml create mode 100644 hugegraph-it/hg-it-dist/src/assembly/static/multi/store/B/conf/application-pd.yml create mode 100644 hugegraph-it/hg-it-dist/src/assembly/static/multi/store/B/conf/application.yml create mode 100644 hugegraph-it/hg-it-dist/src/assembly/static/multi/store/B/conf/log4j2.xml create mode 100644 hugegraph-it/hg-it-dist/src/assembly/static/multi/store/C/conf/application-pd.yml create mode 100644 hugegraph-it/hg-it-dist/src/assembly/static/multi/store/C/conf/application.yml create mode 100644 hugegraph-it/hg-it-dist/src/assembly/static/multi/store/C/conf/log4j2.xml create mode 100644 hugegraph-it/hg-it-dist/src/assembly/static/simple/pd/conf/application.yml create mode 100644 hugegraph-it/hg-it-dist/src/assembly/static/simple/pd/conf/application.yml.template create mode 100644 hugegraph-it/hg-it-dist/src/assembly/static/simple/pd/conf/log4j2.xml create mode 100644 hugegraph-it/hg-it-dist/src/assembly/static/simple/pd/conf/verify-license.json create mode 100644 hugegraph-it/hg-it-dist/src/assembly/static/simple/server/conf/computer.yaml create mode 100644 hugegraph-it/hg-it-dist/src/assembly/static/simple/server/conf/graphs/hugegraph.properties create mode 100644 hugegraph-it/hg-it-dist/src/assembly/static/simple/server/conf/gremlin-driver-settings.yaml create mode 100644 hugegraph-it/hg-it-dist/src/assembly/static/simple/server/conf/gremlin-server.yaml create mode 100644 hugegraph-it/hg-it-dist/src/assembly/static/simple/server/conf/log4j2.xml create mode 100644 hugegraph-it/hg-it-dist/src/assembly/static/simple/server/conf/remote-objects.yaml create mode 100644 hugegraph-it/hg-it-dist/src/assembly/static/simple/server/conf/remote.yaml create mode 100644 hugegraph-it/hg-it-dist/src/assembly/static/simple/server/conf/rest-server.properties create mode 100644 hugegraph-it/hg-it-dist/src/assembly/static/simple/store/conf/application-pd.yml create mode 100644 hugegraph-it/hg-it-dist/src/assembly/static/simple/store/conf/application.yml create mode 100644 hugegraph-it/hg-it-dist/src/assembly/static/simple/store/conf/log4j2.xml diff --git a/hugegraph-it/hg-it-dist/src/assembly/descriptor/assembly.xml b/hugegraph-it/hg-it-dist/src/assembly/descriptor/assembly.xml new file mode 100644 index 0000000000..207230e7ef --- /dev/null +++ b/hugegraph-it/hg-it-dist/src/assembly/descriptor/assembly.xml @@ -0,0 +1,64 @@ + + + + distribution + false + + + dir + + + + + + + + + + + + + ${assembly.static.dir}/simple + simple + + **/* + + + + ${assembly.static.dir}/multi + multi + + **/* + + + + + + + + /lib + false + runtime + false + + org.apache.hugegraph:${executable.jar.name}:jar:* + + + + + diff --git a/hugegraph-it/hg-it-dist/src/assembly/static/multi/pd/A/conf/application.yml b/hugegraph-it/hg-it-dist/src/assembly/static/multi/pd/A/conf/application.yml new file mode 100644 index 0000000000..c0233abbc4 --- /dev/null +++ b/hugegraph-it/hg-it-dist/src/assembly/static/multi/pd/A/conf/application.yml @@ -0,0 +1,79 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +spring: + application: + name: hugegraph-pd + +management: + metrics: + export: + prometheus: + enabled: true + endpoints: + web: + exposure: + include: "*" + +logging: + config: 'file:./conf/log4j2.xml' +license: + verify-path: ./conf/verify-license.json + license-path: ./conf/hugegraph.license +grpc: + port: 8686 + # grpc 的服务地址,部署时需要改为本地实际 IPv4 地址 + host: 127.0.0.1 + +server: + # rest 服务端口号 + port: 8620 + +pd: + # 存储路径 + data-path: ./pd_data + # 自动扩容的检查周期,定时检查每个 store 的分区数量,自动进行分区数量平衡 + patrol-interval: 1800 + # 初始 store 列表,在列表内的 store 自动激活 + initial-store-count: 3 + # grpc IP:grpc port + initial-store-list: 127.0.0.1:8500,127.0.0.1:8501,127.0.0.1:8502 + +raft: + # 本机 raft 服务地址 + address: 127.0.0.1:8610 + # pd 集群服务地址 + peers-list: 127.0.0.1:8610,127.0.0.1:8611,127.0.0.1:8612 + +store: + # store 下线时间。超过该时间,认为 store 永久不可用,分配副本到其他机器,单位秒 + max-down-time: 172800 + # 是否开启 store 监控数据存储 + monitor_data_enabled: true + # 监控数据的间隔,minute (默认), hour, second + # default: 1 min * 1 day = 1440 + monitor_data_interval: 1 minute + # 监控数据的保留时间 1 天; day, month, year + monitor_data_retention: 1 day + initial-store-count: 1 + +partition: + # 默认每个分区副本数 + default-shard-count: 1 + # 默认每机器最大副本数,初始分区数 = store-max-shard-count * store-number / default-shard-count + store-max-shard-count: 12 + diff --git a/hugegraph-it/hg-it-dist/src/assembly/static/multi/pd/A/conf/application.yml.template b/hugegraph-it/hg-it-dist/src/assembly/static/multi/pd/A/conf/application.yml.template new file mode 100644 index 0000000000..43f52df609 --- /dev/null +++ b/hugegraph-it/hg-it-dist/src/assembly/static/multi/pd/A/conf/application.yml.template @@ -0,0 +1,71 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +spring: + application: + name: hugegraph-pd +logging: + config: file:./conf/log4j2.xml + +management: + metrics: + export: + prometheus: + enabled: true + endpoints: + web: + exposure: + include: "*" + +grpc: + port: $GRPC_PORT$ + # grpc的服务地址, + #注意:部署时需要改为本地实际IPv4地址。 + host: $GRPC_HOST$ + netty-server: + max-inbound-message-size: 100MB + +server: + port : $SERVER_PORT$ + +pd: + # 集群ID,区分不同的PD集群 + + patrol-interval: 2147483647 + data-path: $PD_DATA_PATH$ + +raft: + address: $RAFT_ADDRESS$ + # raft集群 + peers-list: $RAFT_PEERS_LIST$ + # 快照生成时间间隔,单位秒 + snapshotInterval: 300 + metrics: true +store: + # store心跳超时时间,超过该时间,认为store临时不可用,转移Leader到其他副本,单位秒 + keepAlive-timeout: 60 + # store下线时间。超过该时间,认为store永久不可用,分配副本到其他机器,单位秒 + max-down-time: 1800 +partition: + # 默认分区总数 + default-total-count: 30 + # 默认每个分区副本数 + default-shard-count: 3 + +discovery: + #客户端注册后,无心跳最长次数,超过后,之前的注册信息会被删除 + heartbeat-try-count: 3 diff --git a/hugegraph-it/hg-it-dist/src/assembly/static/multi/pd/A/conf/hugegraph.license b/hugegraph-it/hg-it-dist/src/assembly/static/multi/pd/A/conf/hugegraph.license new file mode 100644 index 0000000000000000000000000000000000000000..437a8ebe33666ac5b1fd10e0a598b10cc49fd5a6 GIT binary patch literal 1499 zcmZ8hNl#Nz6fO;xF}4gc*+QAhBuF8QN(C*2GFoJYQjjnRmAQesHX=qZ!7-s0S|~*k|%esUl~7cr%1O1#E?o zwggFT!`!@Gw94DymN*DE;$6(lgjvsCvXeUXjB>)K}`n{Y^y( z*1J=$OD@_R1D|Sy^fmr?S_L0s0;HrtY7U-r0sn&+e0ic(co>5CPFy|V<#uNs?;#Ec7u1Gt<;g$0Vr=7xlELCD zQhEU68MD^B=5GJGFLmc|ut#0(mx?G?1C(&8c;dkP>CP-HgAM()#q(e3AG7Bi?b$gc zoF$i4b<#JDY=Gm=@nYNCxKo~u8#E-^iuiz-Q3!ClD;}!eP-L#}AE801hwv_yj#g-- zH^7d>x$~emz`hM5RL6C4WG|q!Pzv4a774s!jzm)mmjx`USDj~)y9D7-WECWzJma)+ zL!(FUq2a0}2I<0w8Ym2(%~cQ;TSkOJH!u{IxIxR9^ao=kJFPD)$>u>{I=^? zi*`m&>S{TkfbH|^D77bKUEocSeQup*cLC0P@Y2$%(ZU(-41u(OPVV*KjdvbKYFI|Z lX$Ioxu@X + + + + + + + logs + hugegraph-pd + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/hugegraph-it/hg-it-dist/src/assembly/static/multi/pd/A/conf/verify-license.json b/hugegraph-it/hg-it-dist/src/assembly/static/multi/pd/A/conf/verify-license.json new file mode 100644 index 0000000000..868ccbebbb --- /dev/null +++ b/hugegraph-it/hg-it-dist/src/assembly/static/multi/pd/A/conf/verify-license.json @@ -0,0 +1,6 @@ +{ + "subject": "hugegraph-license", + "public_alias": "publiccert", + "store_ticket": "803b6cc3-d144-47e8-948f-ec8b39c8881e", + "publickey_path": "/public-certs.store" +} diff --git a/hugegraph-it/hg-it-dist/src/assembly/static/multi/pd/B/conf/application.yml b/hugegraph-it/hg-it-dist/src/assembly/static/multi/pd/B/conf/application.yml new file mode 100644 index 0000000000..59bc7d43f7 --- /dev/null +++ b/hugegraph-it/hg-it-dist/src/assembly/static/multi/pd/B/conf/application.yml @@ -0,0 +1,79 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +spring: + application: + name: hugegraph-pd + +management: + metrics: + export: + prometheus: + enabled: true + endpoints: + web: + exposure: + include: "*" + +logging: + config: 'file:./conf/log4j2.xml' +license: + verify-path: ./conf/verify-license.json + license-path: ./conf/hugegraph.license +grpc: + port: 8687 + # grpc 的服务地址,部署时需要改为本地实际 IPv4 地址 + host: 127.0.0.1 + +server: + # rest 服务端口号 + port: 8621 + +pd: + # 存储路径 + data-path: ./pd_data + # 自动扩容的检查周期,定时检查每个 store 的分区数量,自动进行分区数量平衡 + patrol-interval: 1800 + # 初始 store 列表,在列表内的 store 自动激活 + initial-store-count: 3 + # grpc IP:grpc port + initial-store-list: 127.0.0.1:8500,127.0.0.1:8501,127.0.0.1:8502 + +raft: + # 本机 raft 服务地址 + address: 127.0.0.1:8611 + # pd 集群服务地址 + peers-list: 127.0.0.1:8610,127.0.0.1:8611,127.0.0.1:8612 + +store: + # store 下线时间。超过该时间,认为 store 永久不可用,分配副本到其他机器,单位秒 + max-down-time: 172800 + # 是否开启 store 监控数据存储 + monitor_data_enabled: true + # 监控数据的间隔,minute (默认), hour, second + # default: 1 min * 1 day = 1440 + monitor_data_interval: 1 minute + # 监控数据的保留时间 1 天; day, month, year + monitor_data_retention: 1 day + initial-store-count: 1 + +partition: + # 默认每个分区副本数 + default-shard-count: 1 + # 默认每机器最大副本数,初始分区数 = store-max-shard-count * store-number / default-shard-count + store-max-shard-count: 12 + diff --git a/hugegraph-it/hg-it-dist/src/assembly/static/multi/pd/B/conf/application.yml.template b/hugegraph-it/hg-it-dist/src/assembly/static/multi/pd/B/conf/application.yml.template new file mode 100644 index 0000000000..43f52df609 --- /dev/null +++ b/hugegraph-it/hg-it-dist/src/assembly/static/multi/pd/B/conf/application.yml.template @@ -0,0 +1,71 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +spring: + application: + name: hugegraph-pd +logging: + config: file:./conf/log4j2.xml + +management: + metrics: + export: + prometheus: + enabled: true + endpoints: + web: + exposure: + include: "*" + +grpc: + port: $GRPC_PORT$ + # grpc的服务地址, + #注意:部署时需要改为本地实际IPv4地址。 + host: $GRPC_HOST$ + netty-server: + max-inbound-message-size: 100MB + +server: + port : $SERVER_PORT$ + +pd: + # 集群ID,区分不同的PD集群 + + patrol-interval: 2147483647 + data-path: $PD_DATA_PATH$ + +raft: + address: $RAFT_ADDRESS$ + # raft集群 + peers-list: $RAFT_PEERS_LIST$ + # 快照生成时间间隔,单位秒 + snapshotInterval: 300 + metrics: true +store: + # store心跳超时时间,超过该时间,认为store临时不可用,转移Leader到其他副本,单位秒 + keepAlive-timeout: 60 + # store下线时间。超过该时间,认为store永久不可用,分配副本到其他机器,单位秒 + max-down-time: 1800 +partition: + # 默认分区总数 + default-total-count: 30 + # 默认每个分区副本数 + default-shard-count: 3 + +discovery: + #客户端注册后,无心跳最长次数,超过后,之前的注册信息会被删除 + heartbeat-try-count: 3 diff --git a/hugegraph-it/hg-it-dist/src/assembly/static/multi/pd/B/conf/hugegraph.license b/hugegraph-it/hg-it-dist/src/assembly/static/multi/pd/B/conf/hugegraph.license new file mode 100644 index 0000000000000000000000000000000000000000..437a8ebe33666ac5b1fd10e0a598b10cc49fd5a6 GIT binary patch literal 1499 zcmZ8hNl#Nz6fO;xF}4gc*+QAhBuF8QN(C*2GFoJYQjjnRmAQesHX=qZ!7-s0S|~*k|%esUl~7cr%1O1#E?o zwggFT!`!@Gw94DymN*DE;$6(lgjvsCvXeUXjB>)K}`n{Y^y( z*1J=$OD@_R1D|Sy^fmr?S_L0s0;HrtY7U-r0sn&+e0ic(co>5CPFy|V<#uNs?;#Ec7u1Gt<;g$0Vr=7xlELCD zQhEU68MD^B=5GJGFLmc|ut#0(mx?G?1C(&8c;dkP>CP-HgAM()#q(e3AG7Bi?b$gc zoF$i4b<#JDY=Gm=@nYNCxKo~u8#E-^iuiz-Q3!ClD;}!eP-L#}AE801hwv_yj#g-- zH^7d>x$~emz`hM5RL6C4WG|q!Pzv4a774s!jzm)mmjx`USDj~)y9D7-WECWzJma)+ zL!(FUq2a0}2I<0w8Ym2(%~cQ;TSkOJH!u{IxIxR9^ao=kJFPD)$>u>{I=^? zi*`m&>S{TkfbH|^D77bKUEocSeQup*cLC0P@Y2$%(ZU(-41u(OPVV*KjdvbKYFI|Z lX$Ioxu@X + + + + + + + logs + hugegraph-pd + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/hugegraph-it/hg-it-dist/src/assembly/static/multi/pd/B/conf/verify-license.json b/hugegraph-it/hg-it-dist/src/assembly/static/multi/pd/B/conf/verify-license.json new file mode 100644 index 0000000000..868ccbebbb --- /dev/null +++ b/hugegraph-it/hg-it-dist/src/assembly/static/multi/pd/B/conf/verify-license.json @@ -0,0 +1,6 @@ +{ + "subject": "hugegraph-license", + "public_alias": "publiccert", + "store_ticket": "803b6cc3-d144-47e8-948f-ec8b39c8881e", + "publickey_path": "/public-certs.store" +} diff --git a/hugegraph-it/hg-it-dist/src/assembly/static/multi/pd/C/conf/application.yml b/hugegraph-it/hg-it-dist/src/assembly/static/multi/pd/C/conf/application.yml new file mode 100644 index 0000000000..3e5669d702 --- /dev/null +++ b/hugegraph-it/hg-it-dist/src/assembly/static/multi/pd/C/conf/application.yml @@ -0,0 +1,79 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +spring: + application: + name: hugegraph-pd + +management: + metrics: + export: + prometheus: + enabled: true + endpoints: + web: + exposure: + include: "*" + +logging: + config: 'file:./conf/log4j2.xml' +license: + verify-path: ./conf/verify-license.json + license-path: ./conf/hugegraph.license +grpc: + port: 8688 + # grpc 的服务地址,部署时需要改为本地实际 IPv4 地址 + host: 127.0.0.1 + +server: + # rest 服务端口号 + port: 8622 + +pd: + # 存储路径 + data-path: ./pd_data + # 自动扩容的检查周期,定时检查每个 store 的分区数量,自动进行分区数量平衡 + patrol-interval: 1800 + # 初始 store 列表,在列表内的 store 自动激活 + initial-store-count: 3 + # grpc IP:grpc port + initial-store-list: 127.0.0.1:8500,127.0.0.1:8501,127.0.0.1:8502 + +raft: + # 本机 raft 服务地址 + address: 127.0.0.1:8612 + # pd 集群服务地址 + peers-list: 127.0.0.1:8610,127.0.0.1:8611,127.0.0.1:8612 + +store: + # store 下线时间。超过该时间,认为 store 永久不可用,分配副本到其他机器,单位秒 + max-down-time: 172800 + # 是否开启 store 监控数据存储 + monitor_data_enabled: true + # 监控数据的间隔,minute (默认), hour, second + # default: 1 min * 1 day = 1440 + monitor_data_interval: 1 minute + # 监控数据的保留时间 1 天; day, month, year + monitor_data_retention: 1 day + initial-store-count: 1 + +partition: + # 默认每个分区副本数 + default-shard-count: 1 + # 默认每机器最大副本数,初始分区数 = store-max-shard-count * store-number / default-shard-count + store-max-shard-count: 12 + diff --git a/hugegraph-it/hg-it-dist/src/assembly/static/multi/pd/C/conf/application.yml.template b/hugegraph-it/hg-it-dist/src/assembly/static/multi/pd/C/conf/application.yml.template new file mode 100644 index 0000000000..43f52df609 --- /dev/null +++ b/hugegraph-it/hg-it-dist/src/assembly/static/multi/pd/C/conf/application.yml.template @@ -0,0 +1,71 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +spring: + application: + name: hugegraph-pd +logging: + config: file:./conf/log4j2.xml + +management: + metrics: + export: + prometheus: + enabled: true + endpoints: + web: + exposure: + include: "*" + +grpc: + port: $GRPC_PORT$ + # grpc的服务地址, + #注意:部署时需要改为本地实际IPv4地址。 + host: $GRPC_HOST$ + netty-server: + max-inbound-message-size: 100MB + +server: + port : $SERVER_PORT$ + +pd: + # 集群ID,区分不同的PD集群 + + patrol-interval: 2147483647 + data-path: $PD_DATA_PATH$ + +raft: + address: $RAFT_ADDRESS$ + # raft集群 + peers-list: $RAFT_PEERS_LIST$ + # 快照生成时间间隔,单位秒 + snapshotInterval: 300 + metrics: true +store: + # store心跳超时时间,超过该时间,认为store临时不可用,转移Leader到其他副本,单位秒 + keepAlive-timeout: 60 + # store下线时间。超过该时间,认为store永久不可用,分配副本到其他机器,单位秒 + max-down-time: 1800 +partition: + # 默认分区总数 + default-total-count: 30 + # 默认每个分区副本数 + default-shard-count: 3 + +discovery: + #客户端注册后,无心跳最长次数,超过后,之前的注册信息会被删除 + heartbeat-try-count: 3 diff --git a/hugegraph-it/hg-it-dist/src/assembly/static/multi/pd/C/conf/hugegraph.license b/hugegraph-it/hg-it-dist/src/assembly/static/multi/pd/C/conf/hugegraph.license new file mode 100644 index 0000000000000000000000000000000000000000..437a8ebe33666ac5b1fd10e0a598b10cc49fd5a6 GIT binary patch literal 1499 zcmZ8hNl#Nz6fO;xF}4gc*+QAhBuF8QN(C*2GFoJYQjjnRmAQesHX=qZ!7-s0S|~*k|%esUl~7cr%1O1#E?o zwggFT!`!@Gw94DymN*DE;$6(lgjvsCvXeUXjB>)K}`n{Y^y( z*1J=$OD@_R1D|Sy^fmr?S_L0s0;HrtY7U-r0sn&+e0ic(co>5CPFy|V<#uNs?;#Ec7u1Gt<;g$0Vr=7xlELCD zQhEU68MD^B=5GJGFLmc|ut#0(mx?G?1C(&8c;dkP>CP-HgAM()#q(e3AG7Bi?b$gc zoF$i4b<#JDY=Gm=@nYNCxKo~u8#E-^iuiz-Q3!ClD;}!eP-L#}AE801hwv_yj#g-- zH^7d>x$~emz`hM5RL6C4WG|q!Pzv4a774s!jzm)mmjx`USDj~)y9D7-WECWzJma)+ zL!(FUq2a0}2I<0w8Ym2(%~cQ;TSkOJH!u{IxIxR9^ao=kJFPD)$>u>{I=^? zi*`m&>S{TkfbH|^D77bKUEocSeQup*cLC0P@Y2$%(ZU(-41u(OPVV*KjdvbKYFI|Z lX$Ioxu@X + + + + + + + logs + hugegraph-pd + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/hugegraph-it/hg-it-dist/src/assembly/static/multi/pd/C/conf/verify-license.json b/hugegraph-it/hg-it-dist/src/assembly/static/multi/pd/C/conf/verify-license.json new file mode 100644 index 0000000000..868ccbebbb --- /dev/null +++ b/hugegraph-it/hg-it-dist/src/assembly/static/multi/pd/C/conf/verify-license.json @@ -0,0 +1,6 @@ +{ + "subject": "hugegraph-license", + "public_alias": "publiccert", + "store_ticket": "803b6cc3-d144-47e8-948f-ec8b39c8881e", + "publickey_path": "/public-certs.store" +} diff --git a/hugegraph-it/hg-it-dist/src/assembly/static/multi/server/A/conf/computer.yaml b/hugegraph-it/hg-it-dist/src/assembly/static/multi/server/A/conf/computer.yaml new file mode 100644 index 0000000000..1c69388bb0 --- /dev/null +++ b/hugegraph-it/hg-it-dist/src/assembly/static/multi/server/A/conf/computer.yaml @@ -0,0 +1,39 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# common parameters +common: { + worker_heap: 10000, + vertex_input_dir: /data, + workers: 51, + zookeeper_list: "127.0.0.1:2181", + max_edges_per_segment: 10485760, + edges_immutable: true, + partitions: 255, + compute_threads: 5, + input_threads: 5, + message_async: false, + message_queue_size: 1000, + message_send_threads: 10, + messages_per_segment: 104857600, + hugegraph_url: "http://127.0.0.1:8080", + hugegraph_name: hugegraph, + hugegraph_timeout: 60 +} + +env: { + computer_home: /home/computer +} diff --git a/hugegraph-it/hg-it-dist/src/assembly/static/multi/server/A/conf/graphs/hugegraph.properties b/hugegraph-it/hg-it-dist/src/assembly/static/multi/server/A/conf/graphs/hugegraph.properties new file mode 100644 index 0000000000..02b2d43270 --- /dev/null +++ b/hugegraph-it/hg-it-dist/src/assembly/static/multi/server/A/conf/graphs/hugegraph.properties @@ -0,0 +1,126 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# gremlin entrance to create graph +# auth config: org.apache.hugegraph.auth.HugeFactoryAuthProxy +gremlin.graph=org.apache.hugegraph.HugeFactory + +# cache config +#schema.cache_capacity=100000 +# vertex-cache default is 1000w, 10min expired +vertex.cache_type=l2 +#vertex.cache_capacity=10000000 +#vertex.cache_expire=600 +# edge-cache default is 100w, 10min expired +edge.cache_type=l2 +#edge.cache_capacity=1000000 +#edge.cache_expire=600 + + +# schema illegal name template +#schema.illegal_name_regex=\s+|~.* + +#vertex.default_label=vertex + +backend=hstore +serializer=binary + +store=hugegraph + +# pd config +pd.peers=127.0.0.1:8686,127.0.0.1:8687,127.0.0.1:8688 + +# task config +task.scheduler_type=local +task.schedule_period=10 +task.retry=0 +task.wait_timeout=10 + +# raft config +raft.mode=false +raft.path=./raft-log +raft.safe_read=true +raft.use_replicator_pipeline=true +raft.election_timeout=10000 +raft.snapshot_interval=3600 +raft.backend_threads=48 +raft.read_index_threads=8 +raft.snapshot_threads=4 +raft.snapshot_parallel_compress=false +raft.snapshot_compress_threads=4 +raft.snapshot_decompress_threads=4 +raft.read_strategy=ReadOnlyLeaseBased +raft.queue_size=16384 +raft.queue_publish_timeout=60 +raft.apply_batch=1 +raft.rpc_threads=80 +raft.rpc_connect_timeout=5000 +raft.rpc_timeout=60 +raft.install_snapshot_rpc_timeout=36000 + +# search config +search.text_analyzer=jieba +search.text_analyzer_mode=INDEX + +# rocksdb backend config +#rocksdb.data_path=/path/to/disk +#rocksdb.wal_path=/path/to/disk + + +# cassandra backend config +cassandra.host=localhost +cassandra.port=9042 +cassandra.username= +cassandra.password= +#cassandra.connect_timeout=5 +#cassandra.read_timeout=20 +#cassandra.keyspace.strategy=SimpleStrategy +#cassandra.keyspace.replication=3 + +# hbase backend config +#hbase.hosts=localhost +#hbase.port=2181 +#hbase.znode_parent=/hbase +#hbase.threads_max=64 +# IMPORTANT: recommend to modify the HBase partition number +# by the actual/env data amount & RS amount before init store +# It will influence the load speed a lot +#hbase.enable_partition=true +#hbase.vertex_partitions=10 +#hbase.edge_partitions=30 + +# mysql backend config +#jdbc.driver=com.mysql.jdbc.Driver +#jdbc.url=jdbc:mysql://127.0.0.1:3306 +#jdbc.username=root +#jdbc.password= +#jdbc.reconnect_max_times=3 +#jdbc.reconnect_interval=3 +#jdbc.ssl_mode=false + +# postgresql & cockroachdb backend config +#jdbc.driver=org.postgresql.Driver +#jdbc.url=jdbc:postgresql://localhost:5432/ +#jdbc.username=postgres +#jdbc.password= +#jdbc.postgresql.connect_database=template1 + +# palo backend config +#palo.host=127.0.0.1 +#palo.poll_interval=10 +#palo.temp_dir=./palo-data +#palo.file_limit_size=32 diff --git a/hugegraph-it/hg-it-dist/src/assembly/static/multi/server/A/conf/gremlin-driver-settings.yaml b/hugegraph-it/hg-it-dist/src/assembly/static/multi/server/A/conf/gremlin-driver-settings.yaml new file mode 100644 index 0000000000..2f60ff8379 --- /dev/null +++ b/hugegraph-it/hg-it-dist/src/assembly/static/multi/server/A/conf/gremlin-driver-settings.yaml @@ -0,0 +1,25 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +hosts: [localhost] +port: 8181 +serializer: { + className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV1d0, + config: { + serializeResultToString: false, + ioRegistries: [org.apache.hugegraph.io.HugeGraphIoRegistry] + } +} diff --git a/hugegraph-it/hg-it-dist/src/assembly/static/multi/server/A/conf/gremlin-server.yaml b/hugegraph-it/hg-it-dist/src/assembly/static/multi/server/A/conf/gremlin-server.yaml new file mode 100644 index 0000000000..df73386b26 --- /dev/null +++ b/hugegraph-it/hg-it-dist/src/assembly/static/multi/server/A/conf/gremlin-server.yaml @@ -0,0 +1,127 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# host and port of gremlin server, need to be consistent with host and port in rest-server.properties +host: 127.0.0.1 +port: 8181 + +# timeout in ms of gremlin query +evaluationTimeout: 30000 + +channelizer: org.apache.tinkerpop.gremlin.server.channel.WsAndHttpChannelizer +# don't set graph at here, this happens after support for dynamically adding graph +graphs: { +} +scriptEngines: { + gremlin-groovy: { + staticImports: [ + org.opencypher.gremlin.process.traversal.CustomPredicates.*', + org.opencypher.gremlin.traversal.CustomFunctions.* + ], + plugins: { + org.apache.hugegraph.plugin.HugeGraphGremlinPlugin: {}, + org.apache.tinkerpop.gremlin.server.jsr223.GremlinServerGremlinPlugin: {}, + org.apache.tinkerpop.gremlin.jsr223.ImportGremlinPlugin: { + classImports: [ + java.lang.Math, + org.apache.hugegraph.backend.id.IdGenerator, + org.apache.hugegraph.type.define.Directions, + org.apache.hugegraph.type.define.NodeRole, + org.apache.hugegraph.masterelection.GlobalMasterInfo, + org.apache.hugegraph.util.DateUtil, + org.apache.hugegraph.traversal.algorithm.CollectionPathsTraverser, + org.apache.hugegraph.traversal.algorithm.CountTraverser, + org.apache.hugegraph.traversal.algorithm.CustomizedCrosspointsTraverser, + org.apache.hugegraph.traversal.algorithm.CustomizePathsTraverser, + org.apache.hugegraph.traversal.algorithm.FusiformSimilarityTraverser, + org.apache.hugegraph.traversal.algorithm.HugeTraverser, + org.apache.hugegraph.traversal.algorithm.JaccardSimilarTraverser, + org.apache.hugegraph.traversal.algorithm.KneighborTraverser, + org.apache.hugegraph.traversal.algorithm.KoutTraverser, + org.apache.hugegraph.traversal.algorithm.MultiNodeShortestPathTraverser, + org.apache.hugegraph.traversal.algorithm.NeighborRankTraverser, + org.apache.hugegraph.traversal.algorithm.PathsTraverser, + org.apache.hugegraph.traversal.algorithm.PersonalRankTraverser, + org.apache.hugegraph.traversal.algorithm.SameNeighborTraverser, + org.apache.hugegraph.traversal.algorithm.ShortestPathTraverser, + org.apache.hugegraph.traversal.algorithm.SingleSourceShortestPathTraverser, + org.apache.hugegraph.traversal.algorithm.SubGraphTraverser, + org.apache.hugegraph.traversal.algorithm.TemplatePathsTraverser, + org.apache.hugegraph.traversal.algorithm.steps.EdgeStep, + org.apache.hugegraph.traversal.algorithm.steps.RepeatEdgeStep, + org.apache.hugegraph.traversal.algorithm.steps.WeightedEdgeStep, + org.apache.hugegraph.traversal.optimize.ConditionP, + org.apache.hugegraph.traversal.optimize.Text, + org.apache.hugegraph.traversal.optimize.TraversalUtil, + org.opencypher.gremlin.traversal.CustomFunctions, + org.opencypher.gremlin.traversal.CustomPredicate + ], + methodImports: [ + java.lang.Math#*, + org.opencypher.gremlin.traversal.CustomPredicate#*, + org.opencypher.gremlin.traversal.CustomFunctions#* + ] + }, + org.apache.tinkerpop.gremlin.jsr223.ScriptFileGremlinPlugin: { + files: [scripts/empty-sample.groovy] + } + } + } +} +serializers: + - {className: org.apache.tinkerpop.gremlin.driver.ser.GraphBinaryMessageSerializerV1, + config: { + serializeResultToString: false, + ioRegistries: [org.apache.hugegraph.io.HugeGraphIoRegistry] + } + } + - {className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV1d0, + config: { + serializeResultToString: false, + ioRegistries: [org.apache.hugegraph.io.HugeGraphIoRegistry] + } + } + - {className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV2d0, + config: { + serializeResultToString: false, + ioRegistries: [org.apache.hugegraph.io.HugeGraphIoRegistry] + } + } + - {className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV3d0, + config: { + serializeResultToString: false, + ioRegistries: [org.apache.hugegraph.io.HugeGraphIoRegistry] + } + } +metrics: { + consoleReporter: {enabled: false, interval: 180000}, + csvReporter: {enabled: false, interval: 180000, fileName: ./metrics/gremlin-server-metrics.csv}, + jmxReporter: {enabled: false}, + slf4jReporter: {enabled: false, interval: 180000}, + gangliaReporter: {enabled: false, interval: 180000, addressingMode: MULTICAST}, + graphiteReporter: {enabled: false, interval: 180000} +} +maxInitialLineLength: 4096 +maxHeaderSize: 8192 +maxChunkSize: 8192 +maxContentLength: 65536 +maxAccumulationBufferComponents: 1024 +resultIterationBatchSize: 64 +writeBufferLowWaterMark: 32768 +writeBufferHighWaterMark: 65536 +ssl: { + enabled: false +} diff --git a/hugegraph-it/hg-it-dist/src/assembly/static/multi/server/A/conf/hugegraph-server.keystore b/hugegraph-it/hg-it-dist/src/assembly/static/multi/server/A/conf/hugegraph-server.keystore new file mode 100644 index 0000000000000000000000000000000000000000..e60c6b4c4ca066e165da3d5d880d1d780fb976fa GIT binary patch literal 1733 zcmY+Ddpy$%AIG=fE(|Ga?rAuU*g9>lOK50Vh`IC}mng;DNp@z;ZSGOxoCwvnE-uGq zDvFJhdlwG}L!yr6l3Oi0E~QnE=XpKPdCvLc^ZLGCpU?OE`Rn_}v*8^87=mZR6W|EL zEXSD}sBL@KwiMv<|GiR>0|Q((a39YG_;>@j z-2d$Da!n}8dwGrI^Jeazr<}U>@X`FvaOUzL00DKmLD@j6-U}=!sw|0~-#YB(_U&lC z;2bWbKk3MH1SjB*xD{hl9zVztK2i@k`6_a{AsjrB_*RV-5p=s7em>x9dHui`?TStC zew}Gp>C>!?6P|Te@;$LGQQ@!!h8+yzSu0*0XVnWI?$fJP2^-eKF0Cx!V*U^-{v7&A zZA)dtgq1S4RU$X4xG}fPdshqkuFQ-5jQQqNzPxSM^!`N$P^S0`-_ zX(=iHHj(PsxSFVEf0maY!V~9bRul*qF&EgQVYVAJ2g33ytqjMa`v#g3W)e>XCt&8$ z9If&8^~q8hYo?*IcbyxxCP?xwDcKHGKu(6Dd-o;A^ri$)$$tD$r(Ao8=wH@58K(W_ z@_}~?6j58xVHV?g_CpdfR*5+Z$=PkI3-MhCL^TIVk3N15Er{zpuTJWsGzsHJ%Fru! z{o15CkKJtFt}OfYy)IMcnF?&wDVLp&W7H<-_kf#+s5fv6V^)xZ{ZCw1m}vp)HD)J$SzCL@+;WnBb& zyw0C5jzAGmdy$|J5FJDV1#K%9bQ%-`3i<1bG64ledWJ>@X%o!wrg)+m{*VdL%zT>% zlRtZ8;9NEYvu)`BV9@r^_b3!Eq#=y}Xp}6cncLNk)#myqh|?Uf zu#q_2Km9KKA=C@ZP+&<}b1Iu^JHhUU?UR|!$f-I^6W-~x5qUwla8u_tX*$ZoHT<&b3|1oa%&cIWheq1!vp7}vo&|KS@csHK&>Ce4GlhAG-Q1r zmnF8Bp{++bw3liV*ab;^waVWNQ;cbFZ9VA1Y)=RD7Lm^7r6NZm?O5cBk_7eT9(@ z#V+49ncJ&NBfmTO%vM3)>L&@ogFTk>U}`zLNH-nz>fD=Q|AZrYr&Ek8yxr5%1lJq$ zuMC8=D>7uEsuqvT5>#cyV1BMNg~w2vHB1buzv1(+;CD=JxXaDf`~hox#GZLq(_uo9 zrPofrOMz?k<-#fe_p&8jfMHP2SZt({*B$Grc^_|u%?x?dy@TIK@fTrtVsZ%qKVGz? zJ(&Vd#8Db?$uzt1l<{UG^LdhGlfFhen!o3hw%YK(kA|3QKO|X^MHcRGJK?XP)O(z- z^uo_Ssjc@571 literal 0 HcmV?d00001 diff --git a/hugegraph-it/hg-it-dist/src/assembly/static/multi/server/A/conf/log4j2.xml b/hugegraph-it/hg-it-dist/src/assembly/static/multi/server/A/conf/log4j2.xml new file mode 100644 index 0000000000..f1dd7e8395 --- /dev/null +++ b/hugegraph-it/hg-it-dist/src/assembly/static/multi/server/A/conf/log4j2.xml @@ -0,0 +1,144 @@ + + + + + + logs + hugegraph-server + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/hugegraph-it/hg-it-dist/src/assembly/static/multi/server/A/conf/remote-objects.yaml b/hugegraph-it/hg-it-dist/src/assembly/static/multi/server/A/conf/remote-objects.yaml new file mode 100644 index 0000000000..94ebc99190 --- /dev/null +++ b/hugegraph-it/hg-it-dist/src/assembly/static/multi/server/A/conf/remote-objects.yaml @@ -0,0 +1,30 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +hosts: [localhost] +port: 8181 +serializer: { + className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV1d0, + config: { + serializeResultToString: false, + # The duplication of HugeGraphIoRegistry is meant to fix a bug in the + # 'org.apache.tinkerpop.gremlin.driver.Settings:from(Configuration)' method. + ioRegistries: [ + org.apache.hugegraph.io.HugeGraphIoRegistry, + org.apache.hugegraph.io.HugeGraphIoRegistry + ] + } +} diff --git a/hugegraph-it/hg-it-dist/src/assembly/static/multi/server/A/conf/remote.yaml b/hugegraph-it/hg-it-dist/src/assembly/static/multi/server/A/conf/remote.yaml new file mode 100644 index 0000000000..2f60ff8379 --- /dev/null +++ b/hugegraph-it/hg-it-dist/src/assembly/static/multi/server/A/conf/remote.yaml @@ -0,0 +1,25 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +hosts: [localhost] +port: 8181 +serializer: { + className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV1d0, + config: { + serializeResultToString: false, + ioRegistries: [org.apache.hugegraph.io.HugeGraphIoRegistry] + } +} diff --git a/hugegraph-it/hg-it-dist/src/assembly/static/multi/server/A/conf/rest-server.properties b/hugegraph-it/hg-it-dist/src/assembly/static/multi/server/A/conf/rest-server.properties new file mode 100644 index 0000000000..305bdfa805 --- /dev/null +++ b/hugegraph-it/hg-it-dist/src/assembly/static/multi/server/A/conf/rest-server.properties @@ -0,0 +1,70 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# bind url +restserver.url=http://127.0.0.1:8081 +# gremlin server url, need to be consistent with host and port in gremlin-server.yaml +gremlinserver.url=http://127.0.0.1:8181 + +graphs=./conf/graphs + +# The maximum thread ratio for batch writing, only take effect if the batch.max_write_threads is 0 +batch.max_write_ratio=80 +batch.max_write_threads=0 + +# configuration of arthas +arthas.telnet_port=8562 +arthas.http_port=8561 +arthas.ip=127.0.0.1 +arthas.disabled_commands=jad + +# authentication configs +# choose 'org.apache.hugegraph.auth.StandardAuthenticator' or +# 'org.apache.hugegraph.auth.ConfigAuthenticator' +#auth.authenticator= + +# for StandardAuthenticator mode +#auth.graph_store=hugegraph +# auth client config +#auth.remote_url=127.0.0.1:8899,127.0.0.1:8898,127.0.0.1:8897 + +# for ConfigAuthenticator mode +#auth.admin_token= +#auth.user_tokens=[] + +# rpc server configs for multi graph-servers or raft-servers +rpc.server_host=127.0.0.1 +rpc.server_port=8091 +#rpc.server_timeout=30 + +# rpc client configs (like enable to keep cache consistency) +#rpc.remote_url=127.0.0.1:8091,127.0.0.1:8092,127.0.0.1:8093 +#rpc.client_connect_timeout=20 +#rpc.client_reconnect_period=10 +#rpc.client_read_timeout=40 +#rpc.client_retries=3 +#rpc.client_load_balancer=consistentHash + +# raft group initial peers +#raft.group_peers=127.0.0.1:8091,127.0.0.1:8092,127.0.0.1:8093 + +# lightweight load balancing (beta) +server.id=server-1 +server.role=master + +# slow query log +log.slow_query_threshold=1000 diff --git a/hugegraph-it/hg-it-dist/src/assembly/static/multi/server/B/conf/computer.yaml b/hugegraph-it/hg-it-dist/src/assembly/static/multi/server/B/conf/computer.yaml new file mode 100644 index 0000000000..1c69388bb0 --- /dev/null +++ b/hugegraph-it/hg-it-dist/src/assembly/static/multi/server/B/conf/computer.yaml @@ -0,0 +1,39 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# common parameters +common: { + worker_heap: 10000, + vertex_input_dir: /data, + workers: 51, + zookeeper_list: "127.0.0.1:2181", + max_edges_per_segment: 10485760, + edges_immutable: true, + partitions: 255, + compute_threads: 5, + input_threads: 5, + message_async: false, + message_queue_size: 1000, + message_send_threads: 10, + messages_per_segment: 104857600, + hugegraph_url: "http://127.0.0.1:8080", + hugegraph_name: hugegraph, + hugegraph_timeout: 60 +} + +env: { + computer_home: /home/computer +} diff --git a/hugegraph-it/hg-it-dist/src/assembly/static/multi/server/B/conf/graphs/hugegraph.properties b/hugegraph-it/hg-it-dist/src/assembly/static/multi/server/B/conf/graphs/hugegraph.properties new file mode 100644 index 0000000000..02b2d43270 --- /dev/null +++ b/hugegraph-it/hg-it-dist/src/assembly/static/multi/server/B/conf/graphs/hugegraph.properties @@ -0,0 +1,126 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# gremlin entrance to create graph +# auth config: org.apache.hugegraph.auth.HugeFactoryAuthProxy +gremlin.graph=org.apache.hugegraph.HugeFactory + +# cache config +#schema.cache_capacity=100000 +# vertex-cache default is 1000w, 10min expired +vertex.cache_type=l2 +#vertex.cache_capacity=10000000 +#vertex.cache_expire=600 +# edge-cache default is 100w, 10min expired +edge.cache_type=l2 +#edge.cache_capacity=1000000 +#edge.cache_expire=600 + + +# schema illegal name template +#schema.illegal_name_regex=\s+|~.* + +#vertex.default_label=vertex + +backend=hstore +serializer=binary + +store=hugegraph + +# pd config +pd.peers=127.0.0.1:8686,127.0.0.1:8687,127.0.0.1:8688 + +# task config +task.scheduler_type=local +task.schedule_period=10 +task.retry=0 +task.wait_timeout=10 + +# raft config +raft.mode=false +raft.path=./raft-log +raft.safe_read=true +raft.use_replicator_pipeline=true +raft.election_timeout=10000 +raft.snapshot_interval=3600 +raft.backend_threads=48 +raft.read_index_threads=8 +raft.snapshot_threads=4 +raft.snapshot_parallel_compress=false +raft.snapshot_compress_threads=4 +raft.snapshot_decompress_threads=4 +raft.read_strategy=ReadOnlyLeaseBased +raft.queue_size=16384 +raft.queue_publish_timeout=60 +raft.apply_batch=1 +raft.rpc_threads=80 +raft.rpc_connect_timeout=5000 +raft.rpc_timeout=60 +raft.install_snapshot_rpc_timeout=36000 + +# search config +search.text_analyzer=jieba +search.text_analyzer_mode=INDEX + +# rocksdb backend config +#rocksdb.data_path=/path/to/disk +#rocksdb.wal_path=/path/to/disk + + +# cassandra backend config +cassandra.host=localhost +cassandra.port=9042 +cassandra.username= +cassandra.password= +#cassandra.connect_timeout=5 +#cassandra.read_timeout=20 +#cassandra.keyspace.strategy=SimpleStrategy +#cassandra.keyspace.replication=3 + +# hbase backend config +#hbase.hosts=localhost +#hbase.port=2181 +#hbase.znode_parent=/hbase +#hbase.threads_max=64 +# IMPORTANT: recommend to modify the HBase partition number +# by the actual/env data amount & RS amount before init store +# It will influence the load speed a lot +#hbase.enable_partition=true +#hbase.vertex_partitions=10 +#hbase.edge_partitions=30 + +# mysql backend config +#jdbc.driver=com.mysql.jdbc.Driver +#jdbc.url=jdbc:mysql://127.0.0.1:3306 +#jdbc.username=root +#jdbc.password= +#jdbc.reconnect_max_times=3 +#jdbc.reconnect_interval=3 +#jdbc.ssl_mode=false + +# postgresql & cockroachdb backend config +#jdbc.driver=org.postgresql.Driver +#jdbc.url=jdbc:postgresql://localhost:5432/ +#jdbc.username=postgres +#jdbc.password= +#jdbc.postgresql.connect_database=template1 + +# palo backend config +#palo.host=127.0.0.1 +#palo.poll_interval=10 +#palo.temp_dir=./palo-data +#palo.file_limit_size=32 diff --git a/hugegraph-it/hg-it-dist/src/assembly/static/multi/server/B/conf/gremlin-driver-settings.yaml b/hugegraph-it/hg-it-dist/src/assembly/static/multi/server/B/conf/gremlin-driver-settings.yaml new file mode 100644 index 0000000000..55f38ab97d --- /dev/null +++ b/hugegraph-it/hg-it-dist/src/assembly/static/multi/server/B/conf/gremlin-driver-settings.yaml @@ -0,0 +1,25 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +hosts: [localhost] +port: 8182 +serializer: { + className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV1d0, + config: { + serializeResultToString: false, + ioRegistries: [org.apache.hugegraph.io.HugeGraphIoRegistry] + } +} diff --git a/hugegraph-it/hg-it-dist/src/assembly/static/multi/server/B/conf/gremlin-server.yaml b/hugegraph-it/hg-it-dist/src/assembly/static/multi/server/B/conf/gremlin-server.yaml new file mode 100644 index 0000000000..048dded559 --- /dev/null +++ b/hugegraph-it/hg-it-dist/src/assembly/static/multi/server/B/conf/gremlin-server.yaml @@ -0,0 +1,127 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# host and port of gremlin server, need to be consistent with host and port in rest-server.properties +host: 127.0.0.1 +port: 8182 + +# timeout in ms of gremlin query +evaluationTimeout: 30000 + +channelizer: org.apache.tinkerpop.gremlin.server.channel.WsAndHttpChannelizer +# don't set graph at here, this happens after support for dynamically adding graph +graphs: { +} +scriptEngines: { + gremlin-groovy: { + staticImports: [ + org.opencypher.gremlin.process.traversal.CustomPredicates.*', + org.opencypher.gremlin.traversal.CustomFunctions.* + ], + plugins: { + org.apache.hugegraph.plugin.HugeGraphGremlinPlugin: {}, + org.apache.tinkerpop.gremlin.server.jsr223.GremlinServerGremlinPlugin: {}, + org.apache.tinkerpop.gremlin.jsr223.ImportGremlinPlugin: { + classImports: [ + java.lang.Math, + org.apache.hugegraph.backend.id.IdGenerator, + org.apache.hugegraph.type.define.Directions, + org.apache.hugegraph.type.define.NodeRole, + org.apache.hugegraph.masterelection.GlobalMasterInfo, + org.apache.hugegraph.util.DateUtil, + org.apache.hugegraph.traversal.algorithm.CollectionPathsTraverser, + org.apache.hugegraph.traversal.algorithm.CountTraverser, + org.apache.hugegraph.traversal.algorithm.CustomizedCrosspointsTraverser, + org.apache.hugegraph.traversal.algorithm.CustomizePathsTraverser, + org.apache.hugegraph.traversal.algorithm.FusiformSimilarityTraverser, + org.apache.hugegraph.traversal.algorithm.HugeTraverser, + org.apache.hugegraph.traversal.algorithm.JaccardSimilarTraverser, + org.apache.hugegraph.traversal.algorithm.KneighborTraverser, + org.apache.hugegraph.traversal.algorithm.KoutTraverser, + org.apache.hugegraph.traversal.algorithm.MultiNodeShortestPathTraverser, + org.apache.hugegraph.traversal.algorithm.NeighborRankTraverser, + org.apache.hugegraph.traversal.algorithm.PathsTraverser, + org.apache.hugegraph.traversal.algorithm.PersonalRankTraverser, + org.apache.hugegraph.traversal.algorithm.SameNeighborTraverser, + org.apache.hugegraph.traversal.algorithm.ShortestPathTraverser, + org.apache.hugegraph.traversal.algorithm.SingleSourceShortestPathTraverser, + org.apache.hugegraph.traversal.algorithm.SubGraphTraverser, + org.apache.hugegraph.traversal.algorithm.TemplatePathsTraverser, + org.apache.hugegraph.traversal.algorithm.steps.EdgeStep, + org.apache.hugegraph.traversal.algorithm.steps.RepeatEdgeStep, + org.apache.hugegraph.traversal.algorithm.steps.WeightedEdgeStep, + org.apache.hugegraph.traversal.optimize.ConditionP, + org.apache.hugegraph.traversal.optimize.Text, + org.apache.hugegraph.traversal.optimize.TraversalUtil, + org.opencypher.gremlin.traversal.CustomFunctions, + org.opencypher.gremlin.traversal.CustomPredicate + ], + methodImports: [ + java.lang.Math#*, + org.opencypher.gremlin.traversal.CustomPredicate#*, + org.opencypher.gremlin.traversal.CustomFunctions#* + ] + }, + org.apache.tinkerpop.gremlin.jsr223.ScriptFileGremlinPlugin: { + files: [scripts/empty-sample.groovy] + } + } + } +} +serializers: + - {className: org.apache.tinkerpop.gremlin.driver.ser.GraphBinaryMessageSerializerV1, + config: { + serializeResultToString: false, + ioRegistries: [org.apache.hugegraph.io.HugeGraphIoRegistry] + } + } + - {className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV1d0, + config: { + serializeResultToString: false, + ioRegistries: [org.apache.hugegraph.io.HugeGraphIoRegistry] + } + } + - {className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV2d0, + config: { + serializeResultToString: false, + ioRegistries: [org.apache.hugegraph.io.HugeGraphIoRegistry] + } + } + - {className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV3d0, + config: { + serializeResultToString: false, + ioRegistries: [org.apache.hugegraph.io.HugeGraphIoRegistry] + } + } +metrics: { + consoleReporter: {enabled: false, interval: 180000}, + csvReporter: {enabled: false, interval: 180000, fileName: ./metrics/gremlin-server-metrics.csv}, + jmxReporter: {enabled: false}, + slf4jReporter: {enabled: false, interval: 180000}, + gangliaReporter: {enabled: false, interval: 180000, addressingMode: MULTICAST}, + graphiteReporter: {enabled: false, interval: 180000} +} +maxInitialLineLength: 4096 +maxHeaderSize: 8192 +maxChunkSize: 8192 +maxContentLength: 65536 +maxAccumulationBufferComponents: 1024 +resultIterationBatchSize: 64 +writeBufferLowWaterMark: 32768 +writeBufferHighWaterMark: 65536 +ssl: { + enabled: false +} diff --git a/hugegraph-it/hg-it-dist/src/assembly/static/multi/server/B/conf/hugegraph-server.keystore b/hugegraph-it/hg-it-dist/src/assembly/static/multi/server/B/conf/hugegraph-server.keystore new file mode 100644 index 0000000000000000000000000000000000000000..e60c6b4c4ca066e165da3d5d880d1d780fb976fa GIT binary patch literal 1733 zcmY+Ddpy$%AIG=fE(|Ga?rAuU*g9>lOK50Vh`IC}mng;DNp@z;ZSGOxoCwvnE-uGq zDvFJhdlwG}L!yr6l3Oi0E~QnE=XpKPdCvLc^ZLGCpU?OE`Rn_}v*8^87=mZR6W|EL zEXSD}sBL@KwiMv<|GiR>0|Q((a39YG_;>@j z-2d$Da!n}8dwGrI^Jeazr<}U>@X`FvaOUzL00DKmLD@j6-U}=!sw|0~-#YB(_U&lC z;2bWbKk3MH1SjB*xD{hl9zVztK2i@k`6_a{AsjrB_*RV-5p=s7em>x9dHui`?TStC zew}Gp>C>!?6P|Te@;$LGQQ@!!h8+yzSu0*0XVnWI?$fJP2^-eKF0Cx!V*U^-{v7&A zZA)dtgq1S4RU$X4xG}fPdshqkuFQ-5jQQqNzPxSM^!`N$P^S0`-_ zX(=iHHj(PsxSFVEf0maY!V~9bRul*qF&EgQVYVAJ2g33ytqjMa`v#g3W)e>XCt&8$ z9If&8^~q8hYo?*IcbyxxCP?xwDcKHGKu(6Dd-o;A^ri$)$$tD$r(Ao8=wH@58K(W_ z@_}~?6j58xVHV?g_CpdfR*5+Z$=PkI3-MhCL^TIVk3N15Er{zpuTJWsGzsHJ%Fru! z{o15CkKJtFt}OfYy)IMcnF?&wDVLp&W7H<-_kf#+s5fv6V^)xZ{ZCw1m}vp)HD)J$SzCL@+;WnBb& zyw0C5jzAGmdy$|J5FJDV1#K%9bQ%-`3i<1bG64ledWJ>@X%o!wrg)+m{*VdL%zT>% zlRtZ8;9NEYvu)`BV9@r^_b3!Eq#=y}Xp}6cncLNk)#myqh|?Uf zu#q_2Km9KKA=C@ZP+&<}b1Iu^JHhUU?UR|!$f-I^6W-~x5qUwla8u_tX*$ZoHT<&b3|1oa%&cIWheq1!vp7}vo&|KS@csHK&>Ce4GlhAG-Q1r zmnF8Bp{++bw3liV*ab;^waVWNQ;cbFZ9VA1Y)=RD7Lm^7r6NZm?O5cBk_7eT9(@ z#V+49ncJ&NBfmTO%vM3)>L&@ogFTk>U}`zLNH-nz>fD=Q|AZrYr&Ek8yxr5%1lJq$ zuMC8=D>7uEsuqvT5>#cyV1BMNg~w2vHB1buzv1(+;CD=JxXaDf`~hox#GZLq(_uo9 zrPofrOMz?k<-#fe_p&8jfMHP2SZt({*B$Grc^_|u%?x?dy@TIK@fTrtVsZ%qKVGz? zJ(&Vd#8Db?$uzt1l<{UG^LdhGlfFhen!o3hw%YK(kA|3QKO|X^MHcRGJK?XP)O(z- z^uo_Ssjc@571 literal 0 HcmV?d00001 diff --git a/hugegraph-it/hg-it-dist/src/assembly/static/multi/server/B/conf/log4j2.xml b/hugegraph-it/hg-it-dist/src/assembly/static/multi/server/B/conf/log4j2.xml new file mode 100644 index 0000000000..f1dd7e8395 --- /dev/null +++ b/hugegraph-it/hg-it-dist/src/assembly/static/multi/server/B/conf/log4j2.xml @@ -0,0 +1,144 @@ + + + + + + logs + hugegraph-server + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/hugegraph-it/hg-it-dist/src/assembly/static/multi/server/B/conf/remote-objects.yaml b/hugegraph-it/hg-it-dist/src/assembly/static/multi/server/B/conf/remote-objects.yaml new file mode 100644 index 0000000000..39679d8c30 --- /dev/null +++ b/hugegraph-it/hg-it-dist/src/assembly/static/multi/server/B/conf/remote-objects.yaml @@ -0,0 +1,30 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +hosts: [localhost] +port: 8182 +serializer: { + className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV1d0, + config: { + serializeResultToString: false, + # The duplication of HugeGraphIoRegistry is meant to fix a bug in the + # 'org.apache.tinkerpop.gremlin.driver.Settings:from(Configuration)' method. + ioRegistries: [ + org.apache.hugegraph.io.HugeGraphIoRegistry, + org.apache.hugegraph.io.HugeGraphIoRegistry + ] + } +} diff --git a/hugegraph-it/hg-it-dist/src/assembly/static/multi/server/B/conf/remote.yaml b/hugegraph-it/hg-it-dist/src/assembly/static/multi/server/B/conf/remote.yaml new file mode 100644 index 0000000000..55f38ab97d --- /dev/null +++ b/hugegraph-it/hg-it-dist/src/assembly/static/multi/server/B/conf/remote.yaml @@ -0,0 +1,25 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +hosts: [localhost] +port: 8182 +serializer: { + className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV1d0, + config: { + serializeResultToString: false, + ioRegistries: [org.apache.hugegraph.io.HugeGraphIoRegistry] + } +} diff --git a/hugegraph-it/hg-it-dist/src/assembly/static/multi/server/B/conf/rest-server.properties b/hugegraph-it/hg-it-dist/src/assembly/static/multi/server/B/conf/rest-server.properties new file mode 100644 index 0000000000..ee4fcd6db5 --- /dev/null +++ b/hugegraph-it/hg-it-dist/src/assembly/static/multi/server/B/conf/rest-server.properties @@ -0,0 +1,70 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# bind url +restserver.url=http://127.0.0.1:8082 +# gremlin server url, need to be consistent with host and port in gremlin-server.yaml +gremlinserver.url=http://127.0.0.1:8182 + +graphs=./conf/graphs + +# The maximum thread ratio for batch writing, only take effect if the batch.max_write_threads is 0 +batch.max_write_ratio=80 +batch.max_write_threads=0 + +# configuration of arthas +arthas.telnet_port=8572 +arthas.http_port=8571 +arthas.ip=127.0.0.1 +arthas.disabled_commands=jad + +# authentication configs +# choose 'org.apache.hugegraph.auth.StandardAuthenticator' or +# 'org.apache.hugegraph.auth.ConfigAuthenticator' +#auth.authenticator= + +# for StandardAuthenticator mode +#auth.graph_store=hugegraph +# auth client config +#auth.remote_url=127.0.0.1:8899,127.0.0.1:8898,127.0.0.1:8897 + +# for ConfigAuthenticator mode +#auth.admin_token= +#auth.user_tokens=[] + +# rpc server configs for multi graph-servers or raft-servers +rpc.server_host=127.0.0.1 +rpc.server_port=8092 +#rpc.server_timeout=30 + +# rpc client configs (like enable to keep cache consistency) +#rpc.remote_url=127.0.0.1:8091,127.0.0.1:8092,127.0.0.1:8093 +#rpc.client_connect_timeout=20 +#rpc.client_reconnect_period=10 +#rpc.client_read_timeout=40 +#rpc.client_retries=3 +#rpc.client_load_balancer=consistentHash + +# raft group initial peers +#raft.group_peers=127.0.0.1:8091,127.0.0.1:8092,127.0.0.1:8093 + +# lightweight load balancing (beta) +server.id=server-2 +server.role=worker + +# slow query log +log.slow_query_threshold=1000 diff --git a/hugegraph-it/hg-it-dist/src/assembly/static/multi/server/C/conf/computer.yaml b/hugegraph-it/hg-it-dist/src/assembly/static/multi/server/C/conf/computer.yaml new file mode 100644 index 0000000000..1c69388bb0 --- /dev/null +++ b/hugegraph-it/hg-it-dist/src/assembly/static/multi/server/C/conf/computer.yaml @@ -0,0 +1,39 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# common parameters +common: { + worker_heap: 10000, + vertex_input_dir: /data, + workers: 51, + zookeeper_list: "127.0.0.1:2181", + max_edges_per_segment: 10485760, + edges_immutable: true, + partitions: 255, + compute_threads: 5, + input_threads: 5, + message_async: false, + message_queue_size: 1000, + message_send_threads: 10, + messages_per_segment: 104857600, + hugegraph_url: "http://127.0.0.1:8080", + hugegraph_name: hugegraph, + hugegraph_timeout: 60 +} + +env: { + computer_home: /home/computer +} diff --git a/hugegraph-it/hg-it-dist/src/assembly/static/multi/server/C/conf/graphs/hugegraph.properties b/hugegraph-it/hg-it-dist/src/assembly/static/multi/server/C/conf/graphs/hugegraph.properties new file mode 100644 index 0000000000..02b2d43270 --- /dev/null +++ b/hugegraph-it/hg-it-dist/src/assembly/static/multi/server/C/conf/graphs/hugegraph.properties @@ -0,0 +1,126 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# gremlin entrance to create graph +# auth config: org.apache.hugegraph.auth.HugeFactoryAuthProxy +gremlin.graph=org.apache.hugegraph.HugeFactory + +# cache config +#schema.cache_capacity=100000 +# vertex-cache default is 1000w, 10min expired +vertex.cache_type=l2 +#vertex.cache_capacity=10000000 +#vertex.cache_expire=600 +# edge-cache default is 100w, 10min expired +edge.cache_type=l2 +#edge.cache_capacity=1000000 +#edge.cache_expire=600 + + +# schema illegal name template +#schema.illegal_name_regex=\s+|~.* + +#vertex.default_label=vertex + +backend=hstore +serializer=binary + +store=hugegraph + +# pd config +pd.peers=127.0.0.1:8686,127.0.0.1:8687,127.0.0.1:8688 + +# task config +task.scheduler_type=local +task.schedule_period=10 +task.retry=0 +task.wait_timeout=10 + +# raft config +raft.mode=false +raft.path=./raft-log +raft.safe_read=true +raft.use_replicator_pipeline=true +raft.election_timeout=10000 +raft.snapshot_interval=3600 +raft.backend_threads=48 +raft.read_index_threads=8 +raft.snapshot_threads=4 +raft.snapshot_parallel_compress=false +raft.snapshot_compress_threads=4 +raft.snapshot_decompress_threads=4 +raft.read_strategy=ReadOnlyLeaseBased +raft.queue_size=16384 +raft.queue_publish_timeout=60 +raft.apply_batch=1 +raft.rpc_threads=80 +raft.rpc_connect_timeout=5000 +raft.rpc_timeout=60 +raft.install_snapshot_rpc_timeout=36000 + +# search config +search.text_analyzer=jieba +search.text_analyzer_mode=INDEX + +# rocksdb backend config +#rocksdb.data_path=/path/to/disk +#rocksdb.wal_path=/path/to/disk + + +# cassandra backend config +cassandra.host=localhost +cassandra.port=9042 +cassandra.username= +cassandra.password= +#cassandra.connect_timeout=5 +#cassandra.read_timeout=20 +#cassandra.keyspace.strategy=SimpleStrategy +#cassandra.keyspace.replication=3 + +# hbase backend config +#hbase.hosts=localhost +#hbase.port=2181 +#hbase.znode_parent=/hbase +#hbase.threads_max=64 +# IMPORTANT: recommend to modify the HBase partition number +# by the actual/env data amount & RS amount before init store +# It will influence the load speed a lot +#hbase.enable_partition=true +#hbase.vertex_partitions=10 +#hbase.edge_partitions=30 + +# mysql backend config +#jdbc.driver=com.mysql.jdbc.Driver +#jdbc.url=jdbc:mysql://127.0.0.1:3306 +#jdbc.username=root +#jdbc.password= +#jdbc.reconnect_max_times=3 +#jdbc.reconnect_interval=3 +#jdbc.ssl_mode=false + +# postgresql & cockroachdb backend config +#jdbc.driver=org.postgresql.Driver +#jdbc.url=jdbc:postgresql://localhost:5432/ +#jdbc.username=postgres +#jdbc.password= +#jdbc.postgresql.connect_database=template1 + +# palo backend config +#palo.host=127.0.0.1 +#palo.poll_interval=10 +#palo.temp_dir=./palo-data +#palo.file_limit_size=32 diff --git a/hugegraph-it/hg-it-dist/src/assembly/static/multi/server/C/conf/gremlin-driver-settings.yaml b/hugegraph-it/hg-it-dist/src/assembly/static/multi/server/C/conf/gremlin-driver-settings.yaml new file mode 100644 index 0000000000..00ef046699 --- /dev/null +++ b/hugegraph-it/hg-it-dist/src/assembly/static/multi/server/C/conf/gremlin-driver-settings.yaml @@ -0,0 +1,25 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +hosts: [localhost] +port: 8183 +serializer: { + className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV1d0, + config: { + serializeResultToString: false, + ioRegistries: [org.apache.hugegraph.io.HugeGraphIoRegistry] + } +} diff --git a/hugegraph-it/hg-it-dist/src/assembly/static/multi/server/C/conf/gremlin-server.yaml b/hugegraph-it/hg-it-dist/src/assembly/static/multi/server/C/conf/gremlin-server.yaml new file mode 100644 index 0000000000..e153926bc9 --- /dev/null +++ b/hugegraph-it/hg-it-dist/src/assembly/static/multi/server/C/conf/gremlin-server.yaml @@ -0,0 +1,127 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# host and port of gremlin server, need to be consistent with host and port in rest-server.properties +host: 127.0.0.1 +port: 8183 + +# timeout in ms of gremlin query +evaluationTimeout: 30000 + +channelizer: org.apache.tinkerpop.gremlin.server.channel.WsAndHttpChannelizer +# don't set graph at here, this happens after support for dynamically adding graph +graphs: { +} +scriptEngines: { + gremlin-groovy: { + staticImports: [ + org.opencypher.gremlin.process.traversal.CustomPredicates.*', + org.opencypher.gremlin.traversal.CustomFunctions.* + ], + plugins: { + org.apache.hugegraph.plugin.HugeGraphGremlinPlugin: {}, + org.apache.tinkerpop.gremlin.server.jsr223.GremlinServerGremlinPlugin: {}, + org.apache.tinkerpop.gremlin.jsr223.ImportGremlinPlugin: { + classImports: [ + java.lang.Math, + org.apache.hugegraph.backend.id.IdGenerator, + org.apache.hugegraph.type.define.Directions, + org.apache.hugegraph.type.define.NodeRole, + org.apache.hugegraph.masterelection.GlobalMasterInfo, + org.apache.hugegraph.util.DateUtil, + org.apache.hugegraph.traversal.algorithm.CollectionPathsTraverser, + org.apache.hugegraph.traversal.algorithm.CountTraverser, + org.apache.hugegraph.traversal.algorithm.CustomizedCrosspointsTraverser, + org.apache.hugegraph.traversal.algorithm.CustomizePathsTraverser, + org.apache.hugegraph.traversal.algorithm.FusiformSimilarityTraverser, + org.apache.hugegraph.traversal.algorithm.HugeTraverser, + org.apache.hugegraph.traversal.algorithm.JaccardSimilarTraverser, + org.apache.hugegraph.traversal.algorithm.KneighborTraverser, + org.apache.hugegraph.traversal.algorithm.KoutTraverser, + org.apache.hugegraph.traversal.algorithm.MultiNodeShortestPathTraverser, + org.apache.hugegraph.traversal.algorithm.NeighborRankTraverser, + org.apache.hugegraph.traversal.algorithm.PathsTraverser, + org.apache.hugegraph.traversal.algorithm.PersonalRankTraverser, + org.apache.hugegraph.traversal.algorithm.SameNeighborTraverser, + org.apache.hugegraph.traversal.algorithm.ShortestPathTraverser, + org.apache.hugegraph.traversal.algorithm.SingleSourceShortestPathTraverser, + org.apache.hugegraph.traversal.algorithm.SubGraphTraverser, + org.apache.hugegraph.traversal.algorithm.TemplatePathsTraverser, + org.apache.hugegraph.traversal.algorithm.steps.EdgeStep, + org.apache.hugegraph.traversal.algorithm.steps.RepeatEdgeStep, + org.apache.hugegraph.traversal.algorithm.steps.WeightedEdgeStep, + org.apache.hugegraph.traversal.optimize.ConditionP, + org.apache.hugegraph.traversal.optimize.Text, + org.apache.hugegraph.traversal.optimize.TraversalUtil, + org.opencypher.gremlin.traversal.CustomFunctions, + org.opencypher.gremlin.traversal.CustomPredicate + ], + methodImports: [ + java.lang.Math#*, + org.opencypher.gremlin.traversal.CustomPredicate#*, + org.opencypher.gremlin.traversal.CustomFunctions#* + ] + }, + org.apache.tinkerpop.gremlin.jsr223.ScriptFileGremlinPlugin: { + files: [scripts/empty-sample.groovy] + } + } + } +} +serializers: + - {className: org.apache.tinkerpop.gremlin.driver.ser.GraphBinaryMessageSerializerV1, + config: { + serializeResultToString: false, + ioRegistries: [org.apache.hugegraph.io.HugeGraphIoRegistry] + } + } + - {className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV1d0, + config: { + serializeResultToString: false, + ioRegistries: [org.apache.hugegraph.io.HugeGraphIoRegistry] + } + } + - {className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV2d0, + config: { + serializeResultToString: false, + ioRegistries: [org.apache.hugegraph.io.HugeGraphIoRegistry] + } + } + - {className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV3d0, + config: { + serializeResultToString: false, + ioRegistries: [org.apache.hugegraph.io.HugeGraphIoRegistry] + } + } +metrics: { + consoleReporter: {enabled: false, interval: 180000}, + csvReporter: {enabled: false, interval: 180000, fileName: ./metrics/gremlin-server-metrics.csv}, + jmxReporter: {enabled: false}, + slf4jReporter: {enabled: false, interval: 180000}, + gangliaReporter: {enabled: false, interval: 180000, addressingMode: MULTICAST}, + graphiteReporter: {enabled: false, interval: 180000} +} +maxInitialLineLength: 4096 +maxHeaderSize: 8192 +maxChunkSize: 8192 +maxContentLength: 65536 +maxAccumulationBufferComponents: 1024 +resultIterationBatchSize: 64 +writeBufferLowWaterMark: 32768 +writeBufferHighWaterMark: 65536 +ssl: { + enabled: false +} diff --git a/hugegraph-it/hg-it-dist/src/assembly/static/multi/server/C/conf/hugegraph-server.keystore b/hugegraph-it/hg-it-dist/src/assembly/static/multi/server/C/conf/hugegraph-server.keystore new file mode 100644 index 0000000000000000000000000000000000000000..e60c6b4c4ca066e165da3d5d880d1d780fb976fa GIT binary patch literal 1733 zcmY+Ddpy$%AIG=fE(|Ga?rAuU*g9>lOK50Vh`IC}mng;DNp@z;ZSGOxoCwvnE-uGq zDvFJhdlwG}L!yr6l3Oi0E~QnE=XpKPdCvLc^ZLGCpU?OE`Rn_}v*8^87=mZR6W|EL zEXSD}sBL@KwiMv<|GiR>0|Q((a39YG_;>@j z-2d$Da!n}8dwGrI^Jeazr<}U>@X`FvaOUzL00DKmLD@j6-U}=!sw|0~-#YB(_U&lC z;2bWbKk3MH1SjB*xD{hl9zVztK2i@k`6_a{AsjrB_*RV-5p=s7em>x9dHui`?TStC zew}Gp>C>!?6P|Te@;$LGQQ@!!h8+yzSu0*0XVnWI?$fJP2^-eKF0Cx!V*U^-{v7&A zZA)dtgq1S4RU$X4xG}fPdshqkuFQ-5jQQqNzPxSM^!`N$P^S0`-_ zX(=iHHj(PsxSFVEf0maY!V~9bRul*qF&EgQVYVAJ2g33ytqjMa`v#g3W)e>XCt&8$ z9If&8^~q8hYo?*IcbyxxCP?xwDcKHGKu(6Dd-o;A^ri$)$$tD$r(Ao8=wH@58K(W_ z@_}~?6j58xVHV?g_CpdfR*5+Z$=PkI3-MhCL^TIVk3N15Er{zpuTJWsGzsHJ%Fru! z{o15CkKJtFt}OfYy)IMcnF?&wDVLp&W7H<-_kf#+s5fv6V^)xZ{ZCw1m}vp)HD)J$SzCL@+;WnBb& zyw0C5jzAGmdy$|J5FJDV1#K%9bQ%-`3i<1bG64ledWJ>@X%o!wrg)+m{*VdL%zT>% zlRtZ8;9NEYvu)`BV9@r^_b3!Eq#=y}Xp}6cncLNk)#myqh|?Uf zu#q_2Km9KKA=C@ZP+&<}b1Iu^JHhUU?UR|!$f-I^6W-~x5qUwla8u_tX*$ZoHT<&b3|1oa%&cIWheq1!vp7}vo&|KS@csHK&>Ce4GlhAG-Q1r zmnF8Bp{++bw3liV*ab;^waVWNQ;cbFZ9VA1Y)=RD7Lm^7r6NZm?O5cBk_7eT9(@ z#V+49ncJ&NBfmTO%vM3)>L&@ogFTk>U}`zLNH-nz>fD=Q|AZrYr&Ek8yxr5%1lJq$ zuMC8=D>7uEsuqvT5>#cyV1BMNg~w2vHB1buzv1(+;CD=JxXaDf`~hox#GZLq(_uo9 zrPofrOMz?k<-#fe_p&8jfMHP2SZt({*B$Grc^_|u%?x?dy@TIK@fTrtVsZ%qKVGz? zJ(&Vd#8Db?$uzt1l<{UG^LdhGlfFhen!o3hw%YK(kA|3QKO|X^MHcRGJK?XP)O(z- z^uo_Ssjc@571 literal 0 HcmV?d00001 diff --git a/hugegraph-it/hg-it-dist/src/assembly/static/multi/server/C/conf/log4j2.xml b/hugegraph-it/hg-it-dist/src/assembly/static/multi/server/C/conf/log4j2.xml new file mode 100644 index 0000000000..f1dd7e8395 --- /dev/null +++ b/hugegraph-it/hg-it-dist/src/assembly/static/multi/server/C/conf/log4j2.xml @@ -0,0 +1,144 @@ + + + + + + logs + hugegraph-server + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/hugegraph-it/hg-it-dist/src/assembly/static/multi/server/C/conf/remote-objects.yaml b/hugegraph-it/hg-it-dist/src/assembly/static/multi/server/C/conf/remote-objects.yaml new file mode 100644 index 0000000000..ce99fcb2f6 --- /dev/null +++ b/hugegraph-it/hg-it-dist/src/assembly/static/multi/server/C/conf/remote-objects.yaml @@ -0,0 +1,30 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +hosts: [localhost] +port: 8183 +serializer: { + className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV1d0, + config: { + serializeResultToString: false, + # The duplication of HugeGraphIoRegistry is meant to fix a bug in the + # 'org.apache.tinkerpop.gremlin.driver.Settings:from(Configuration)' method. + ioRegistries: [ + org.apache.hugegraph.io.HugeGraphIoRegistry, + org.apache.hugegraph.io.HugeGraphIoRegistry + ] + } +} diff --git a/hugegraph-it/hg-it-dist/src/assembly/static/multi/server/C/conf/remote.yaml b/hugegraph-it/hg-it-dist/src/assembly/static/multi/server/C/conf/remote.yaml new file mode 100644 index 0000000000..00ef046699 --- /dev/null +++ b/hugegraph-it/hg-it-dist/src/assembly/static/multi/server/C/conf/remote.yaml @@ -0,0 +1,25 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +hosts: [localhost] +port: 8183 +serializer: { + className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV1d0, + config: { + serializeResultToString: false, + ioRegistries: [org.apache.hugegraph.io.HugeGraphIoRegistry] + } +} diff --git a/hugegraph-it/hg-it-dist/src/assembly/static/multi/server/C/conf/rest-server.properties b/hugegraph-it/hg-it-dist/src/assembly/static/multi/server/C/conf/rest-server.properties new file mode 100644 index 0000000000..962065bfa4 --- /dev/null +++ b/hugegraph-it/hg-it-dist/src/assembly/static/multi/server/C/conf/rest-server.properties @@ -0,0 +1,70 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# bind url +restserver.url=http://127.0.0.1:8083 +# gremlin server url, need to be consistent with host and port in gremlin-server.yaml +gremlinserver.url=http://127.0.0.1:8183 + +graphs=./conf/graphs + +# The maximum thread ratio for batch writing, only take effect if the batch.max_write_threads is 0 +batch.max_write_ratio=80 +batch.max_write_threads=0 + +# configuration of arthas +arthas.telnet_port=8582 +arthas.http_port=8581 +arthas.ip=127.0.0.1 +arthas.disabled_commands=jad + +# authentication configs +# choose 'org.apache.hugegraph.auth.StandardAuthenticator' or +# 'org.apache.hugegraph.auth.ConfigAuthenticator' +#auth.authenticator= + +# for StandardAuthenticator mode +#auth.graph_store=hugegraph +# auth client config +#auth.remote_url=127.0.0.1:8899,127.0.0.1:8898,127.0.0.1:8897 + +# for ConfigAuthenticator mode +#auth.admin_token= +#auth.user_tokens=[] + +# rpc server configs for multi graph-servers or raft-servers +rpc.server_host=127.0.0.1 +rpc.server_port=8093 +#rpc.server_timeout=30 + +# rpc client configs (like enable to keep cache consistency) +#rpc.remote_url=127.0.0.1:8091,127.0.0.1:8092,127.0.0.1:8093 +#rpc.client_connect_timeout=20 +#rpc.client_reconnect_period=10 +#rpc.client_read_timeout=40 +#rpc.client_retries=3 +#rpc.client_load_balancer=consistentHash + +# raft group initial peers +#raft.group_peers=127.0.0.1:8091,127.0.0.1:8092,127.0.0.1:8093 + +# lightweight load balancing (beta) +server.id=server-3 +server.role=worker + +# slow query log +log.slow_query_threshold=1000 diff --git a/hugegraph-it/hg-it-dist/src/assembly/static/multi/store/A/conf/application-pd.yml b/hugegraph-it/hg-it-dist/src/assembly/static/multi/store/A/conf/application-pd.yml new file mode 100644 index 0000000000..df535953fc --- /dev/null +++ b/hugegraph-it/hg-it-dist/src/assembly/static/multi/store/A/conf/application-pd.yml @@ -0,0 +1,34 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +management: + metrics: + export: + prometheus: + enabled: true + endpoints: + web: + exposure: + include: "*" + +rocksdb: + # rocksdb 使用的总内存大小,达到该值强制写盘 + total_memory_size: 32000000000 + # rocksdb 使用的 memtable 大小 + write_buffer_size: 32000000 + # 对于每个 rocksdb 来说,memtable 个数达到该值进行写盘 + min_write_buffer_number_to_merge: 16 diff --git a/hugegraph-it/hg-it-dist/src/assembly/static/multi/store/A/conf/application.yml b/hugegraph-it/hg-it-dist/src/assembly/static/multi/store/A/conf/application.yml new file mode 100644 index 0000000000..75b743c2a3 --- /dev/null +++ b/hugegraph-it/hg-it-dist/src/assembly/static/multi/store/A/conf/application.yml @@ -0,0 +1,64 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +pdserver: + # pd 服务地址,多个 pd 地址用逗号分割 + address: 127.0.0.1:8686,127.0.0.1:8687,127.0.0.1:8688 + +management: + metrics: + export: + prometheus: + enabled: true + endpoints: + web: + exposure: + include: "*" + +grpc: + # grpc 的服务地址 + host: 127.0.0.1 + port: 8500 + netty-server: + max-inbound-message-size: 1000MB +raft: + # raft 缓存队列大小 + disruptorBufferSize: 1024 + address: 127.0.0.1:8510 + max-log-file-size: 600000000000 + # 快照生成时间间隔,单位秒 + snapshotInterval: 1800 +server: + # rest 服务地址 + port: 8520 + +app: + # 存储路径,支持多个路径,逗号分割 + data-path: ./storage + #raft-path: ./storage + +spring: + application: + name: store-node-grpc-server + profiles: + active: default + include: pd + +logging: + config: 'file:./conf/log4j2.xml' + level: + root: info diff --git a/hugegraph-it/hg-it-dist/src/assembly/static/multi/store/A/conf/log4j2.xml b/hugegraph-it/hg-it-dist/src/assembly/static/multi/store/A/conf/log4j2.xml new file mode 100644 index 0000000000..9dbaa7e89d --- /dev/null +++ b/hugegraph-it/hg-it-dist/src/assembly/static/multi/store/A/conf/log4j2.xml @@ -0,0 +1,137 @@ + + + + + + + + logs + hugegraph-store + raft-hugegraph-store + audit-hugegraph-store + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/hugegraph-it/hg-it-dist/src/assembly/static/multi/store/B/conf/application-pd.yml b/hugegraph-it/hg-it-dist/src/assembly/static/multi/store/B/conf/application-pd.yml new file mode 100644 index 0000000000..df535953fc --- /dev/null +++ b/hugegraph-it/hg-it-dist/src/assembly/static/multi/store/B/conf/application-pd.yml @@ -0,0 +1,34 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +management: + metrics: + export: + prometheus: + enabled: true + endpoints: + web: + exposure: + include: "*" + +rocksdb: + # rocksdb 使用的总内存大小,达到该值强制写盘 + total_memory_size: 32000000000 + # rocksdb 使用的 memtable 大小 + write_buffer_size: 32000000 + # 对于每个 rocksdb 来说,memtable 个数达到该值进行写盘 + min_write_buffer_number_to_merge: 16 diff --git a/hugegraph-it/hg-it-dist/src/assembly/static/multi/store/B/conf/application.yml b/hugegraph-it/hg-it-dist/src/assembly/static/multi/store/B/conf/application.yml new file mode 100644 index 0000000000..e4b2824ff9 --- /dev/null +++ b/hugegraph-it/hg-it-dist/src/assembly/static/multi/store/B/conf/application.yml @@ -0,0 +1,64 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +pdserver: + # pd 服务地址,多个 pd 地址用逗号分割 + address: 127.0.0.1:8686,127.0.0.1:8687,127.0.0.1:8688 + +management: + metrics: + export: + prometheus: + enabled: true + endpoints: + web: + exposure: + include: "*" + +grpc: + # grpc 的服务地址 + host: 127.0.0.1 + port: 8501 + netty-server: + max-inbound-message-size: 1000MB +raft: + # raft 缓存队列大小 + disruptorBufferSize: 1024 + address: 127.0.0.1:8511 + max-log-file-size: 600000000000 + # 快照生成时间间隔,单位秒 + snapshotInterval: 1800 +server: + # rest 服务地址 + port: 8521 + +app: + # 存储路径,支持多个路径,逗号分割 + data-path: ./storage + #raft-path: ./storage + +spring: + application: + name: store-node-grpc-server + profiles: + active: default + include: pd + +logging: + config: 'file:./conf/log4j2.xml' + level: + root: info diff --git a/hugegraph-it/hg-it-dist/src/assembly/static/multi/store/B/conf/log4j2.xml b/hugegraph-it/hg-it-dist/src/assembly/static/multi/store/B/conf/log4j2.xml new file mode 100644 index 0000000000..9dbaa7e89d --- /dev/null +++ b/hugegraph-it/hg-it-dist/src/assembly/static/multi/store/B/conf/log4j2.xml @@ -0,0 +1,137 @@ + + + + + + + + logs + hugegraph-store + raft-hugegraph-store + audit-hugegraph-store + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/hugegraph-it/hg-it-dist/src/assembly/static/multi/store/C/conf/application-pd.yml b/hugegraph-it/hg-it-dist/src/assembly/static/multi/store/C/conf/application-pd.yml new file mode 100644 index 0000000000..df535953fc --- /dev/null +++ b/hugegraph-it/hg-it-dist/src/assembly/static/multi/store/C/conf/application-pd.yml @@ -0,0 +1,34 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +management: + metrics: + export: + prometheus: + enabled: true + endpoints: + web: + exposure: + include: "*" + +rocksdb: + # rocksdb 使用的总内存大小,达到该值强制写盘 + total_memory_size: 32000000000 + # rocksdb 使用的 memtable 大小 + write_buffer_size: 32000000 + # 对于每个 rocksdb 来说,memtable 个数达到该值进行写盘 + min_write_buffer_number_to_merge: 16 diff --git a/hugegraph-it/hg-it-dist/src/assembly/static/multi/store/C/conf/application.yml b/hugegraph-it/hg-it-dist/src/assembly/static/multi/store/C/conf/application.yml new file mode 100644 index 0000000000..324327cea7 --- /dev/null +++ b/hugegraph-it/hg-it-dist/src/assembly/static/multi/store/C/conf/application.yml @@ -0,0 +1,64 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +pdserver: + # pd 服务地址,多个 pd 地址用逗号分割 + address: 127.0.0.1:8686,127.0.0.1:8687,127.0.0.1:8688 + +management: + metrics: + export: + prometheus: + enabled: true + endpoints: + web: + exposure: + include: "*" + +grpc: + # grpc 的服务地址 + host: 127.0.0.1 + port: 8502 + netty-server: + max-inbound-message-size: 1000MB +raft: + # raft 缓存队列大小 + disruptorBufferSize: 1024 + address: 127.0.0.1:8512 + max-log-file-size: 600000000000 + # 快照生成时间间隔,单位秒 + snapshotInterval: 1800 +server: + # rest 服务地址 + port: 8522 + +app: + # 存储路径,支持多个路径,逗号分割 + data-path: ./storage + #raft-path: ./storage + +spring: + application: + name: store-node-grpc-server + profiles: + active: default + include: pd + +logging: + config: 'file:./conf/log4j2.xml' + level: + root: info diff --git a/hugegraph-it/hg-it-dist/src/assembly/static/multi/store/C/conf/log4j2.xml b/hugegraph-it/hg-it-dist/src/assembly/static/multi/store/C/conf/log4j2.xml new file mode 100644 index 0000000000..9dbaa7e89d --- /dev/null +++ b/hugegraph-it/hg-it-dist/src/assembly/static/multi/store/C/conf/log4j2.xml @@ -0,0 +1,137 @@ + + + + + + + + logs + hugegraph-store + raft-hugegraph-store + audit-hugegraph-store + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/hugegraph-it/hg-it-dist/src/assembly/static/simple/pd/conf/application.yml b/hugegraph-it/hg-it-dist/src/assembly/static/simple/pd/conf/application.yml new file mode 100644 index 0000000000..eb8fda4526 --- /dev/null +++ b/hugegraph-it/hg-it-dist/src/assembly/static/simple/pd/conf/application.yml @@ -0,0 +1,79 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +spring: + application: + name: hugegraph-pd + +management: + metrics: + export: + prometheus: + enabled: true + endpoints: + web: + exposure: + include: "*" + +logging: + config: 'file:./conf/log4j2.xml' +# TODO: handle the license file later (PDConfig) +license: + verify-path: ./conf/verify-license.json + license-path: ./conf/hugegraph.license +grpc: + port: 8686 + # The service address of grpc needs to be changed to the actual local IPv4 address when deploying. + host: 127.0.0.1 + +server: + # REST service port number + port: 8620 + +pd: + # Storage path + data-path: ./pd_data + # The check cycle of automatic expansion regularly checks the number of partitions in each store and automatically balances the number of partitions + patrol-interval: 1800 + # The minimum number of surviving store nodes, less than which the entire cluster is unavailable + initial-store-count: 1 + # The initial store list, grpc IP: grpc port, the store in the list is automatically activated + initial-store-list: 127.0.0.1:8500 + +raft: + # The address of the local raft service + address: 127.0.0.1:8610 + # The service address of the PD cluster + peers-list: 127.0.0.1:8610 + +store: + # The time when the store went offline. After that time, the store is considered permanently unavailable, and the replica is allocated to another machine, in seconds + max-down-time: 172800 + # Specifies whether to enable store monitoring data storage + monitor_data_enabled: true + # The interval between monitoring data, minute, hour, second + # default: 1 min * 1 day = 1440 + monitor_data_interval: 1 minute + # Retention time of monitoring data is 1 day; day, month, year + monitor_data_retention: 1 day + +partition: + # Default number of replicas per partition + default-shard-count: 1 + # The default maximum number of replicas per machine + # the initial number of partitions= store-max-shard-count * store-number / default-shard-count + store-max-shard-count: 12 diff --git a/hugegraph-it/hg-it-dist/src/assembly/static/simple/pd/conf/application.yml.template b/hugegraph-it/hg-it-dist/src/assembly/static/simple/pd/conf/application.yml.template new file mode 100644 index 0000000000..8b8f0d63c5 --- /dev/null +++ b/hugegraph-it/hg-it-dist/src/assembly/static/simple/pd/conf/application.yml.template @@ -0,0 +1,72 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +spring: + application: + name: hugegraph-pd +logging: + config: file:./conf/log4j2.xml + +management: + metrics: + export: + prometheus: + enabled: true + endpoints: + web: + exposure: + include: "*" + +grpc: + port: $GRPC_PORT$ + # grpc's service address, + # Note: You need to change to the local actual Iv 4 address when deploying. + host: $GRPC_HOST$ + netty-server: + max-inbound-message-size: 100MB + +server: + port : $SERVER_PORT$ + +pd: + # Cluster ID: to distinguish different PD clusters + + patrol-interval: 2147483647 + data-path: $PD_DATA_PATH$ + +raft: + address: $RAFT_ADDRESS$ + # raft cluster + peers-list: $RAFT_PEERS_LIST$ + # The interval between snapshot generation, in seconds + snapshotInterval: 300 + metrics: true +store: + # If the store heartbeat timeout period exceeds this time, the store is temporarily unavailable and the leader is transferred to another replica in seconds + keepAlive-timeout: 60 + # The time when the store went offline. After that time, the store is considered permanently unavailable, and the replica is allocated to another machine, in seconds + max-down-time: 1800 +partition: + # The default total number of partitions + default-total-count: 30 + # Default number of replicas per partition + default-shard-count: 3 + +discovery: + # After the client registers, the maximum number of heartbeats is not reached, and after that, the + previous registration information will be deleted + heartbeat-try-count: 3 diff --git a/hugegraph-it/hg-it-dist/src/assembly/static/simple/pd/conf/log4j2.xml b/hugegraph-it/hg-it-dist/src/assembly/static/simple/pd/conf/log4j2.xml new file mode 100644 index 0000000000..a804948703 --- /dev/null +++ b/hugegraph-it/hg-it-dist/src/assembly/static/simple/pd/conf/log4j2.xml @@ -0,0 +1,135 @@ + + + + + + + + logs + hugegraph-pd + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/hugegraph-it/hg-it-dist/src/assembly/static/simple/pd/conf/verify-license.json b/hugegraph-it/hg-it-dist/src/assembly/static/simple/pd/conf/verify-license.json new file mode 100644 index 0000000000..868ccbebbb --- /dev/null +++ b/hugegraph-it/hg-it-dist/src/assembly/static/simple/pd/conf/verify-license.json @@ -0,0 +1,6 @@ +{ + "subject": "hugegraph-license", + "public_alias": "publiccert", + "store_ticket": "803b6cc3-d144-47e8-948f-ec8b39c8881e", + "publickey_path": "/public-certs.store" +} diff --git a/hugegraph-it/hg-it-dist/src/assembly/static/simple/server/conf/computer.yaml b/hugegraph-it/hg-it-dist/src/assembly/static/simple/server/conf/computer.yaml new file mode 100644 index 0000000000..1c69388bb0 --- /dev/null +++ b/hugegraph-it/hg-it-dist/src/assembly/static/simple/server/conf/computer.yaml @@ -0,0 +1,39 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# common parameters +common: { + worker_heap: 10000, + vertex_input_dir: /data, + workers: 51, + zookeeper_list: "127.0.0.1:2181", + max_edges_per_segment: 10485760, + edges_immutable: true, + partitions: 255, + compute_threads: 5, + input_threads: 5, + message_async: false, + message_queue_size: 1000, + message_send_threads: 10, + messages_per_segment: 104857600, + hugegraph_url: "http://127.0.0.1:8080", + hugegraph_name: hugegraph, + hugegraph_timeout: 60 +} + +env: { + computer_home: /home/computer +} diff --git a/hugegraph-it/hg-it-dist/src/assembly/static/simple/server/conf/graphs/hugegraph.properties b/hugegraph-it/hg-it-dist/src/assembly/static/simple/server/conf/graphs/hugegraph.properties new file mode 100644 index 0000000000..1a3532914b --- /dev/null +++ b/hugegraph-it/hg-it-dist/src/assembly/static/simple/server/conf/graphs/hugegraph.properties @@ -0,0 +1,109 @@ +# gremlin entrance to create graph +# auth config: org.apache.hugegraph.auth.HugeFactoryAuthProxy +gremlin.graph=org.apache.hugegraph.HugeFactory + +# cache config +#schema.cache_capacity=100000 +# vertex-cache default is 1000w, 10min expired +vertex.cache_type=l2 +#vertex.cache_capacity=10000000 +#vertex.cache_expire=600 +# edge-cache default is 100w, 10min expired +edge.cache_type=l2 +#edge.cache_capacity=1000000 +#edge.cache_expire=600 + + +# schema illegal name template +#schema.illegal_name_regex=\s+|~.* + +#vertex.default_label=vertex + +backend=hstore +serializer=binary + +store=hugegraph + +# pd config +pd.peers=127.0.0.1:8686 + +# task config +task.scheduler_type=local +task.schedule_period=10 +task.retry=0 +task.wait_timeout=10 + +# raft config +raft.mode=false +raft.path=./raft-log +raft.safe_read=true +raft.use_replicator_pipeline=true +raft.election_timeout=10000 +raft.snapshot_interval=3600 +raft.backend_threads=48 +raft.read_index_threads=8 +raft.snapshot_threads=4 +raft.snapshot_parallel_compress=false +raft.snapshot_compress_threads=4 +raft.snapshot_decompress_threads=4 +raft.read_strategy=ReadOnlyLeaseBased +raft.queue_size=16384 +raft.queue_publish_timeout=60 +raft.apply_batch=1 +raft.rpc_threads=80 +raft.rpc_connect_timeout=5000 +raft.rpc_timeout=60 +raft.install_snapshot_rpc_timeout=36000 + +# search config +search.text_analyzer=jieba +search.text_analyzer_mode=INDEX + +# rocksdb backend config +#rocksdb.data_path=/path/to/disk +#rocksdb.wal_path=/path/to/disk + + +# cassandra backend config +cassandra.host=localhost +cassandra.port=9042 +cassandra.username= +cassandra.password= +#cassandra.connect_timeout=5 +#cassandra.read_timeout=20 +#cassandra.keyspace.strategy=SimpleStrategy +#cassandra.keyspace.replication=3 + +# hbase backend config +#hbase.hosts=localhost +#hbase.port=2181 +#hbase.znode_parent=/hbase +#hbase.threads_max=64 +# IMPORTANT: recommend to modify the HBase partition number +# by the actual/env data amount & RS amount before init store +# It will influence the load speed a lot +#hbase.enable_partition=true +#hbase.vertex_partitions=10 +#hbase.edge_partitions=30 + +# mysql backend config +#jdbc.driver=com.mysql.jdbc.Driver +#jdbc.url=jdbc:mysql://127.0.0.1:3306 +#jdbc.username=root +#jdbc.password= +#jdbc.reconnect_max_times=3 +#jdbc.reconnect_interval=3 +#jdbc.ssl_mode=false + +# postgresql & cockroachdb backend config +#jdbc.driver=org.postgresql.Driver +#jdbc.url=jdbc:postgresql://localhost:5432/ +#jdbc.username=postgres +#jdbc.password= +#jdbc.postgresql.connect_database=template1 + +# palo backend config +#palo.host=127.0.0.1 +#palo.poll_interval=10 +#palo.temp_dir=./palo-data +#palo.file_limit_size=32 diff --git a/hugegraph-it/hg-it-dist/src/assembly/static/simple/server/conf/gremlin-driver-settings.yaml b/hugegraph-it/hg-it-dist/src/assembly/static/simple/server/conf/gremlin-driver-settings.yaml new file mode 100644 index 0000000000..55f38ab97d --- /dev/null +++ b/hugegraph-it/hg-it-dist/src/assembly/static/simple/server/conf/gremlin-driver-settings.yaml @@ -0,0 +1,25 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +hosts: [localhost] +port: 8182 +serializer: { + className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV1d0, + config: { + serializeResultToString: false, + ioRegistries: [org.apache.hugegraph.io.HugeGraphIoRegistry] + } +} diff --git a/hugegraph-it/hg-it-dist/src/assembly/static/simple/server/conf/gremlin-server.yaml b/hugegraph-it/hg-it-dist/src/assembly/static/simple/server/conf/gremlin-server.yaml new file mode 100644 index 0000000000..32135163fd --- /dev/null +++ b/hugegraph-it/hg-it-dist/src/assembly/static/simple/server/conf/gremlin-server.yaml @@ -0,0 +1,127 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# host and port of gremlin server, need to be consistent with host and port in rest-server.properties +#host: 127.0.0.1 +#port: 8182 + +# timeout in ms of gremlin query +evaluationTimeout: 30000 + +channelizer: org.apache.tinkerpop.gremlin.server.channel.WsAndHttpChannelizer +# don't set graph at here, this happens after support for dynamically adding graph +graphs: { +} +scriptEngines: { + gremlin-groovy: { + staticImports: [ + org.opencypher.gremlin.process.traversal.CustomPredicates.*', + org.opencypher.gremlin.traversal.CustomFunctions.* + ], + plugins: { + org.apache.hugegraph.plugin.HugeGraphGremlinPlugin: {}, + org.apache.tinkerpop.gremlin.server.jsr223.GremlinServerGremlinPlugin: {}, + org.apache.tinkerpop.gremlin.jsr223.ImportGremlinPlugin: { + classImports: [ + java.lang.Math, + org.apache.hugegraph.backend.id.IdGenerator, + org.apache.hugegraph.type.define.Directions, + org.apache.hugegraph.type.define.NodeRole, + org.apache.hugegraph.masterelection.GlobalMasterInfo, + org.apache.hugegraph.util.DateUtil, + org.apache.hugegraph.traversal.algorithm.CollectionPathsTraverser, + org.apache.hugegraph.traversal.algorithm.CountTraverser, + org.apache.hugegraph.traversal.algorithm.CustomizedCrosspointsTraverser, + org.apache.hugegraph.traversal.algorithm.CustomizePathsTraverser, + org.apache.hugegraph.traversal.algorithm.FusiformSimilarityTraverser, + org.apache.hugegraph.traversal.algorithm.HugeTraverser, + org.apache.hugegraph.traversal.algorithm.JaccardSimilarTraverser, + org.apache.hugegraph.traversal.algorithm.KneighborTraverser, + org.apache.hugegraph.traversal.algorithm.KoutTraverser, + org.apache.hugegraph.traversal.algorithm.MultiNodeShortestPathTraverser, + org.apache.hugegraph.traversal.algorithm.NeighborRankTraverser, + org.apache.hugegraph.traversal.algorithm.PathsTraverser, + org.apache.hugegraph.traversal.algorithm.PersonalRankTraverser, + org.apache.hugegraph.traversal.algorithm.SameNeighborTraverser, + org.apache.hugegraph.traversal.algorithm.ShortestPathTraverser, + org.apache.hugegraph.traversal.algorithm.SingleSourceShortestPathTraverser, + org.apache.hugegraph.traversal.algorithm.SubGraphTraverser, + org.apache.hugegraph.traversal.algorithm.TemplatePathsTraverser, + org.apache.hugegraph.traversal.algorithm.steps.EdgeStep, + org.apache.hugegraph.traversal.algorithm.steps.RepeatEdgeStep, + org.apache.hugegraph.traversal.algorithm.steps.WeightedEdgeStep, + org.apache.hugegraph.traversal.optimize.ConditionP, + org.apache.hugegraph.traversal.optimize.Text, + org.apache.hugegraph.traversal.optimize.TraversalUtil, + org.opencypher.gremlin.traversal.CustomFunctions, + org.opencypher.gremlin.traversal.CustomPredicate + ], + methodImports: [ + java.lang.Math#*, + org.opencypher.gremlin.traversal.CustomPredicate#*, + org.opencypher.gremlin.traversal.CustomFunctions#* + ] + }, + org.apache.tinkerpop.gremlin.jsr223.ScriptFileGremlinPlugin: { + files: [scripts/empty-sample.groovy] + } + } + } +} +serializers: + - {className: org.apache.tinkerpop.gremlin.driver.ser.GraphBinaryMessageSerializerV1, + config: { + serializeResultToString: false, + ioRegistries: [org.apache.hugegraph.io.HugeGraphIoRegistry] + } + } + - {className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV1d0, + config: { + serializeResultToString: false, + ioRegistries: [org.apache.hugegraph.io.HugeGraphIoRegistry] + } + } + - {className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV2d0, + config: { + serializeResultToString: false, + ioRegistries: [org.apache.hugegraph.io.HugeGraphIoRegistry] + } + } + - {className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV3d0, + config: { + serializeResultToString: false, + ioRegistries: [org.apache.hugegraph.io.HugeGraphIoRegistry] + } + } +metrics: { + consoleReporter: {enabled: false, interval: 180000}, + csvReporter: {enabled: false, interval: 180000, fileName: ./metrics/gremlin-server-metrics.csv}, + jmxReporter: {enabled: false}, + slf4jReporter: {enabled: false, interval: 180000}, + gangliaReporter: {enabled: false, interval: 180000, addressingMode: MULTICAST}, + graphiteReporter: {enabled: false, interval: 180000} +} +maxInitialLineLength: 4096 +maxHeaderSize: 8192 +maxChunkSize: 8192 +maxContentLength: 65536 +maxAccumulationBufferComponents: 1024 +resultIterationBatchSize: 64 +writeBufferLowWaterMark: 32768 +writeBufferHighWaterMark: 65536 +ssl: { + enabled: false +} diff --git a/hugegraph-it/hg-it-dist/src/assembly/static/simple/server/conf/log4j2.xml b/hugegraph-it/hg-it-dist/src/assembly/static/simple/server/conf/log4j2.xml new file mode 100644 index 0000000000..f1dd7e8395 --- /dev/null +++ b/hugegraph-it/hg-it-dist/src/assembly/static/simple/server/conf/log4j2.xml @@ -0,0 +1,144 @@ + + + + + + logs + hugegraph-server + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/hugegraph-it/hg-it-dist/src/assembly/static/simple/server/conf/remote-objects.yaml b/hugegraph-it/hg-it-dist/src/assembly/static/simple/server/conf/remote-objects.yaml new file mode 100644 index 0000000000..39679d8c30 --- /dev/null +++ b/hugegraph-it/hg-it-dist/src/assembly/static/simple/server/conf/remote-objects.yaml @@ -0,0 +1,30 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +hosts: [localhost] +port: 8182 +serializer: { + className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV1d0, + config: { + serializeResultToString: false, + # The duplication of HugeGraphIoRegistry is meant to fix a bug in the + # 'org.apache.tinkerpop.gremlin.driver.Settings:from(Configuration)' method. + ioRegistries: [ + org.apache.hugegraph.io.HugeGraphIoRegistry, + org.apache.hugegraph.io.HugeGraphIoRegistry + ] + } +} diff --git a/hugegraph-it/hg-it-dist/src/assembly/static/simple/server/conf/remote.yaml b/hugegraph-it/hg-it-dist/src/assembly/static/simple/server/conf/remote.yaml new file mode 100644 index 0000000000..55f38ab97d --- /dev/null +++ b/hugegraph-it/hg-it-dist/src/assembly/static/simple/server/conf/remote.yaml @@ -0,0 +1,25 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +hosts: [localhost] +port: 8182 +serializer: { + className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV1d0, + config: { + serializeResultToString: false, + ioRegistries: [org.apache.hugegraph.io.HugeGraphIoRegistry] + } +} diff --git a/hugegraph-it/hg-it-dist/src/assembly/static/simple/server/conf/rest-server.properties b/hugegraph-it/hg-it-dist/src/assembly/static/simple/server/conf/rest-server.properties new file mode 100644 index 0000000000..d28e6cf406 --- /dev/null +++ b/hugegraph-it/hg-it-dist/src/assembly/static/simple/server/conf/rest-server.properties @@ -0,0 +1,71 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# bind url +# could use '0.0.0.0' or specified (real)IP to expose external network access +restserver.url=http://127.0.0.1:8080 +# gremlin server url, need to be consistent with host and port in gremlin-server.yaml +#gremlinserver.url=http://127.0.0.1:8182 + +graphs=./conf/graphs + +# The maximum thread ratio for batch writing, only take effect if the batch.max_write_threads is 0 +batch.max_write_ratio=80 +batch.max_write_threads=0 + +# configuration of arthas +arthas.telnet_port=8562 +arthas.http_port=8561 +arthas.ip=127.0.0.1 +arthas.disabled_commands=jad + +# authentication configs +# choose 'org.apache.hugegraph.auth.StandardAuthenticator' or +# 'org.apache.hugegraph.auth.ConfigAuthenticator' +#auth.authenticator= + +# for StandardAuthenticator mode +#auth.graph_store=hugegraph +# auth client config +#auth.remote_url=127.0.0.1:8899,127.0.0.1:8898,127.0.0.1:8897 + +# for ConfigAuthenticator mode +#auth.admin_token= +#auth.user_tokens=[] + +# rpc server configs for multi graph-servers or raft-servers +rpc.server_host=127.0.0.1 +rpc.server_port=8091 +#rpc.server_timeout=30 + +# rpc client configs (like enable to keep cache consistency) +#rpc.remote_url=127.0.0.1:8091,127.0.0.1:8092,127.0.0.1:8093 +#rpc.client_connect_timeout=20 +#rpc.client_reconnect_period=10 +#rpc.client_read_timeout=40 +#rpc.client_retries=3 +#rpc.client_load_balancer=consistentHash + +# raft group initial peers +#raft.group_peers=127.0.0.1:8091,127.0.0.1:8092,127.0.0.1:8093 + +# lightweight load balancing (beta) +server.id=server-1 +server.role=master + +# slow query log +log.slow_query_threshold=1000 diff --git a/hugegraph-it/hg-it-dist/src/assembly/static/simple/store/conf/application-pd.yml b/hugegraph-it/hg-it-dist/src/assembly/static/simple/store/conf/application-pd.yml new file mode 100644 index 0000000000..df535953fc --- /dev/null +++ b/hugegraph-it/hg-it-dist/src/assembly/static/simple/store/conf/application-pd.yml @@ -0,0 +1,34 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +management: + metrics: + export: + prometheus: + enabled: true + endpoints: + web: + exposure: + include: "*" + +rocksdb: + # rocksdb 使用的总内存大小,达到该值强制写盘 + total_memory_size: 32000000000 + # rocksdb 使用的 memtable 大小 + write_buffer_size: 32000000 + # 对于每个 rocksdb 来说,memtable 个数达到该值进行写盘 + min_write_buffer_number_to_merge: 16 diff --git a/hugegraph-it/hg-it-dist/src/assembly/static/simple/store/conf/application.yml b/hugegraph-it/hg-it-dist/src/assembly/static/simple/store/conf/application.yml new file mode 100644 index 0000000000..4ca3d34dd6 --- /dev/null +++ b/hugegraph-it/hg-it-dist/src/assembly/static/simple/store/conf/application.yml @@ -0,0 +1,64 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +pdserver: + # pd 服务地址,多个 pd 地址用逗号分割 + address: localhost:8686 + +management: + metrics: + export: + prometheus: + enabled: true + endpoints: + web: + exposure: + include: "*" + +grpc: + # grpc 的服务地址 + host: 127.0.0.1 + port: 8500 + netty-server: + max-inbound-message-size: 1000MB +raft: + # raft 缓存队列大小 + disruptorBufferSize: 1024 + address: 127.0.0.1:8510 + max-log-file-size: 600000000000 + # 快照生成时间间隔,单位秒 + snapshotInterval: 1800 +server: + # rest 服务地址 + port: 8520 + +app: + # 存储路径,支持多个路径,逗号分割 + data-path: ./storage + #raft-path: ./storage + +spring: + application: + name: store-node-grpc-server + profiles: + active: default + include: pd + +logging: + config: 'file:./conf/log4j2.xml' + level: + root: info diff --git a/hugegraph-it/hg-it-dist/src/assembly/static/simple/store/conf/log4j2.xml b/hugegraph-it/hg-it-dist/src/assembly/static/simple/store/conf/log4j2.xml new file mode 100644 index 0000000000..388d09e2fd --- /dev/null +++ b/hugegraph-it/hg-it-dist/src/assembly/static/simple/store/conf/log4j2.xml @@ -0,0 +1,137 @@ + + + + + + + + logs + hugegraph-store + raft-hugegraph-store + audit-hugegraph-store + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/hugegraph-it/hg-it-minicluster/pom.xml b/hugegraph-it/hg-it-minicluster/pom.xml index 075e1763d9..5542f1a92f 100644 --- a/hugegraph-it/hg-it-minicluster/pom.xml +++ b/hugegraph-it/hg-it-minicluster/pom.xml @@ -56,9 +56,9 @@ compile - org.apache.hugegraph - hg-pd-core - ${revision} + org.projectlombok + lombok + 1.18.24 compile diff --git a/hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/base/ClusterConstant.java b/hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/base/ClusterConstant.java index 2df894806e..744c73e053 100644 --- a/hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/base/ClusterConstant.java +++ b/hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/base/ClusterConstant.java @@ -64,7 +64,7 @@ public class ClusterConstant { + "dist" + File.separator; - public static final String PD_WORK_PATH = + public static final String PD_LIB_PATH = getFileInDir(PD_DIST_PATH, PD_PACKAGE_PREFIX) + File.separator + LIB_DIR @@ -78,7 +78,7 @@ public class ClusterConstant { + "dist" + File.separator; - public static final String STORE_WORK_PATH = + public static final String STORE_LIB_PATH = getFileInDir(STORE_DIST_PATH, STORE_PACKAGE_PREFIX) + File.separator + "lib" @@ -90,7 +90,7 @@ public class ClusterConstant { + "hugegraph-server" + File.separator; - public static final String SERVER_WORK_PATH = + public static final String SERVER_LIB_PATH = getFileInDir(SERVER_DIST_PATH, SERVER_PACKAGE_PREFIX) + File.separator; @@ -100,36 +100,114 @@ public class ClusterConstant { + "hugegraph-it" + File.separator; - public static final String IT_CONFIG_PATH = + public static final String IT_PACKAGE_PATH = getFileInDir(IT_DIST_PATH, IT_PACKAGE_PREFIX) - + File.separator - + CONF_DIR + File.separator; public static final String SIMPLE_PD_CONFIG_PATH = - IT_CONFIG_PATH + IT_PACKAGE_PATH + SIMPLE + File.separator + "pd" + File.separator; public static final String SIMPLE_STORE_CONFIG_PATH = - IT_CONFIG_PATH + IT_PACKAGE_PATH + SIMPLE + File.separator + "store" + File.separator; public static final String SIMPLE_SERVER_CONFIG_PATH = - IT_CONFIG_PATH + IT_PACKAGE_PATH + SIMPLE + File.separator + "server" + File.separator; - public static final String IT_LOG_PATH = - getFileInDir(IT_DIST_PATH, IT_PACKAGE_PREFIX) + public static final String MULTI_PD_A_CONFIG_PATH = + IT_PACKAGE_PATH + + MULTI + + File.separator + + "pd" + + File.separator + + "A" + + File.separator; + + public static final String MULTI_PD_B_CONFIG_PATH = + IT_PACKAGE_PATH + + MULTI + + File.separator + + "pd" + + File.separator + + "B" + + File.separator; + + public static final String MULTI_PD_C_CONFIG_PATH = + IT_PACKAGE_PATH + + MULTI + + File.separator + + "pd" + + File.separator + + "C" + + File.separator; + + public static final String MULTI_STORE_A_CONFIG_PATH = + IT_PACKAGE_PATH + + MULTI + + File.separator + + "store" + + File.separator + + "A" + + File.separator; + + public static final String MULTI_STORE_B_CONFIG_PATH = + IT_PACKAGE_PATH + + MULTI + + File.separator + + "store" + + File.separator + + "B" + + File.separator; + + public static final String MULTI_STORE_C_CONFIG_PATH = + IT_PACKAGE_PATH + + MULTI + + File.separator + + "store" + + File.separator + + "C" + + File.separator; + + public static final String MULTI_SERVER_A_CONFIG_PATH = + IT_PACKAGE_PATH + + MULTI + + File.separator + + "server" + + File.separator + + "A" + + File.separator; + + public static final String MULTI_SERVER_B_CONFIG_PATH = + IT_PACKAGE_PATH + + MULTI + + File.separator + + "server" + + File.separator + + "B" + + File.separator; + + public static final String MULTI_SERVER_C_CONFIG_PATH = + IT_PACKAGE_PATH + + MULTI + File.separator + + "server" + + File.separator + + "C" + + File.separator; + + public static final String IT_LOG_PATH = + IT_PACKAGE_PATH + LOG + File.separator; @@ -148,4 +226,18 @@ public static String getFileInDir(String path, String fileName) { } return ""; } + + public static boolean isJava11OrHigher() { + String version = System.getProperty("java.version"); + if (version.startsWith("1.")) { + version = version.substring(2, 3); + } else { + int dot = version.indexOf("."); + if (dot != -1) { + version = version.substring(0, dot); + } + } + int versionNumber = Integer.parseInt(version); + return versionNumber >= 11; + } } diff --git a/hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/env/SimpleEnv.java b/hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/env/SimpleEnv.java index d33724931b..cd59a0e303 100644 --- a/hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/env/SimpleEnv.java +++ b/hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/env/SimpleEnv.java @@ -17,12 +17,12 @@ package org.apache.hugegraph.it.env; -import static org.apache.hugegraph.it.base.ClusterConstant.PD_WORK_PATH; -import static org.apache.hugegraph.it.base.ClusterConstant.SERVER_WORK_PATH; +import static org.apache.hugegraph.it.base.ClusterConstant.PD_LIB_PATH; +import static org.apache.hugegraph.it.base.ClusterConstant.SERVER_LIB_PATH; import static org.apache.hugegraph.it.base.ClusterConstant.SIMPLE_PD_CONFIG_PATH; import static org.apache.hugegraph.it.base.ClusterConstant.SIMPLE_SERVER_CONFIG_PATH; import static org.apache.hugegraph.it.base.ClusterConstant.SIMPLE_STORE_CONFIG_PATH; -import static org.apache.hugegraph.it.base.ClusterConstant.STORE_WORK_PATH; +import static org.apache.hugegraph.it.base.ClusterConstant.STORE_LIB_PATH; import org.apache.hugegraph.it.node.PDNodeWrapper; import org.apache.hugegraph.it.node.ServerNodeWrapper; @@ -35,15 +35,15 @@ public SimpleEnv() { StoreNodeWrapper storeNodeWrapper = new StoreNodeWrapper(1, 1); ServerNodeWrapper serverNodeWrapper = new ServerNodeWrapper(1, 1); - pdNodeWrapper.updateWorkPath(PD_WORK_PATH); + pdNodeWrapper.updateWorkPath(PD_LIB_PATH); pdNodeWrapper.updateConfigPath(SIMPLE_PD_CONFIG_PATH); super.addPDNode(pdNodeWrapper); - storeNodeWrapper.updateWorkPath(STORE_WORK_PATH); + storeNodeWrapper.updateWorkPath(STORE_LIB_PATH); storeNodeWrapper.updateConfigPath(SIMPLE_STORE_CONFIG_PATH); super.addStoreNode(storeNodeWrapper); - serverNodeWrapper.updateWorkPath(SERVER_WORK_PATH); + serverNodeWrapper.updateWorkPath(SERVER_LIB_PATH); serverNodeWrapper.updateConfigPath(SIMPLE_SERVER_CONFIG_PATH); super.addServerNode(serverNodeWrapper); } diff --git a/hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/node/AbstractNodeWrapper.java b/hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/node/AbstractNodeWrapper.java index 127d610dab..7176cb58b6 100644 --- a/hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/node/AbstractNodeWrapper.java +++ b/hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/node/AbstractNodeWrapper.java @@ -145,20 +145,6 @@ public String getLogPath() { return IT_LOG_PATH + getID() + "-start.log"; } - protected boolean isJava11OrHigher() { - String version = System.getProperty("java.version"); - if (version.startsWith("1.")) { - version = version.substring(2, 3); - } else { - int dot = version.indexOf("."); - if (dot != -1) { - version = version.substring(0, dot); - } - } - int versionNumber = Integer.parseInt(version); - return versionNumber >= 11; - } - public void updateWorkPath(String workPath) { this.workPath = workPath; } diff --git a/hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/node/PDNodeWrapper.java b/hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/node/PDNodeWrapper.java index 70502ee96b..72b1159696 100644 --- a/hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/node/PDNodeWrapper.java +++ b/hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/node/PDNodeWrapper.java @@ -17,9 +17,11 @@ package org.apache.hugegraph.it.node; +import static org.apache.hugegraph.it.base.ClusterConstant.CONF_DIR; import static org.apache.hugegraph.it.base.ClusterConstant.JAVA_CMD; import static org.apache.hugegraph.it.base.ClusterConstant.PD_JAR_PREFIX; import static org.apache.hugegraph.it.base.ClusterConstant.getFileInDir; +import static org.apache.hugegraph.it.base.ClusterConstant.isJava11OrHigher; import java.io.File; import java.io.IOException; @@ -29,65 +31,16 @@ import java.util.List; import org.apache.commons.io.FileUtils; -import org.apache.hugegraph.pd.config.PDConfig; public class PDNodeWrapper extends AbstractNodeWrapper { - private PDConfig pdConfig; - - public PDNodeWrapper() { - pdConfig = new PDConfig(); - } - public PDNodeWrapper(String host, int grpcPort, int clusterIndex, int cnt) { super(host, grpcPort, clusterIndex, cnt); } - @Override - public void createNodeDir() { - super.createNodeDir(); - } - - @Override - public void createLogDir() { - super.createLogDir(); - } - - @Override - public void deleteDir() { - super.deleteDir(); - } - - public void updatePDConfig(PDConfig pdConfig) { - this.pdConfig = pdConfig; - } - - public void updateServerPost(int serverPort) { - this.pdConfig.getRaft().setPort(serverPort); - } - - public void updateDataPath(String dataPath) { - this.pdConfig.setDataPath(dataPath); - } - - public void updatePatrolInterval(int patrolInterval) { - this.pdConfig.setPatrolInterval(patrolInterval); - } - - public void updateInitialStoreList(String storeList) { - this.pdConfig.setInitialStoreList(storeList); - } - - public void updateInitialStoreCount(int minStoreCount) { - this.pdConfig.setMinStoreCount(minStoreCount); - } - - public void updateRaftAddress(String raftAdd) { - this.pdConfig.getRaft().setAddress(raftAdd); - } - - public void updatePeersList(String peersList) { - this.pdConfig.getRaft().setPeersList(peersList); + public PDNodeWrapper(int clusterId, int cnt) { + this.clusterIndex = clusterId; + this.cnt = cnt; } /* @@ -111,8 +64,10 @@ public void start() { "-Xmx4g", "-XX:+HeapDumpOnOutOfMemoryError", "-XX:HeapDumpPath=" + configPath + "logs", - "-Dlog4j.configurationFile=" + configPath + "log4j2.xml", - "-Dspring.config.location=" + configPath + "application.yml", + "-Dlog4j.configurationFile=" + configPath + CONF_DIR + File.separator + + "log4j2.xml", + "-Dspring.config.location=" + configPath + CONF_DIR + File.separator + + "application.yml", "-jar", pdNodeJarPath)); FileUtils.write( stdoutFile, String.join(" ", startCmd) + "\n\n", StandardCharsets.UTF_8, true); @@ -127,16 +82,6 @@ public void start() { } } - @Override - public void stop() { - super.stop(); - } - - @Override - public boolean isAlive() { - return super.isAlive(); - } - @Override public String getID() { return "PD" + this.cnt; diff --git a/hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/node/ServerNodeWrapper.java b/hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/node/ServerNodeWrapper.java index b2cd20f88a..4094c48253 100644 --- a/hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/node/ServerNodeWrapper.java +++ b/hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/node/ServerNodeWrapper.java @@ -21,6 +21,7 @@ import static org.apache.hugegraph.it.base.ClusterConstant.JAVA_CMD; import static org.apache.hugegraph.it.base.ClusterConstant.LIB_DIR; import static org.apache.hugegraph.it.base.ClusterConstant.PLUGINS_DIR; +import static org.apache.hugegraph.it.base.ClusterConstant.isJava11OrHigher; import java.io.File; import java.io.IOException; @@ -49,21 +50,6 @@ private static void addJarsToClasspath(File directory, List classpath) { } } - @Override - public void createNodeDir() { - super.createNodeDir(); - } - - @Override - public void createLogDir() { - super.createLogDir(); - } - - @Override - public void deleteDir() { - super.deleteDir(); - } - @Override public void start() { try { @@ -87,8 +73,8 @@ public void start() { "--add-exports=java.base/jdk.internal.reflect=ALL-UNNAMED", "-cp", storeClassPath, "org.apache.hugegraph.dist.HugeGraphServer", - "./gremlin-server.yaml", - "./rest-server.properties")); + "./conf/gremlin-server.yaml", + "./conf/rest-server.properties")); FileUtils.write( stdoutFile, String.join(" ", startCmd) + "\n\n", StandardCharsets.UTF_8, true); ProcessBuilder processBuilder = @@ -102,16 +88,6 @@ public void start() { } } - @Override - public void stop() { - super.stop(); - } - - @Override - public boolean isAlive() { - return super.isAlive(); - } - @Override public String getID() { return "Server" + this.cnt; diff --git a/hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/node/StoreNodeWrapper.java b/hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/node/StoreNodeWrapper.java index 0106645d26..487d7a55e9 100644 --- a/hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/node/StoreNodeWrapper.java +++ b/hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/node/StoreNodeWrapper.java @@ -17,9 +17,11 @@ package org.apache.hugegraph.it.node; +import static org.apache.hugegraph.it.base.ClusterConstant.CONF_DIR; import static org.apache.hugegraph.it.base.ClusterConstant.JAVA_CMD; import static org.apache.hugegraph.it.base.ClusterConstant.STORE_JAR_PREFIX; import static org.apache.hugegraph.it.base.ClusterConstant.getFileInDir; +import static org.apache.hugegraph.it.base.ClusterConstant.isJava11OrHigher; import java.io.File; import java.io.IOException; @@ -41,21 +43,6 @@ public StoreNodeWrapper(int clusterId, int cnt) { this.cnt = cnt; } - @Override - public void createNodeDir() { - super.createNodeDir(); - } - - @Override - public void createLogDir() { - super.createLogDir(); - } - - @Override - public void deleteDir() { - super.deleteDir(); - } - @Override public void start() { try { @@ -70,8 +57,8 @@ public void start() { startCmd.addAll( Arrays.asList( "-Dname=HugeGraphStore" + this.cnt, - "-Dlog4j.configurationFile=" + configPath + - "log4j2.xml", + "-Dlog4j.configurationFile=" + configPath + CONF_DIR + + File.separator + "log4j2.xml", "-Dfastjson.parser.safeMode=true", "-Xms512m", "-Xmx2048m", @@ -80,9 +67,8 @@ public void start() { "-XX:+ParallelRefProcEnabled", "-XX:+HeapDumpOnOutOfMemoryError", "-XX:HeapDumpPath=" + configPath + "logs", - //"-Xlog:gc=info:file=./logs/gc.log:tags,uptime,level:filecount=3," + - //"filesize=100m", - "-Dspring.config.location=" + configPath + "application.yml", + "-Dspring.config.location=" + configPath + CONF_DIR + + File.separator + "application.yml", "-jar", storeNodeJarPath)); FileUtils.write( stdoutFile, String.join(" ", startCmd) + "\n\n", StandardCharsets.UTF_8, true); @@ -97,16 +83,6 @@ public void start() { } } - @Override - public void stop() { - super.stop(); - } - - @Override - public boolean isAlive() { - return super.isAlive(); - } - @Override public String getID() { return "Store" + this.clusterIndex; diff --git a/hugegraph-it/hg-it-test/pom.xml b/hugegraph-it/hg-it-test/pom.xml index bb6d30015e..35486a9f80 100644 --- a/hugegraph-it/hg-it-test/pom.xml +++ b/hugegraph-it/hg-it-test/pom.xml @@ -23,7 +23,7 @@ org.apache.hugegraph hugegraph-it - 1.5.0 + ${revision} hg-it-test @@ -42,4 +42,4 @@ - \ No newline at end of file + From 530f3ea0674a81184ffb78ed9ea47f51ffc432a0 Mon Sep 17 00:00:00 2001 From: 145425491 <1245294786@qq.com> Date: Fri, 16 Aug 2024 18:37:42 +0800 Subject: [PATCH 10/40] feat(it): amend the implement of reading configuration files --- .../hg-ct-dist}/pom.xml | 10 +- .../src/assembly/descriptor/assembly.xml | 0 .../hg-ct-minicluster}/pom.xml | 15 +- .../hugegraph/ct}/base/ClusterConstant.java | 157 ++++-------------- .../apache/hugegraph/ct}/base/EnvType.java | 2 +- .../hugegraph/ct}/base/HGTestLogger.java | 2 +- .../hugegraph/ct/config/ClusterConf.java | 78 +++++++++ .../apache/hugegraph/ct}/env/AbstractEnv.java | 66 ++++++-- .../org/apache/hugegraph/ct}/env/BaseEnv.java | 8 +- .../apache/hugegraph/ct/env/SimpleEnv.java | 12 +- .../ct}/node/AbstractNodeWrapper.java | 90 +++++----- .../hugegraph/ct}/node/BaseNodeWrapper.java | 2 +- .../hugegraph/ct}/node/PDNodeWrapper.java | 54 +++--- .../hugegraph/ct}/node/ServerNodeWrapper.java | 31 ++-- .../hugegraph/ct}/node/StoreNodeWrapper.java | 36 ++-- .../hg-ct-test}/pom.xml | 6 +- .../pom.xml | 10 +- .../static/multi/pd/A/conf/application.yml | 79 --------- .../multi/pd/A/conf/application.yml.template | 71 -------- .../static/multi/pd/A/conf/hugegraph.license | Bin 1499 -> 0 bytes .../static/multi/pd/A/conf/log4j2.xml | 135 --------------- .../multi/pd/A/conf/verify-license.json | 6 - .../static/multi/pd/B/conf/application.yml | 79 --------- .../multi/pd/B/conf/application.yml.template | 71 -------- .../static/multi/pd/B/conf/hugegraph.license | Bin 1499 -> 0 bytes .../static/multi/pd/B/conf/log4j2.xml | 135 --------------- .../multi/pd/B/conf/verify-license.json | 6 - .../static/multi/pd/C/conf/application.yml | 79 --------- .../multi/pd/C/conf/application.yml.template | 71 -------- .../static/multi/pd/C/conf/hugegraph.license | Bin 1499 -> 0 bytes .../static/multi/pd/C/conf/log4j2.xml | 135 --------------- .../multi/pd/C/conf/verify-license.json | 6 - .../static/multi/server/A/conf/computer.yaml | 39 ----- .../server/A/conf/graphs/hugegraph.properties | 126 -------------- .../A/conf/gremlin-driver-settings.yaml | 25 --- .../multi/server/A/conf/gremlin-server.yaml | 127 -------------- .../server/A/conf/hugegraph-server.keystore | Bin 1733 -> 0 bytes .../static/multi/server/A/conf/log4j2.xml | 144 ---------------- .../multi/server/A/conf/remote-objects.yaml | 30 ---- .../static/multi/server/A/conf/remote.yaml | 25 --- .../server/A/conf/rest-server.properties | 70 -------- .../static/multi/server/B/conf/computer.yaml | 39 ----- .../server/B/conf/graphs/hugegraph.properties | 126 -------------- .../B/conf/gremlin-driver-settings.yaml | 25 --- .../multi/server/B/conf/gremlin-server.yaml | 127 -------------- .../server/B/conf/hugegraph-server.keystore | Bin 1733 -> 0 bytes .../static/multi/server/B/conf/log4j2.xml | 144 ---------------- .../multi/server/B/conf/remote-objects.yaml | 30 ---- .../static/multi/server/B/conf/remote.yaml | 25 --- .../server/B/conf/rest-server.properties | 70 -------- .../static/multi/server/C/conf/computer.yaml | 39 ----- .../server/C/conf/graphs/hugegraph.properties | 126 -------------- .../C/conf/gremlin-driver-settings.yaml | 25 --- .../multi/server/C/conf/gremlin-server.yaml | 127 -------------- .../server/C/conf/hugegraph-server.keystore | Bin 1733 -> 0 bytes .../static/multi/server/C/conf/log4j2.xml | 144 ---------------- .../multi/server/C/conf/remote-objects.yaml | 30 ---- .../static/multi/server/C/conf/remote.yaml | 25 --- .../server/C/conf/rest-server.properties | 70 -------- .../multi/store/A/conf/application-pd.yml | 34 ---- .../static/multi/store/A/conf/application.yml | 64 ------- .../static/multi/store/A/conf/log4j2.xml | 137 --------------- .../multi/store/B/conf/application-pd.yml | 34 ---- .../static/multi/store/B/conf/application.yml | 64 ------- .../static/multi/store/B/conf/log4j2.xml | 137 --------------- .../multi/store/C/conf/application-pd.yml | 34 ---- .../static/multi/store/C/conf/application.yml | 64 ------- .../static/multi/store/C/conf/log4j2.xml | 137 --------------- .../static/simple/pd/conf/application.yml | 79 --------- .../simple/pd/conf/application.yml.template | 72 -------- .../assembly/static/simple/pd/conf/log4j2.xml | 135 --------------- .../static/simple/pd/conf/verify-license.json | 6 - .../static/simple/server/conf/computer.yaml | 39 ----- .../server/conf/graphs/hugegraph.properties | 109 ------------ .../server/conf/gremlin-driver-settings.yaml | 25 --- .../simple/server/conf/gremlin-server.yaml | 127 -------------- .../static/simple/server/conf/log4j2.xml | 144 ---------------- .../simple/server/conf/remote-objects.yaml | 30 ---- .../static/simple/server/conf/remote.yaml | 25 --- .../simple/server/conf/rest-server.properties | 71 -------- .../simple/store/conf/application-pd.yml | 34 ---- .../static/simple/store/conf/application.yml | 64 ------- .../static/simple/store/conf/log4j2.xml | 137 --------------- .../hugegraph/it/config/ClusterConfImpl.java | 22 --- .../apache/hugegraph/it/env/SimpleEnv.java | 51 ------ pom.xml | 2 +- 86 files changed, 302 insertions(+), 4785 deletions(-) rename {hugegraph-it/hg-it-dist => hugegraph-cluster-test/hg-ct-dist}/pom.xml (91%) rename {hugegraph-it/hg-it-dist => hugegraph-cluster-test/hg-ct-dist}/src/assembly/descriptor/assembly.xml (100%) rename {hugegraph-it/hg-it-minicluster => hugegraph-cluster-test/hg-ct-minicluster}/pom.xml (83%) rename {hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it => hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct}/base/ClusterConstant.java (50%) rename {hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it => hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct}/base/EnvType.java (96%) rename {hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it => hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct}/base/HGTestLogger.java (96%) create mode 100644 hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/config/ClusterConf.java rename {hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it => hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct}/env/AbstractEnv.java (50%) rename {hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it => hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct}/env/BaseEnv.java (88%) rename hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/config/ClusterConf.java => hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/env/SimpleEnv.java (79%) rename {hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it => hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct}/node/AbstractNodeWrapper.java (61%) rename {hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it => hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct}/node/BaseNodeWrapper.java (96%) rename {hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it => hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct}/node/PDNodeWrapper.java (62%) rename {hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it => hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct}/node/ServerNodeWrapper.java (72%) rename {hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it => hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct}/node/StoreNodeWrapper.java (67%) rename {hugegraph-it/hg-it-test => hugegraph-cluster-test/hg-ct-test}/pom.xml (91%) rename {hugegraph-it => hugegraph-cluster-test}/pom.xml (89%) delete mode 100644 hugegraph-it/hg-it-dist/src/assembly/static/multi/pd/A/conf/application.yml delete mode 100644 hugegraph-it/hg-it-dist/src/assembly/static/multi/pd/A/conf/application.yml.template delete mode 100644 hugegraph-it/hg-it-dist/src/assembly/static/multi/pd/A/conf/hugegraph.license delete mode 100644 hugegraph-it/hg-it-dist/src/assembly/static/multi/pd/A/conf/log4j2.xml delete mode 100644 hugegraph-it/hg-it-dist/src/assembly/static/multi/pd/A/conf/verify-license.json delete mode 100644 hugegraph-it/hg-it-dist/src/assembly/static/multi/pd/B/conf/application.yml delete mode 100644 hugegraph-it/hg-it-dist/src/assembly/static/multi/pd/B/conf/application.yml.template delete mode 100644 hugegraph-it/hg-it-dist/src/assembly/static/multi/pd/B/conf/hugegraph.license delete mode 100644 hugegraph-it/hg-it-dist/src/assembly/static/multi/pd/B/conf/log4j2.xml delete mode 100644 hugegraph-it/hg-it-dist/src/assembly/static/multi/pd/B/conf/verify-license.json delete mode 100644 hugegraph-it/hg-it-dist/src/assembly/static/multi/pd/C/conf/application.yml delete mode 100644 hugegraph-it/hg-it-dist/src/assembly/static/multi/pd/C/conf/application.yml.template delete mode 100644 hugegraph-it/hg-it-dist/src/assembly/static/multi/pd/C/conf/hugegraph.license delete mode 100644 hugegraph-it/hg-it-dist/src/assembly/static/multi/pd/C/conf/log4j2.xml delete mode 100644 hugegraph-it/hg-it-dist/src/assembly/static/multi/pd/C/conf/verify-license.json delete mode 100644 hugegraph-it/hg-it-dist/src/assembly/static/multi/server/A/conf/computer.yaml delete mode 100644 hugegraph-it/hg-it-dist/src/assembly/static/multi/server/A/conf/graphs/hugegraph.properties delete mode 100644 hugegraph-it/hg-it-dist/src/assembly/static/multi/server/A/conf/gremlin-driver-settings.yaml delete mode 100644 hugegraph-it/hg-it-dist/src/assembly/static/multi/server/A/conf/gremlin-server.yaml delete mode 100644 hugegraph-it/hg-it-dist/src/assembly/static/multi/server/A/conf/hugegraph-server.keystore delete mode 100644 hugegraph-it/hg-it-dist/src/assembly/static/multi/server/A/conf/log4j2.xml delete mode 100644 hugegraph-it/hg-it-dist/src/assembly/static/multi/server/A/conf/remote-objects.yaml delete mode 100644 hugegraph-it/hg-it-dist/src/assembly/static/multi/server/A/conf/remote.yaml delete mode 100644 hugegraph-it/hg-it-dist/src/assembly/static/multi/server/A/conf/rest-server.properties delete mode 100644 hugegraph-it/hg-it-dist/src/assembly/static/multi/server/B/conf/computer.yaml delete mode 100644 hugegraph-it/hg-it-dist/src/assembly/static/multi/server/B/conf/graphs/hugegraph.properties delete mode 100644 hugegraph-it/hg-it-dist/src/assembly/static/multi/server/B/conf/gremlin-driver-settings.yaml delete mode 100644 hugegraph-it/hg-it-dist/src/assembly/static/multi/server/B/conf/gremlin-server.yaml delete mode 100644 hugegraph-it/hg-it-dist/src/assembly/static/multi/server/B/conf/hugegraph-server.keystore delete mode 100644 hugegraph-it/hg-it-dist/src/assembly/static/multi/server/B/conf/log4j2.xml delete mode 100644 hugegraph-it/hg-it-dist/src/assembly/static/multi/server/B/conf/remote-objects.yaml delete mode 100644 hugegraph-it/hg-it-dist/src/assembly/static/multi/server/B/conf/remote.yaml delete mode 100644 hugegraph-it/hg-it-dist/src/assembly/static/multi/server/B/conf/rest-server.properties delete mode 100644 hugegraph-it/hg-it-dist/src/assembly/static/multi/server/C/conf/computer.yaml delete mode 100644 hugegraph-it/hg-it-dist/src/assembly/static/multi/server/C/conf/graphs/hugegraph.properties delete mode 100644 hugegraph-it/hg-it-dist/src/assembly/static/multi/server/C/conf/gremlin-driver-settings.yaml delete mode 100644 hugegraph-it/hg-it-dist/src/assembly/static/multi/server/C/conf/gremlin-server.yaml delete mode 100644 hugegraph-it/hg-it-dist/src/assembly/static/multi/server/C/conf/hugegraph-server.keystore delete mode 100644 hugegraph-it/hg-it-dist/src/assembly/static/multi/server/C/conf/log4j2.xml delete mode 100644 hugegraph-it/hg-it-dist/src/assembly/static/multi/server/C/conf/remote-objects.yaml delete mode 100644 hugegraph-it/hg-it-dist/src/assembly/static/multi/server/C/conf/remote.yaml delete mode 100644 hugegraph-it/hg-it-dist/src/assembly/static/multi/server/C/conf/rest-server.properties delete mode 100644 hugegraph-it/hg-it-dist/src/assembly/static/multi/store/A/conf/application-pd.yml delete mode 100644 hugegraph-it/hg-it-dist/src/assembly/static/multi/store/A/conf/application.yml delete mode 100644 hugegraph-it/hg-it-dist/src/assembly/static/multi/store/A/conf/log4j2.xml delete mode 100644 hugegraph-it/hg-it-dist/src/assembly/static/multi/store/B/conf/application-pd.yml delete mode 100644 hugegraph-it/hg-it-dist/src/assembly/static/multi/store/B/conf/application.yml delete mode 100644 hugegraph-it/hg-it-dist/src/assembly/static/multi/store/B/conf/log4j2.xml delete mode 100644 hugegraph-it/hg-it-dist/src/assembly/static/multi/store/C/conf/application-pd.yml delete mode 100644 hugegraph-it/hg-it-dist/src/assembly/static/multi/store/C/conf/application.yml delete mode 100644 hugegraph-it/hg-it-dist/src/assembly/static/multi/store/C/conf/log4j2.xml delete mode 100644 hugegraph-it/hg-it-dist/src/assembly/static/simple/pd/conf/application.yml delete mode 100644 hugegraph-it/hg-it-dist/src/assembly/static/simple/pd/conf/application.yml.template delete mode 100644 hugegraph-it/hg-it-dist/src/assembly/static/simple/pd/conf/log4j2.xml delete mode 100644 hugegraph-it/hg-it-dist/src/assembly/static/simple/pd/conf/verify-license.json delete mode 100644 hugegraph-it/hg-it-dist/src/assembly/static/simple/server/conf/computer.yaml delete mode 100644 hugegraph-it/hg-it-dist/src/assembly/static/simple/server/conf/graphs/hugegraph.properties delete mode 100644 hugegraph-it/hg-it-dist/src/assembly/static/simple/server/conf/gremlin-driver-settings.yaml delete mode 100644 hugegraph-it/hg-it-dist/src/assembly/static/simple/server/conf/gremlin-server.yaml delete mode 100644 hugegraph-it/hg-it-dist/src/assembly/static/simple/server/conf/log4j2.xml delete mode 100644 hugegraph-it/hg-it-dist/src/assembly/static/simple/server/conf/remote-objects.yaml delete mode 100644 hugegraph-it/hg-it-dist/src/assembly/static/simple/server/conf/remote.yaml delete mode 100644 hugegraph-it/hg-it-dist/src/assembly/static/simple/server/conf/rest-server.properties delete mode 100644 hugegraph-it/hg-it-dist/src/assembly/static/simple/store/conf/application-pd.yml delete mode 100644 hugegraph-it/hg-it-dist/src/assembly/static/simple/store/conf/application.yml delete mode 100644 hugegraph-it/hg-it-dist/src/assembly/static/simple/store/conf/log4j2.xml delete mode 100644 hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/config/ClusterConfImpl.java delete mode 100644 hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/env/SimpleEnv.java diff --git a/hugegraph-it/hg-it-dist/pom.xml b/hugegraph-cluster-test/hg-ct-dist/pom.xml similarity index 91% rename from hugegraph-it/hg-it-dist/pom.xml rename to hugegraph-cluster-test/hg-ct-dist/pom.xml index ded39a4529..f06d7099f9 100644 --- a/hugegraph-it/hg-it-dist/pom.xml +++ b/hugegraph-cluster-test/hg-ct-dist/pom.xml @@ -22,12 +22,12 @@ 4.0.0 org.apache.hugegraph - hugegraph-it + hugegraph-cluster-test ${revision} ../pom.xml - hg-it-dist + hg-ct-dist ${project.parent.basedir} @@ -35,7 +35,7 @@ ${project.basedir}/src/assembly ${assembly.dir}/descriptor ${assembly.dir}/static - hg-it + hg-ct @@ -45,7 +45,7 @@ 2.4 - assembly-hugegraph-it + assembly-hugegraph-ct package single @@ -70,7 +70,7 @@ org.apache.hugegraph - hg-it-minicluster + hg-ct-minicluster ${revision} diff --git a/hugegraph-it/hg-it-dist/src/assembly/descriptor/assembly.xml b/hugegraph-cluster-test/hg-ct-dist/src/assembly/descriptor/assembly.xml similarity index 100% rename from hugegraph-it/hg-it-dist/src/assembly/descriptor/assembly.xml rename to hugegraph-cluster-test/hg-ct-dist/src/assembly/descriptor/assembly.xml diff --git a/hugegraph-it/hg-it-minicluster/pom.xml b/hugegraph-cluster-test/hg-ct-minicluster/pom.xml similarity index 83% rename from hugegraph-it/hg-it-minicluster/pom.xml rename to hugegraph-cluster-test/hg-ct-minicluster/pom.xml index 5542f1a92f..cad9a1c7c9 100644 --- a/hugegraph-it/hg-it-minicluster/pom.xml +++ b/hugegraph-cluster-test/hg-ct-minicluster/pom.xml @@ -20,11 +20,11 @@ xmlns="http://maven.apache.org/POM/4.0.0" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - hg-it-minicluster + hg-ct-minicluster org.apache.hugegraph - hugegraph-it + hugegraph-cluster-test ${revision} @@ -61,6 +61,17 @@ 1.18.24 compile + + org.freemarker + freemarker + 2.3.33 + + + org.yaml + snakeyaml + 2.2 + compile + diff --git a/hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/base/ClusterConstant.java b/hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/base/ClusterConstant.java similarity index 50% rename from hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/base/ClusterConstant.java rename to hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/base/ClusterConstant.java index 744c73e053..983ee45f96 100644 --- a/hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/base/ClusterConstant.java +++ b/hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/base/ClusterConstant.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package org.apache.hugegraph.it.base; +package org.apache.hugegraph.ct.base; import java.io.File; @@ -24,44 +24,45 @@ public class ClusterConstant { public static final String USER_DIR = "user.dir"; - public static final String TARGET = "target"; public static final String LOG = "logs"; - public static final String SIMPLE = "simple"; - public static final String MULTI = "multi"; public static final String LIB_DIR = "lib"; public static final String EXT_DIR = "ext"; public static final String PLUGINS_DIR = "plugins"; - + public static final String BIN_DIR = "bin"; + public static final String DIST_DIR = "dist"; public static final String CONF_DIR = "conf"; - public static final String LOGS_DIR = "logs"; - public static final boolean OPEN_SECURITY_CHECK = true; - public static final boolean OPEN_TELEMETRY = false; - public static final boolean IS_WINDOWS = SystemUtils.IS_OS_WINDOWS; + public static final String PD_PACKAGE_PREFIX = "hugegraph-pd"; public static final String PD_JAR_PREFIX = "hg-pd-service"; public static final String STORE_PACKAGE_PREFIX = "hugegraph-store"; public static final String STORE_JAR_PREFIX = "hg-store-node"; public static final String SERVER_PACKAGE_PREFIX = "apache-hugegraph-incubating"; - public static final String IT_PACKAGE_PREFIX = "apache-hugegraph-incubating-it"; - - public static final String TEMPLATE_NODE_DIR = - System.getProperty(USER_DIR) + File.separator + TARGET + File.separator - + "template-node"; + public static final String CT_PACKAGE_PREFIX = "apache-hugegraph-incubating-ct"; + + public static final String APPLICATION_FILE = "application.yml"; + public static final String SERVER_PROPERTIES = "rest-server.properties"; + public static final String HUGEGRAPH_PROPERTIES = "hugegraph.properties"; + public static final String LOG4J_FILE = "log4j2.xml"; + public static final String VERIFY_LICENSE_FILE = "verify-license.json"; + public static final String LICENSE_FILE = "hugegraph.license"; + public static final String PD_TEMPLATE_FILE = "pd-application.yml.template"; + public static final String STORE_TEMPLATE_FILE = "store-application.yml.template"; + public static final String SERVER_TEMPLATE_FILE = "rest-server.properties.template"; public static final String JAVA_CMD = System.getProperty("java.home") + File.separator - + "bin" + + BIN_DIR + File.separator + (SystemUtils.IS_OS_WINDOWS ? "java.exe" : "java"); public static final String PD_DIST_PATH = - System.getProperty("user.dir") + System.getProperty(USER_DIR) + File.separator + "hugegraph-pd" + File.separator - + "dist" + + DIST_DIR + File.separator; public static final String PD_LIB_PATH = @@ -71,21 +72,21 @@ public class ClusterConstant { + File.separator; public static final String STORE_DIST_PATH = - System.getProperty("user.dir") + System.getProperty(USER_DIR) + File.separator + "hugegraph-store" + File.separator - + "dist" + + DIST_DIR + File.separator; public static final String STORE_LIB_PATH = getFileInDir(STORE_DIST_PATH, STORE_PACKAGE_PREFIX) + File.separator - + "lib" + + LIB_DIR + File.separator; public static final String SERVER_DIST_PATH = - System.getProperty("user.dir") + System.getProperty(USER_DIR) + File.separator + "hugegraph-server" + File.separator; @@ -94,120 +95,18 @@ public class ClusterConstant { getFileInDir(SERVER_DIST_PATH, SERVER_PACKAGE_PREFIX) + File.separator; - public static final String IT_DIST_PATH = - System.getProperty("user.dir") + public static final String CT_DIST_PATH = + System.getProperty(USER_DIR) + File.separator - + "hugegraph-it" + + "hugegraph-cluster-test" + File.separator; - public static final String IT_PACKAGE_PATH = - getFileInDir(IT_DIST_PATH, IT_PACKAGE_PREFIX) - + File.separator; - - public static final String SIMPLE_PD_CONFIG_PATH = - IT_PACKAGE_PATH - + SIMPLE - + File.separator - + "pd" - + File.separator; - - public static final String SIMPLE_STORE_CONFIG_PATH = - IT_PACKAGE_PATH - + SIMPLE - + File.separator - + "store" - + File.separator; - - public static final String SIMPLE_SERVER_CONFIG_PATH = - IT_PACKAGE_PATH - + SIMPLE - + File.separator - + "server" - + File.separator; - - public static final String MULTI_PD_A_CONFIG_PATH = - IT_PACKAGE_PATH - + MULTI - + File.separator - + "pd" - + File.separator - + "A" - + File.separator; - - public static final String MULTI_PD_B_CONFIG_PATH = - IT_PACKAGE_PATH - + MULTI - + File.separator - + "pd" - + File.separator - + "B" - + File.separator; - - public static final String MULTI_PD_C_CONFIG_PATH = - IT_PACKAGE_PATH - + MULTI - + File.separator - + "pd" - + File.separator - + "C" - + File.separator; - - public static final String MULTI_STORE_A_CONFIG_PATH = - IT_PACKAGE_PATH - + MULTI - + File.separator - + "store" - + File.separator - + "A" - + File.separator; - - public static final String MULTI_STORE_B_CONFIG_PATH = - IT_PACKAGE_PATH - + MULTI - + File.separator - + "store" - + File.separator - + "B" - + File.separator; - - public static final String MULTI_STORE_C_CONFIG_PATH = - IT_PACKAGE_PATH - + MULTI - + File.separator - + "store" - + File.separator - + "C" - + File.separator; - - public static final String MULTI_SERVER_A_CONFIG_PATH = - IT_PACKAGE_PATH - + MULTI - + File.separator - + "server" - + File.separator - + "A" - + File.separator; - - public static final String MULTI_SERVER_B_CONFIG_PATH = - IT_PACKAGE_PATH - + MULTI - + File.separator - + "server" - + File.separator - + "B" - + File.separator; - - public static final String MULTI_SERVER_C_CONFIG_PATH = - IT_PACKAGE_PATH - + MULTI - + File.separator - + "server" - + File.separator - + "C" + public static final String CT_PACKAGE_PATH = + getFileInDir(CT_DIST_PATH, CT_PACKAGE_PREFIX) + File.separator; public static final String IT_LOG_PATH = - IT_PACKAGE_PATH + CT_PACKAGE_PATH + LOG + File.separator; diff --git a/hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/base/EnvType.java b/hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/base/EnvType.java similarity index 96% rename from hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/base/EnvType.java rename to hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/base/EnvType.java index 50194b1822..67312e8111 100644 --- a/hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/base/EnvType.java +++ b/hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/base/EnvType.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package org.apache.hugegraph.it.base; +package org.apache.hugegraph.ct.base; public enum EnvType { Simple, diff --git a/hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/base/HGTestLogger.java b/hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/base/HGTestLogger.java similarity index 96% rename from hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/base/HGTestLogger.java rename to hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/base/HGTestLogger.java index 66cef5b0bd..4a83785369 100644 --- a/hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/base/HGTestLogger.java +++ b/hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/base/HGTestLogger.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package org.apache.hugegraph.it.base; +package org.apache.hugegraph.ct.base; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/config/ClusterConf.java b/hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/config/ClusterConf.java new file mode 100644 index 0000000000..e03dbda993 --- /dev/null +++ b/hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/config/ClusterConf.java @@ -0,0 +1,78 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.hugegraph.ct.config; + +import java.util.ArrayList; +import java.util.List; + +import org.apache.hugegraph.ct.base.HGTestLogger; +import org.slf4j.Logger; + +public class ClusterConf { + + protected static final Logger LOG = HGTestLogger.LOG; + protected List pdConfigs; + protected List storeConfigs; + protected List serverConfigs; + + protected List pdGrpcList, pdRaftList, storeGrpcList; + + public ClusterConf(int pdCnt, int storeCnt, int serverCnt) { + pdConfigs = new ArrayList<>(); + storeConfigs = new ArrayList<>(); + serverConfigs = new ArrayList<>(); + + for (int i = 0; i < pdCnt; i++) { + PDConfig pdConfig = new PDConfig(); + pdConfig.setStoreCount(storeCnt); + pdConfigs.add(pdConfig); + pdGrpcList.add(pdConfig.getGrpcAddress()); + pdRaftList.add(pdConfig.getRaftAddress()); + } + + for (int i = 0; i < storeCnt; i++) { + StoreConfig storeConfig = new StoreConfig(); + storeConfig.setPDServerList(pdGrpcList); + storeConfigs.add(storeConfig); + storeGrpcList.add(storeConfig.getGrpcAddress()); + } + + for (int i = 0; i < serverCnt; i++) { + ServerConfig serverConfig = new ServerConfig(); + serverConfigs.add(serverConfig); + } + + for (int i = 0; i < pdCnt; i++) { + PDConfig pdConfig = pdConfigs.get(i); + pdConfig.setRaftPeerList(pdGrpcList); + pdConfig.setStoreGrpcList(storeGrpcList); + } + } + + public PDConfig getPDConfig(int i) { + return pdConfigs.get(i); + } + + public StoreConfig getStoreConfig(int i) { + return storeConfigs.get(i); + } + + public ServerConfig getServerConfig(int i) { + return serverConfigs.get(i); + } +} diff --git a/hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/env/AbstractEnv.java b/hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/env/AbstractEnv.java similarity index 50% rename from hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/env/AbstractEnv.java rename to hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/env/AbstractEnv.java index 25d5c7f23f..1d32e008e5 100644 --- a/hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/env/AbstractEnv.java +++ b/hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/env/AbstractEnv.java @@ -15,52 +15,82 @@ * limitations under the License. */ -package org.apache.hugegraph.it.env; +package org.apache.hugegraph.ct.env; +import static org.apache.hugegraph.ct.base.ClusterConstant.CONF_DIR; + +import java.io.File; import java.util.ArrayList; import java.util.List; -import org.apache.hugegraph.it.base.HGTestLogger; -import org.apache.hugegraph.it.config.ClusterConf; -import org.apache.hugegraph.it.config.ClusterConfImpl; -import org.apache.hugegraph.it.node.PDNodeWrapper; -import org.apache.hugegraph.it.node.ServerNodeWrapper; -import org.apache.hugegraph.it.node.StoreNodeWrapper; +import org.apache.hugegraph.ct.base.HGTestLogger; +import org.apache.hugegraph.ct.config.ClusterConf; +import org.apache.hugegraph.ct.config.PDConfig; +import org.apache.hugegraph.ct.config.ServerConfig; +import org.apache.hugegraph.ct.config.StoreConfig; +import org.apache.hugegraph.ct.node.PDNodeWrapper; +import org.apache.hugegraph.ct.node.ServerNodeWrapper; +import org.apache.hugegraph.ct.node.StoreNodeWrapper; import org.slf4j.Logger; +import lombok.Setter; import lombok.extern.slf4j.Slf4j; @Slf4j public abstract class AbstractEnv implements BaseEnv { private static final Logger LOG = HGTestLogger.LOG; - private final ClusterConf clusterConf; + protected ClusterConf clusterConf; protected List pdNodeWrappers; protected List serverNodeWrappers; protected List storeNodeWrappers; + @Setter protected int cluster_id = 0; public AbstractEnv() { - this.clusterConf = new ClusterConfImpl(); this.pdNodeWrappers = new ArrayList<>(); this.serverNodeWrappers = new ArrayList<>(); this.storeNodeWrappers = new ArrayList<>(); } - protected void addPDNode(PDNodeWrapper pdNodeWrapper) { - this.pdNodeWrappers.add(pdNodeWrapper); - } + public void init(int pdCnt, int storeCnt, int serverCnt) { + this.clusterConf = new ClusterConf(pdCnt, storeCnt, serverCnt); + for (int i = 0; i < pdCnt; i++) { + PDNodeWrapper pdNodeWrapper = new PDNodeWrapper(cluster_id, i); + PDConfig pdConfig = clusterConf.getPDConfig(i); + pdNodeWrappers.add(pdNodeWrapper); + pdConfig.writeConfig(pdNodeWrapper.getNodePath() + + File.separator + + CONF_DIR); + } - protected void addStoreNode(StoreNodeWrapper storeNodeWrapper) { - this.storeNodeWrappers.add(storeNodeWrapper); - } + for (int i = 0; i < storeCnt; i++) { + StoreNodeWrapper storeNodeWrapper = new StoreNodeWrapper(cluster_id, i); + StoreConfig storeConfig = clusterConf.getStoreConfig(i); + storeNodeWrappers.add(storeNodeWrapper); + storeConfig.writeConfig(storeNodeWrapper.getNodePath() + + File.separator + + CONF_DIR); + } - protected void addServerNode(ServerNodeWrapper serverNodeWrapper) { - this.serverNodeWrappers.add(serverNodeWrapper); + for (int i = 0; i < serverCnt; i++) { + ServerNodeWrapper serverNodeWrapper = new ServerNodeWrapper(cluster_id, i); + serverNodeWrappers.add(serverNodeWrapper); + ServerConfig serverConfig = clusterConf.getServerConfig(i); + serverConfig.setServerID(serverNodeWrapper.getID()); + if (i == 0) { + serverConfig.setRole("master"); + } else { + serverConfig.setRole("worker"); + } + serverConfig.writeConfig(serverNodeWrapper.getNodePath() + + File.separator + + CONF_DIR); + } } @Override - public void initCluster() { + public void startCluster() { for (PDNodeWrapper pdNodeWrapper : pdNodeWrappers) { pdNodeWrapper.start(); } diff --git a/hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/env/BaseEnv.java b/hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/env/BaseEnv.java similarity index 88% rename from hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/env/BaseEnv.java rename to hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/env/BaseEnv.java index 85c31a61e4..d3c18ad7bd 100644 --- a/hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/env/BaseEnv.java +++ b/hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/env/BaseEnv.java @@ -15,14 +15,16 @@ * limitations under the License. */ -package org.apache.hugegraph.it.env; +package org.apache.hugegraph.ct.env; -import org.apache.hugegraph.it.config.ClusterConf; +import org.apache.hugegraph.ct.config.ClusterConf; public interface BaseEnv { + void init(); + /* init the cluster environment with simple mode */ - void initCluster(); + void startCluster(); /* clear the cluster env and all config*/ void clearCluster(); diff --git a/hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/config/ClusterConf.java b/hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/env/SimpleEnv.java similarity index 79% rename from hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/config/ClusterConf.java rename to hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/env/SimpleEnv.java index 1e8a0cd257..bdcb359661 100644 --- a/hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/config/ClusterConf.java +++ b/hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/env/SimpleEnv.java @@ -15,8 +15,16 @@ * limitations under the License. */ -package org.apache.hugegraph.it.config; +package org.apache.hugegraph.ct.env; -public interface ClusterConf { +public class SimpleEnv extends AbstractEnv { + public SimpleEnv() { + super(); + } + + @Override + public void init() { + super.init(1, 1, 1); + } } diff --git a/hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/node/AbstractNodeWrapper.java b/hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/node/AbstractNodeWrapper.java similarity index 61% rename from hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/node/AbstractNodeWrapper.java rename to hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/node/AbstractNodeWrapper.java index 7176cb58b6..16ecfe7601 100644 --- a/hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/node/AbstractNodeWrapper.java +++ b/hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/node/AbstractNodeWrapper.java @@ -15,57 +15,51 @@ * limitations under the License. */ -package org.apache.hugegraph.it.node; +package org.apache.hugegraph.ct.node; -import static org.apache.hugegraph.it.base.ClusterConstant.IT_LOG_PATH; -import static org.apache.hugegraph.it.base.ClusterConstant.TARGET; -import static org.apache.hugegraph.it.base.ClusterConstant.TEMPLATE_NODE_DIR; -import static org.apache.hugegraph.it.base.ClusterConstant.USER_DIR; +import static org.apache.hugegraph.ct.base.ClusterConstant.CONF_DIR; +import static org.apache.hugegraph.ct.base.ClusterConstant.CT_PACKAGE_PATH; import java.io.File; import java.io.IOException; +import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.LinkOption; import java.nio.file.NoSuchFileException; import java.nio.file.Path; import java.nio.file.Paths; import java.nio.file.StandardCopyOption; -import java.util.Properties; +import java.util.ArrayList; +import java.util.List; import java.util.concurrent.TimeUnit; import java.util.stream.Stream; import org.apache.commons.io.FileUtils; import org.apache.commons.io.file.PathUtils; -import org.apache.hugegraph.it.base.HGTestLogger; +import org.apache.hugegraph.ct.base.ClusterConstant; +import org.apache.hugegraph.ct.base.HGTestLogger; import org.slf4j.Logger; +import lombok.Getter; + public abstract class AbstractNodeWrapper implements BaseNodeWrapper { protected static final Logger LOG = HGTestLogger.LOG; - - protected final String host; - protected final int port; - protected final Properties properties = new Properties(); - protected final long startTime; protected int clusterIndex; + @Getter protected String workPath; + @Getter protected String configPath; protected Process instance; - protected int cnt; + protected int index; + protected List fileNames; public AbstractNodeWrapper() { - this.startTime = System.currentTimeMillis(); this.clusterIndex = 1; - this.host = "127.0.0.1"; - this.port = 8086; - } - - protected AbstractNodeWrapper(String host, int port, int clusterIndex, int cnt) { - this.host = host; - this.port = port; - this.clusterIndex = clusterIndex; - this.startTime = System.currentTimeMillis(); - this.cnt = cnt; + fileNames = new ArrayList<>(); + this.configPath = getNodePath(); + createNodeDir(); + createLogDir(); } /** @@ -73,7 +67,7 @@ protected AbstractNodeWrapper(String host, int port, int clusterIndex, int cnt) */ @Override public void createNodeDir() { - String destDir = getNodePath(); + String destDir = getNodePath() + File.separator + CONF_DIR; try { try { if (new File(destDir).exists()) { @@ -83,27 +77,30 @@ public void createNodeDir() { //no need to handle } // To avoid following symbolic links - try (Stream stream = Files.walk(Paths.get(TEMPLATE_NODE_DIR))) { + try (Stream stream = Files.walk(Paths.get(CT_PACKAGE_PATH))) { stream.forEach( source -> { + String fileName = source.getFileName().toString(); Path destination = Paths.get(destDir, source.toString() - .substring(TEMPLATE_NODE_DIR.length())); - try { - Files.copy(source, - destination, - LinkOption.NOFOLLOW_LINKS, - StandardCopyOption.COPY_ATTRIBUTES); - } catch (IOException ioException) { - LOG.error("Fail to copy files to node dest dir", ioException); - throw new RuntimeException(ioException); + .substring(CT_PACKAGE_PATH.length())); + if (fileNames.contains(fileName)) { + try { + Files.copy(source, + destination, + LinkOption.NOFOLLOW_LINKS, + StandardCopyOption.COPY_ATTRIBUTES); + } catch (IOException ioException) { + LOG.error("Fail to copy files to destination dir", ioException); + throw new RuntimeException(ioException); + } } } ); } } catch (IOException ioException) { - LOG.error("Got error copying files to node dest dir", ioException); + LOG.error("Got error copying files to node destination dir", ioException); throw new AssertionError(); } } @@ -127,22 +124,21 @@ public void deleteDir() { TimeUnit.SECONDS.sleep(1); } catch (InterruptedException e) { Thread.currentThread().interrupt(); - ex.printStackTrace(); + LOG.error("Fail to delete node file", e); throw new AssertionError("Delete node dir failed. " + e); } } } /** - * @return (user.dir).target.id + * @return (user.dir).id */ public String getNodePath() { - return System.getProperty(USER_DIR) + File.separator + TARGET + File.separator + - getID(); + return CT_PACKAGE_PATH + getID(); } public String getLogPath() { - return IT_LOG_PATH + getID() + "-start.log"; + return getNodePath() + ClusterConstant.LOG + getID() + "-start.log"; } public void updateWorkPath(String workPath) { @@ -158,6 +154,7 @@ public void stop() { return; } this.instance.destroy(); + deleteDir(); try { if (!this.instance.waitFor(20, TimeUnit.SECONDS)) { this.instance.destroyForcibly().waitFor(10, TimeUnit.SECONDS); @@ -171,4 +168,15 @@ public void stop() { public boolean isAlive() { return this.instance.isAlive(); } + + protected ProcessBuilder runCmd(List startCmd, File stdoutFile) throws IOException { + FileUtils.write( + stdoutFile, String.join(" ", startCmd) + "\n\n", StandardCharsets.UTF_8, true); + ProcessBuilder processBuilder = + new ProcessBuilder(startCmd) + .redirectOutput(ProcessBuilder.Redirect.appendTo(stdoutFile)) + .redirectError(ProcessBuilder.Redirect.appendTo(stdoutFile)); + processBuilder.directory(new File(configPath)); + return processBuilder; + } } diff --git a/hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/node/BaseNodeWrapper.java b/hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/node/BaseNodeWrapper.java similarity index 96% rename from hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/node/BaseNodeWrapper.java rename to hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/node/BaseNodeWrapper.java index a3da50830e..ddde71b6f0 100644 --- a/hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/node/BaseNodeWrapper.java +++ b/hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/node/BaseNodeWrapper.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package org.apache.hugegraph.it.node; +package org.apache.hugegraph.ct.node; public interface BaseNodeWrapper { diff --git a/hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/node/PDNodeWrapper.java b/hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/node/PDNodeWrapper.java similarity index 62% rename from hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/node/PDNodeWrapper.java rename to hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/node/PDNodeWrapper.java index 72b1159696..03c459575e 100644 --- a/hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/node/PDNodeWrapper.java +++ b/hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/node/PDNodeWrapper.java @@ -15,32 +15,46 @@ * limitations under the License. */ -package org.apache.hugegraph.it.node; +package org.apache.hugegraph.ct.node; -import static org.apache.hugegraph.it.base.ClusterConstant.CONF_DIR; -import static org.apache.hugegraph.it.base.ClusterConstant.JAVA_CMD; -import static org.apache.hugegraph.it.base.ClusterConstant.PD_JAR_PREFIX; -import static org.apache.hugegraph.it.base.ClusterConstant.getFileInDir; -import static org.apache.hugegraph.it.base.ClusterConstant.isJava11OrHigher; +import static org.apache.hugegraph.ct.base.ClusterConstant.CONF_DIR; +import static org.apache.hugegraph.ct.base.ClusterConstant.JAVA_CMD; +import static org.apache.hugegraph.ct.base.ClusterConstant.LICENSE_FILE; +import static org.apache.hugegraph.ct.base.ClusterConstant.LOG4J_FILE; +import static org.apache.hugegraph.ct.base.ClusterConstant.PD_JAR_PREFIX; +import static org.apache.hugegraph.ct.base.ClusterConstant.PD_LIB_PATH; +import static org.apache.hugegraph.ct.base.ClusterConstant.VERIFY_LICENSE_FILE; +import static org.apache.hugegraph.ct.base.ClusterConstant.getFileInDir; +import static org.apache.hugegraph.ct.base.ClusterConstant.isJava11OrHigher; import java.io.File; import java.io.IOException; -import java.nio.charset.StandardCharsets; import java.util.ArrayList; import java.util.Arrays; import java.util.List; -import org.apache.commons.io.FileUtils; - public class PDNodeWrapper extends AbstractNodeWrapper { - public PDNodeWrapper(String host, int grpcPort, int clusterIndex, int cnt) { - super(host, grpcPort, clusterIndex, cnt); + public PDNodeWrapper() { + super(); + fileNames = new ArrayList( + Arrays.asList(LOG4J_FILE, + LICENSE_FILE, + VERIFY_LICENSE_FILE) + ); + this.workPath = PD_LIB_PATH; } - public PDNodeWrapper(int clusterId, int cnt) { - this.clusterIndex = clusterId; - this.cnt = cnt; + public PDNodeWrapper(int clusterIndex, int index) { + super(); + this.clusterIndex = clusterIndex; + this.index = index; + fileNames = new ArrayList( + Arrays.asList(LOG4J_FILE, + LICENSE_FILE, + VERIFY_LICENSE_FILE) + ); + this.workPath = PD_LIB_PATH; } /* @@ -59,7 +73,7 @@ public void start() { String pdNodeJarPath = getFileInDir(workPath, PD_JAR_PREFIX); startCmd.addAll( Arrays.asList( - "-Dname=HugeGraphPD" + this.cnt, + "-Dname=HugeGraphPD" + this.index, "-Xms512m", "-Xmx4g", "-XX:+HeapDumpOnOutOfMemoryError", @@ -69,13 +83,7 @@ public void start() { "-Dspring.config.location=" + configPath + CONF_DIR + File.separator + "application.yml", "-jar", pdNodeJarPath)); - FileUtils.write( - stdoutFile, String.join(" ", startCmd) + "\n\n", StandardCharsets.UTF_8, true); - ProcessBuilder processBuilder = - new ProcessBuilder(startCmd) - .redirectOutput(ProcessBuilder.Redirect.appendTo(stdoutFile)) - .redirectError(ProcessBuilder.Redirect.appendTo(stdoutFile)); - processBuilder.directory(new File(configPath)); + ProcessBuilder processBuilder = runCmd(startCmd, stdoutFile); this.instance = processBuilder.start(); } catch (IOException ex) { throw new AssertionError("Start node failed. " + ex); @@ -84,6 +92,6 @@ public void start() { @Override public String getID() { - return "PD" + this.cnt; + return "PD" + this.index; } } diff --git a/hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/node/ServerNodeWrapper.java b/hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/node/ServerNodeWrapper.java similarity index 72% rename from hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/node/ServerNodeWrapper.java rename to hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/node/ServerNodeWrapper.java index 4094c48253..e17ba87654 100644 --- a/hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/node/ServerNodeWrapper.java +++ b/hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/node/ServerNodeWrapper.java @@ -15,28 +15,25 @@ * limitations under the License. */ -package org.apache.hugegraph.it.node; +package org.apache.hugegraph.ct.node; -import static org.apache.hugegraph.it.base.ClusterConstant.EXT_DIR; -import static org.apache.hugegraph.it.base.ClusterConstant.JAVA_CMD; -import static org.apache.hugegraph.it.base.ClusterConstant.LIB_DIR; -import static org.apache.hugegraph.it.base.ClusterConstant.PLUGINS_DIR; -import static org.apache.hugegraph.it.base.ClusterConstant.isJava11OrHigher; +import static org.apache.hugegraph.ct.base.ClusterConstant.EXT_DIR; +import static org.apache.hugegraph.ct.base.ClusterConstant.JAVA_CMD; +import static org.apache.hugegraph.ct.base.ClusterConstant.LIB_DIR; +import static org.apache.hugegraph.ct.base.ClusterConstant.PLUGINS_DIR; +import static org.apache.hugegraph.ct.base.ClusterConstant.isJava11OrHigher; import java.io.File; import java.io.IOException; -import java.nio.charset.StandardCharsets; import java.util.ArrayList; import java.util.Arrays; import java.util.List; -import org.apache.commons.io.FileUtils; - public class ServerNodeWrapper extends AbstractNodeWrapper { - public ServerNodeWrapper(int clusterIndex, int cnt) { + public ServerNodeWrapper(int clusterIndex, int index) { this.clusterIndex = clusterIndex; - this.cnt = cnt; + this.index = index; } private static void addJarsToClasspath(File directory, List classpath) { @@ -69,19 +66,13 @@ public void start() { String.join(":", classpath); startCmd.addAll( Arrays.asList( - "-Dname=HugeGraphServer" + this.cnt, + "-Dname=HugeGraphServer" + this.index, "--add-exports=java.base/jdk.internal.reflect=ALL-UNNAMED", "-cp", storeClassPath, "org.apache.hugegraph.dist.HugeGraphServer", "./conf/gremlin-server.yaml", "./conf/rest-server.properties")); - FileUtils.write( - stdoutFile, String.join(" ", startCmd) + "\n\n", StandardCharsets.UTF_8, true); - ProcessBuilder processBuilder = - new ProcessBuilder(startCmd) - .redirectOutput(ProcessBuilder.Redirect.appendTo(stdoutFile)) - .redirectError(ProcessBuilder.Redirect.appendTo(stdoutFile)); - processBuilder.directory(new File(configPath)); + ProcessBuilder processBuilder = runCmd(startCmd, stdoutFile); this.instance = processBuilder.start(); } catch (IOException ex) { throw new AssertionError("Start node failed. " + ex); @@ -90,6 +81,6 @@ public void start() { @Override public String getID() { - return "Server" + this.cnt; + return "Server" + this.index; } } diff --git a/hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/node/StoreNodeWrapper.java b/hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/node/StoreNodeWrapper.java similarity index 67% rename from hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/node/StoreNodeWrapper.java rename to hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/node/StoreNodeWrapper.java index 487d7a55e9..5616086e6f 100644 --- a/hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/node/StoreNodeWrapper.java +++ b/hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/node/StoreNodeWrapper.java @@ -15,32 +15,26 @@ * limitations under the License. */ -package org.apache.hugegraph.it.node; +package org.apache.hugegraph.ct.node; -import static org.apache.hugegraph.it.base.ClusterConstant.CONF_DIR; -import static org.apache.hugegraph.it.base.ClusterConstant.JAVA_CMD; -import static org.apache.hugegraph.it.base.ClusterConstant.STORE_JAR_PREFIX; -import static org.apache.hugegraph.it.base.ClusterConstant.getFileInDir; -import static org.apache.hugegraph.it.base.ClusterConstant.isJava11OrHigher; +import static org.apache.hugegraph.ct.base.ClusterConstant.CONF_DIR; +import static org.apache.hugegraph.ct.base.ClusterConstant.JAVA_CMD; +import static org.apache.hugegraph.ct.base.ClusterConstant.STORE_JAR_PREFIX; +import static org.apache.hugegraph.ct.base.ClusterConstant.getFileInDir; +import static org.apache.hugegraph.ct.base.ClusterConstant.isJava11OrHigher; import java.io.File; import java.io.IOException; -import java.nio.charset.StandardCharsets; import java.util.ArrayList; import java.util.Arrays; import java.util.List; -import org.apache.commons.io.FileUtils; - public class StoreNodeWrapper extends AbstractNodeWrapper { - protected StoreNodeWrapper(String host, int port, int clusterIndex, int cnt) { - super(host, port, clusterIndex, cnt); - } - - public StoreNodeWrapper(int clusterId, int cnt) { + public StoreNodeWrapper(int clusterId, int index) { + super(); this.clusterIndex = clusterId; - this.cnt = cnt; + this.index = index; } @Override @@ -56,7 +50,7 @@ public void start() { String storeNodeJarPath = getFileInDir(workPath, STORE_JAR_PREFIX); startCmd.addAll( Arrays.asList( - "-Dname=HugeGraphStore" + this.cnt, + "-Dname=HugeGraphStore" + this.index, "-Dlog4j.configurationFile=" + configPath + CONF_DIR + File.separator + "log4j2.xml", "-Dfastjson.parser.safeMode=true", @@ -70,13 +64,7 @@ public void start() { "-Dspring.config.location=" + configPath + CONF_DIR + File.separator + "application.yml", "-jar", storeNodeJarPath)); - FileUtils.write( - stdoutFile, String.join(" ", startCmd) + "\n\n", StandardCharsets.UTF_8, true); - ProcessBuilder processBuilder = - new ProcessBuilder(startCmd) - .redirectOutput(ProcessBuilder.Redirect.appendTo(stdoutFile)) - .redirectError(ProcessBuilder.Redirect.appendTo(stdoutFile)); - processBuilder.directory(new File(configPath)); + ProcessBuilder processBuilder = runCmd(startCmd, stdoutFile); this.instance = processBuilder.start(); } catch (IOException ex) { throw new AssertionError("Start node failed. " + ex); @@ -85,6 +73,6 @@ public void start() { @Override public String getID() { - return "Store" + this.clusterIndex; + return "Store" + this.index; } } diff --git a/hugegraph-it/hg-it-test/pom.xml b/hugegraph-cluster-test/hg-ct-test/pom.xml similarity index 91% rename from hugegraph-it/hg-it-test/pom.xml rename to hugegraph-cluster-test/hg-ct-test/pom.xml index 35486a9f80..5a1ac28f40 100644 --- a/hugegraph-it/hg-it-test/pom.xml +++ b/hugegraph-cluster-test/hg-ct-test/pom.xml @@ -22,11 +22,11 @@ 4.0.0 org.apache.hugegraph - hugegraph-it + hugegraph-cluster-test ${revision} - hg-it-test + hg-ct-test 11 @@ -36,7 +36,7 @@ org.apache.hugegraph - hg-it-minicluster + hg-ct-minicluster ${revision} compile diff --git a/hugegraph-it/pom.xml b/hugegraph-cluster-test/pom.xml similarity index 89% rename from hugegraph-it/pom.xml rename to hugegraph-cluster-test/pom.xml index ce0d21cb81..19359a2a72 100644 --- a/hugegraph-it/pom.xml +++ b/hugegraph-cluster-test/pom.xml @@ -21,7 +21,7 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - hugegraph-it + hugegraph-cluster-test ${revision} pom @@ -33,16 +33,16 @@ - hg-it-minicluster - hg-it-dist - hg-it-test + hg-ct-minicluster + hg-ct-dist + hg-ct-test 11 11 UTF-8 - apache-${release.name}-incubating-it-${project.version} + apache-${release.name}-incubating-ct-${project.version} diff --git a/hugegraph-it/hg-it-dist/src/assembly/static/multi/pd/A/conf/application.yml b/hugegraph-it/hg-it-dist/src/assembly/static/multi/pd/A/conf/application.yml deleted file mode 100644 index c0233abbc4..0000000000 --- a/hugegraph-it/hg-it-dist/src/assembly/static/multi/pd/A/conf/application.yml +++ /dev/null @@ -1,79 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -spring: - application: - name: hugegraph-pd - -management: - metrics: - export: - prometheus: - enabled: true - endpoints: - web: - exposure: - include: "*" - -logging: - config: 'file:./conf/log4j2.xml' -license: - verify-path: ./conf/verify-license.json - license-path: ./conf/hugegraph.license -grpc: - port: 8686 - # grpc 的服务地址,部署时需要改为本地实际 IPv4 地址 - host: 127.0.0.1 - -server: - # rest 服务端口号 - port: 8620 - -pd: - # 存储路径 - data-path: ./pd_data - # 自动扩容的检查周期,定时检查每个 store 的分区数量,自动进行分区数量平衡 - patrol-interval: 1800 - # 初始 store 列表,在列表内的 store 自动激活 - initial-store-count: 3 - # grpc IP:grpc port - initial-store-list: 127.0.0.1:8500,127.0.0.1:8501,127.0.0.1:8502 - -raft: - # 本机 raft 服务地址 - address: 127.0.0.1:8610 - # pd 集群服务地址 - peers-list: 127.0.0.1:8610,127.0.0.1:8611,127.0.0.1:8612 - -store: - # store 下线时间。超过该时间,认为 store 永久不可用,分配副本到其他机器,单位秒 - max-down-time: 172800 - # 是否开启 store 监控数据存储 - monitor_data_enabled: true - # 监控数据的间隔,minute (默认), hour, second - # default: 1 min * 1 day = 1440 - monitor_data_interval: 1 minute - # 监控数据的保留时间 1 天; day, month, year - monitor_data_retention: 1 day - initial-store-count: 1 - -partition: - # 默认每个分区副本数 - default-shard-count: 1 - # 默认每机器最大副本数,初始分区数 = store-max-shard-count * store-number / default-shard-count - store-max-shard-count: 12 - diff --git a/hugegraph-it/hg-it-dist/src/assembly/static/multi/pd/A/conf/application.yml.template b/hugegraph-it/hg-it-dist/src/assembly/static/multi/pd/A/conf/application.yml.template deleted file mode 100644 index 43f52df609..0000000000 --- a/hugegraph-it/hg-it-dist/src/assembly/static/multi/pd/A/conf/application.yml.template +++ /dev/null @@ -1,71 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -spring: - application: - name: hugegraph-pd -logging: - config: file:./conf/log4j2.xml - -management: - metrics: - export: - prometheus: - enabled: true - endpoints: - web: - exposure: - include: "*" - -grpc: - port: $GRPC_PORT$ - # grpc的服务地址, - #注意:部署时需要改为本地实际IPv4地址。 - host: $GRPC_HOST$ - netty-server: - max-inbound-message-size: 100MB - -server: - port : $SERVER_PORT$ - -pd: - # 集群ID,区分不同的PD集群 - - patrol-interval: 2147483647 - data-path: $PD_DATA_PATH$ - -raft: - address: $RAFT_ADDRESS$ - # raft集群 - peers-list: $RAFT_PEERS_LIST$ - # 快照生成时间间隔,单位秒 - snapshotInterval: 300 - metrics: true -store: - # store心跳超时时间,超过该时间,认为store临时不可用,转移Leader到其他副本,单位秒 - keepAlive-timeout: 60 - # store下线时间。超过该时间,认为store永久不可用,分配副本到其他机器,单位秒 - max-down-time: 1800 -partition: - # 默认分区总数 - default-total-count: 30 - # 默认每个分区副本数 - default-shard-count: 3 - -discovery: - #客户端注册后,无心跳最长次数,超过后,之前的注册信息会被删除 - heartbeat-try-count: 3 diff --git a/hugegraph-it/hg-it-dist/src/assembly/static/multi/pd/A/conf/hugegraph.license b/hugegraph-it/hg-it-dist/src/assembly/static/multi/pd/A/conf/hugegraph.license deleted file mode 100644 index 437a8ebe33666ac5b1fd10e0a598b10cc49fd5a6..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1499 zcmZ8hNl#Nz6fO;xF}4gc*+QAhBuF8QN(C*2GFoJYQjjnRmAQesHX=qZ!7-s0S|~*k|%esUl~7cr%1O1#E?o zwggFT!`!@Gw94DymN*DE;$6(lgjvsCvXeUXjB>)K}`n{Y^y( z*1J=$OD@_R1D|Sy^fmr?S_L0s0;HrtY7U-r0sn&+e0ic(co>5CPFy|V<#uNs?;#Ec7u1Gt<;g$0Vr=7xlELCD zQhEU68MD^B=5GJGFLmc|ut#0(mx?G?1C(&8c;dkP>CP-HgAM()#q(e3AG7Bi?b$gc zoF$i4b<#JDY=Gm=@nYNCxKo~u8#E-^iuiz-Q3!ClD;}!eP-L#}AE801hwv_yj#g-- zH^7d>x$~emz`hM5RL6C4WG|q!Pzv4a774s!jzm)mmjx`USDj~)y9D7-WECWzJma)+ zL!(FUq2a0}2I<0w8Ym2(%~cQ;TSkOJH!u{IxIxR9^ao=kJFPD)$>u>{I=^? zi*`m&>S{TkfbH|^D77bKUEocSeQup*cLC0P@Y2$%(ZU(-41u(OPVV*KjdvbKYFI|Z lX$Ioxu@X - - - - - - - logs - hugegraph-pd - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/hugegraph-it/hg-it-dist/src/assembly/static/multi/pd/A/conf/verify-license.json b/hugegraph-it/hg-it-dist/src/assembly/static/multi/pd/A/conf/verify-license.json deleted file mode 100644 index 868ccbebbb..0000000000 --- a/hugegraph-it/hg-it-dist/src/assembly/static/multi/pd/A/conf/verify-license.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "subject": "hugegraph-license", - "public_alias": "publiccert", - "store_ticket": "803b6cc3-d144-47e8-948f-ec8b39c8881e", - "publickey_path": "/public-certs.store" -} diff --git a/hugegraph-it/hg-it-dist/src/assembly/static/multi/pd/B/conf/application.yml b/hugegraph-it/hg-it-dist/src/assembly/static/multi/pd/B/conf/application.yml deleted file mode 100644 index 59bc7d43f7..0000000000 --- a/hugegraph-it/hg-it-dist/src/assembly/static/multi/pd/B/conf/application.yml +++ /dev/null @@ -1,79 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -spring: - application: - name: hugegraph-pd - -management: - metrics: - export: - prometheus: - enabled: true - endpoints: - web: - exposure: - include: "*" - -logging: - config: 'file:./conf/log4j2.xml' -license: - verify-path: ./conf/verify-license.json - license-path: ./conf/hugegraph.license -grpc: - port: 8687 - # grpc 的服务地址,部署时需要改为本地实际 IPv4 地址 - host: 127.0.0.1 - -server: - # rest 服务端口号 - port: 8621 - -pd: - # 存储路径 - data-path: ./pd_data - # 自动扩容的检查周期,定时检查每个 store 的分区数量,自动进行分区数量平衡 - patrol-interval: 1800 - # 初始 store 列表,在列表内的 store 自动激活 - initial-store-count: 3 - # grpc IP:grpc port - initial-store-list: 127.0.0.1:8500,127.0.0.1:8501,127.0.0.1:8502 - -raft: - # 本机 raft 服务地址 - address: 127.0.0.1:8611 - # pd 集群服务地址 - peers-list: 127.0.0.1:8610,127.0.0.1:8611,127.0.0.1:8612 - -store: - # store 下线时间。超过该时间,认为 store 永久不可用,分配副本到其他机器,单位秒 - max-down-time: 172800 - # 是否开启 store 监控数据存储 - monitor_data_enabled: true - # 监控数据的间隔,minute (默认), hour, second - # default: 1 min * 1 day = 1440 - monitor_data_interval: 1 minute - # 监控数据的保留时间 1 天; day, month, year - monitor_data_retention: 1 day - initial-store-count: 1 - -partition: - # 默认每个分区副本数 - default-shard-count: 1 - # 默认每机器最大副本数,初始分区数 = store-max-shard-count * store-number / default-shard-count - store-max-shard-count: 12 - diff --git a/hugegraph-it/hg-it-dist/src/assembly/static/multi/pd/B/conf/application.yml.template b/hugegraph-it/hg-it-dist/src/assembly/static/multi/pd/B/conf/application.yml.template deleted file mode 100644 index 43f52df609..0000000000 --- a/hugegraph-it/hg-it-dist/src/assembly/static/multi/pd/B/conf/application.yml.template +++ /dev/null @@ -1,71 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -spring: - application: - name: hugegraph-pd -logging: - config: file:./conf/log4j2.xml - -management: - metrics: - export: - prometheus: - enabled: true - endpoints: - web: - exposure: - include: "*" - -grpc: - port: $GRPC_PORT$ - # grpc的服务地址, - #注意:部署时需要改为本地实际IPv4地址。 - host: $GRPC_HOST$ - netty-server: - max-inbound-message-size: 100MB - -server: - port : $SERVER_PORT$ - -pd: - # 集群ID,区分不同的PD集群 - - patrol-interval: 2147483647 - data-path: $PD_DATA_PATH$ - -raft: - address: $RAFT_ADDRESS$ - # raft集群 - peers-list: $RAFT_PEERS_LIST$ - # 快照生成时间间隔,单位秒 - snapshotInterval: 300 - metrics: true -store: - # store心跳超时时间,超过该时间,认为store临时不可用,转移Leader到其他副本,单位秒 - keepAlive-timeout: 60 - # store下线时间。超过该时间,认为store永久不可用,分配副本到其他机器,单位秒 - max-down-time: 1800 -partition: - # 默认分区总数 - default-total-count: 30 - # 默认每个分区副本数 - default-shard-count: 3 - -discovery: - #客户端注册后,无心跳最长次数,超过后,之前的注册信息会被删除 - heartbeat-try-count: 3 diff --git a/hugegraph-it/hg-it-dist/src/assembly/static/multi/pd/B/conf/hugegraph.license b/hugegraph-it/hg-it-dist/src/assembly/static/multi/pd/B/conf/hugegraph.license deleted file mode 100644 index 437a8ebe33666ac5b1fd10e0a598b10cc49fd5a6..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1499 zcmZ8hNl#Nz6fO;xF}4gc*+QAhBuF8QN(C*2GFoJYQjjnRmAQesHX=qZ!7-s0S|~*k|%esUl~7cr%1O1#E?o zwggFT!`!@Gw94DymN*DE;$6(lgjvsCvXeUXjB>)K}`n{Y^y( z*1J=$OD@_R1D|Sy^fmr?S_L0s0;HrtY7U-r0sn&+e0ic(co>5CPFy|V<#uNs?;#Ec7u1Gt<;g$0Vr=7xlELCD zQhEU68MD^B=5GJGFLmc|ut#0(mx?G?1C(&8c;dkP>CP-HgAM()#q(e3AG7Bi?b$gc zoF$i4b<#JDY=Gm=@nYNCxKo~u8#E-^iuiz-Q3!ClD;}!eP-L#}AE801hwv_yj#g-- zH^7d>x$~emz`hM5RL6C4WG|q!Pzv4a774s!jzm)mmjx`USDj~)y9D7-WECWzJma)+ zL!(FUq2a0}2I<0w8Ym2(%~cQ;TSkOJH!u{IxIxR9^ao=kJFPD)$>u>{I=^? zi*`m&>S{TkfbH|^D77bKUEocSeQup*cLC0P@Y2$%(ZU(-41u(OPVV*KjdvbKYFI|Z lX$Ioxu@X - - - - - - - logs - hugegraph-pd - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/hugegraph-it/hg-it-dist/src/assembly/static/multi/pd/B/conf/verify-license.json b/hugegraph-it/hg-it-dist/src/assembly/static/multi/pd/B/conf/verify-license.json deleted file mode 100644 index 868ccbebbb..0000000000 --- a/hugegraph-it/hg-it-dist/src/assembly/static/multi/pd/B/conf/verify-license.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "subject": "hugegraph-license", - "public_alias": "publiccert", - "store_ticket": "803b6cc3-d144-47e8-948f-ec8b39c8881e", - "publickey_path": "/public-certs.store" -} diff --git a/hugegraph-it/hg-it-dist/src/assembly/static/multi/pd/C/conf/application.yml b/hugegraph-it/hg-it-dist/src/assembly/static/multi/pd/C/conf/application.yml deleted file mode 100644 index 3e5669d702..0000000000 --- a/hugegraph-it/hg-it-dist/src/assembly/static/multi/pd/C/conf/application.yml +++ /dev/null @@ -1,79 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -spring: - application: - name: hugegraph-pd - -management: - metrics: - export: - prometheus: - enabled: true - endpoints: - web: - exposure: - include: "*" - -logging: - config: 'file:./conf/log4j2.xml' -license: - verify-path: ./conf/verify-license.json - license-path: ./conf/hugegraph.license -grpc: - port: 8688 - # grpc 的服务地址,部署时需要改为本地实际 IPv4 地址 - host: 127.0.0.1 - -server: - # rest 服务端口号 - port: 8622 - -pd: - # 存储路径 - data-path: ./pd_data - # 自动扩容的检查周期,定时检查每个 store 的分区数量,自动进行分区数量平衡 - patrol-interval: 1800 - # 初始 store 列表,在列表内的 store 自动激活 - initial-store-count: 3 - # grpc IP:grpc port - initial-store-list: 127.0.0.1:8500,127.0.0.1:8501,127.0.0.1:8502 - -raft: - # 本机 raft 服务地址 - address: 127.0.0.1:8612 - # pd 集群服务地址 - peers-list: 127.0.0.1:8610,127.0.0.1:8611,127.0.0.1:8612 - -store: - # store 下线时间。超过该时间,认为 store 永久不可用,分配副本到其他机器,单位秒 - max-down-time: 172800 - # 是否开启 store 监控数据存储 - monitor_data_enabled: true - # 监控数据的间隔,minute (默认), hour, second - # default: 1 min * 1 day = 1440 - monitor_data_interval: 1 minute - # 监控数据的保留时间 1 天; day, month, year - monitor_data_retention: 1 day - initial-store-count: 1 - -partition: - # 默认每个分区副本数 - default-shard-count: 1 - # 默认每机器最大副本数,初始分区数 = store-max-shard-count * store-number / default-shard-count - store-max-shard-count: 12 - diff --git a/hugegraph-it/hg-it-dist/src/assembly/static/multi/pd/C/conf/application.yml.template b/hugegraph-it/hg-it-dist/src/assembly/static/multi/pd/C/conf/application.yml.template deleted file mode 100644 index 43f52df609..0000000000 --- a/hugegraph-it/hg-it-dist/src/assembly/static/multi/pd/C/conf/application.yml.template +++ /dev/null @@ -1,71 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -spring: - application: - name: hugegraph-pd -logging: - config: file:./conf/log4j2.xml - -management: - metrics: - export: - prometheus: - enabled: true - endpoints: - web: - exposure: - include: "*" - -grpc: - port: $GRPC_PORT$ - # grpc的服务地址, - #注意:部署时需要改为本地实际IPv4地址。 - host: $GRPC_HOST$ - netty-server: - max-inbound-message-size: 100MB - -server: - port : $SERVER_PORT$ - -pd: - # 集群ID,区分不同的PD集群 - - patrol-interval: 2147483647 - data-path: $PD_DATA_PATH$ - -raft: - address: $RAFT_ADDRESS$ - # raft集群 - peers-list: $RAFT_PEERS_LIST$ - # 快照生成时间间隔,单位秒 - snapshotInterval: 300 - metrics: true -store: - # store心跳超时时间,超过该时间,认为store临时不可用,转移Leader到其他副本,单位秒 - keepAlive-timeout: 60 - # store下线时间。超过该时间,认为store永久不可用,分配副本到其他机器,单位秒 - max-down-time: 1800 -partition: - # 默认分区总数 - default-total-count: 30 - # 默认每个分区副本数 - default-shard-count: 3 - -discovery: - #客户端注册后,无心跳最长次数,超过后,之前的注册信息会被删除 - heartbeat-try-count: 3 diff --git a/hugegraph-it/hg-it-dist/src/assembly/static/multi/pd/C/conf/hugegraph.license b/hugegraph-it/hg-it-dist/src/assembly/static/multi/pd/C/conf/hugegraph.license deleted file mode 100644 index 437a8ebe33666ac5b1fd10e0a598b10cc49fd5a6..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1499 zcmZ8hNl#Nz6fO;xF}4gc*+QAhBuF8QN(C*2GFoJYQjjnRmAQesHX=qZ!7-s0S|~*k|%esUl~7cr%1O1#E?o zwggFT!`!@Gw94DymN*DE;$6(lgjvsCvXeUXjB>)K}`n{Y^y( z*1J=$OD@_R1D|Sy^fmr?S_L0s0;HrtY7U-r0sn&+e0ic(co>5CPFy|V<#uNs?;#Ec7u1Gt<;g$0Vr=7xlELCD zQhEU68MD^B=5GJGFLmc|ut#0(mx?G?1C(&8c;dkP>CP-HgAM()#q(e3AG7Bi?b$gc zoF$i4b<#JDY=Gm=@nYNCxKo~u8#E-^iuiz-Q3!ClD;}!eP-L#}AE801hwv_yj#g-- zH^7d>x$~emz`hM5RL6C4WG|q!Pzv4a774s!jzm)mmjx`USDj~)y9D7-WECWzJma)+ zL!(FUq2a0}2I<0w8Ym2(%~cQ;TSkOJH!u{IxIxR9^ao=kJFPD)$>u>{I=^? zi*`m&>S{TkfbH|^D77bKUEocSeQup*cLC0P@Y2$%(ZU(-41u(OPVV*KjdvbKYFI|Z lX$Ioxu@X - - - - - - - logs - hugegraph-pd - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/hugegraph-it/hg-it-dist/src/assembly/static/multi/pd/C/conf/verify-license.json b/hugegraph-it/hg-it-dist/src/assembly/static/multi/pd/C/conf/verify-license.json deleted file mode 100644 index 868ccbebbb..0000000000 --- a/hugegraph-it/hg-it-dist/src/assembly/static/multi/pd/C/conf/verify-license.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "subject": "hugegraph-license", - "public_alias": "publiccert", - "store_ticket": "803b6cc3-d144-47e8-948f-ec8b39c8881e", - "publickey_path": "/public-certs.store" -} diff --git a/hugegraph-it/hg-it-dist/src/assembly/static/multi/server/A/conf/computer.yaml b/hugegraph-it/hg-it-dist/src/assembly/static/multi/server/A/conf/computer.yaml deleted file mode 100644 index 1c69388bb0..0000000000 --- a/hugegraph-it/hg-it-dist/src/assembly/static/multi/server/A/conf/computer.yaml +++ /dev/null @@ -1,39 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# common parameters -common: { - worker_heap: 10000, - vertex_input_dir: /data, - workers: 51, - zookeeper_list: "127.0.0.1:2181", - max_edges_per_segment: 10485760, - edges_immutable: true, - partitions: 255, - compute_threads: 5, - input_threads: 5, - message_async: false, - message_queue_size: 1000, - message_send_threads: 10, - messages_per_segment: 104857600, - hugegraph_url: "http://127.0.0.1:8080", - hugegraph_name: hugegraph, - hugegraph_timeout: 60 -} - -env: { - computer_home: /home/computer -} diff --git a/hugegraph-it/hg-it-dist/src/assembly/static/multi/server/A/conf/graphs/hugegraph.properties b/hugegraph-it/hg-it-dist/src/assembly/static/multi/server/A/conf/graphs/hugegraph.properties deleted file mode 100644 index 02b2d43270..0000000000 --- a/hugegraph-it/hg-it-dist/src/assembly/static/multi/server/A/conf/graphs/hugegraph.properties +++ /dev/null @@ -1,126 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -# gremlin entrance to create graph -# auth config: org.apache.hugegraph.auth.HugeFactoryAuthProxy -gremlin.graph=org.apache.hugegraph.HugeFactory - -# cache config -#schema.cache_capacity=100000 -# vertex-cache default is 1000w, 10min expired -vertex.cache_type=l2 -#vertex.cache_capacity=10000000 -#vertex.cache_expire=600 -# edge-cache default is 100w, 10min expired -edge.cache_type=l2 -#edge.cache_capacity=1000000 -#edge.cache_expire=600 - - -# schema illegal name template -#schema.illegal_name_regex=\s+|~.* - -#vertex.default_label=vertex - -backend=hstore -serializer=binary - -store=hugegraph - -# pd config -pd.peers=127.0.0.1:8686,127.0.0.1:8687,127.0.0.1:8688 - -# task config -task.scheduler_type=local -task.schedule_period=10 -task.retry=0 -task.wait_timeout=10 - -# raft config -raft.mode=false -raft.path=./raft-log -raft.safe_read=true -raft.use_replicator_pipeline=true -raft.election_timeout=10000 -raft.snapshot_interval=3600 -raft.backend_threads=48 -raft.read_index_threads=8 -raft.snapshot_threads=4 -raft.snapshot_parallel_compress=false -raft.snapshot_compress_threads=4 -raft.snapshot_decompress_threads=4 -raft.read_strategy=ReadOnlyLeaseBased -raft.queue_size=16384 -raft.queue_publish_timeout=60 -raft.apply_batch=1 -raft.rpc_threads=80 -raft.rpc_connect_timeout=5000 -raft.rpc_timeout=60 -raft.install_snapshot_rpc_timeout=36000 - -# search config -search.text_analyzer=jieba -search.text_analyzer_mode=INDEX - -# rocksdb backend config -#rocksdb.data_path=/path/to/disk -#rocksdb.wal_path=/path/to/disk - - -# cassandra backend config -cassandra.host=localhost -cassandra.port=9042 -cassandra.username= -cassandra.password= -#cassandra.connect_timeout=5 -#cassandra.read_timeout=20 -#cassandra.keyspace.strategy=SimpleStrategy -#cassandra.keyspace.replication=3 - -# hbase backend config -#hbase.hosts=localhost -#hbase.port=2181 -#hbase.znode_parent=/hbase -#hbase.threads_max=64 -# IMPORTANT: recommend to modify the HBase partition number -# by the actual/env data amount & RS amount before init store -# It will influence the load speed a lot -#hbase.enable_partition=true -#hbase.vertex_partitions=10 -#hbase.edge_partitions=30 - -# mysql backend config -#jdbc.driver=com.mysql.jdbc.Driver -#jdbc.url=jdbc:mysql://127.0.0.1:3306 -#jdbc.username=root -#jdbc.password= -#jdbc.reconnect_max_times=3 -#jdbc.reconnect_interval=3 -#jdbc.ssl_mode=false - -# postgresql & cockroachdb backend config -#jdbc.driver=org.postgresql.Driver -#jdbc.url=jdbc:postgresql://localhost:5432/ -#jdbc.username=postgres -#jdbc.password= -#jdbc.postgresql.connect_database=template1 - -# palo backend config -#palo.host=127.0.0.1 -#palo.poll_interval=10 -#palo.temp_dir=./palo-data -#palo.file_limit_size=32 diff --git a/hugegraph-it/hg-it-dist/src/assembly/static/multi/server/A/conf/gremlin-driver-settings.yaml b/hugegraph-it/hg-it-dist/src/assembly/static/multi/server/A/conf/gremlin-driver-settings.yaml deleted file mode 100644 index 2f60ff8379..0000000000 --- a/hugegraph-it/hg-it-dist/src/assembly/static/multi/server/A/conf/gremlin-driver-settings.yaml +++ /dev/null @@ -1,25 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -hosts: [localhost] -port: 8181 -serializer: { - className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV1d0, - config: { - serializeResultToString: false, - ioRegistries: [org.apache.hugegraph.io.HugeGraphIoRegistry] - } -} diff --git a/hugegraph-it/hg-it-dist/src/assembly/static/multi/server/A/conf/gremlin-server.yaml b/hugegraph-it/hg-it-dist/src/assembly/static/multi/server/A/conf/gremlin-server.yaml deleted file mode 100644 index df73386b26..0000000000 --- a/hugegraph-it/hg-it-dist/src/assembly/static/multi/server/A/conf/gremlin-server.yaml +++ /dev/null @@ -1,127 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# host and port of gremlin server, need to be consistent with host and port in rest-server.properties -host: 127.0.0.1 -port: 8181 - -# timeout in ms of gremlin query -evaluationTimeout: 30000 - -channelizer: org.apache.tinkerpop.gremlin.server.channel.WsAndHttpChannelizer -# don't set graph at here, this happens after support for dynamically adding graph -graphs: { -} -scriptEngines: { - gremlin-groovy: { - staticImports: [ - org.opencypher.gremlin.process.traversal.CustomPredicates.*', - org.opencypher.gremlin.traversal.CustomFunctions.* - ], - plugins: { - org.apache.hugegraph.plugin.HugeGraphGremlinPlugin: {}, - org.apache.tinkerpop.gremlin.server.jsr223.GremlinServerGremlinPlugin: {}, - org.apache.tinkerpop.gremlin.jsr223.ImportGremlinPlugin: { - classImports: [ - java.lang.Math, - org.apache.hugegraph.backend.id.IdGenerator, - org.apache.hugegraph.type.define.Directions, - org.apache.hugegraph.type.define.NodeRole, - org.apache.hugegraph.masterelection.GlobalMasterInfo, - org.apache.hugegraph.util.DateUtil, - org.apache.hugegraph.traversal.algorithm.CollectionPathsTraverser, - org.apache.hugegraph.traversal.algorithm.CountTraverser, - org.apache.hugegraph.traversal.algorithm.CustomizedCrosspointsTraverser, - org.apache.hugegraph.traversal.algorithm.CustomizePathsTraverser, - org.apache.hugegraph.traversal.algorithm.FusiformSimilarityTraverser, - org.apache.hugegraph.traversal.algorithm.HugeTraverser, - org.apache.hugegraph.traversal.algorithm.JaccardSimilarTraverser, - org.apache.hugegraph.traversal.algorithm.KneighborTraverser, - org.apache.hugegraph.traversal.algorithm.KoutTraverser, - org.apache.hugegraph.traversal.algorithm.MultiNodeShortestPathTraverser, - org.apache.hugegraph.traversal.algorithm.NeighborRankTraverser, - org.apache.hugegraph.traversal.algorithm.PathsTraverser, - org.apache.hugegraph.traversal.algorithm.PersonalRankTraverser, - org.apache.hugegraph.traversal.algorithm.SameNeighborTraverser, - org.apache.hugegraph.traversal.algorithm.ShortestPathTraverser, - org.apache.hugegraph.traversal.algorithm.SingleSourceShortestPathTraverser, - org.apache.hugegraph.traversal.algorithm.SubGraphTraverser, - org.apache.hugegraph.traversal.algorithm.TemplatePathsTraverser, - org.apache.hugegraph.traversal.algorithm.steps.EdgeStep, - org.apache.hugegraph.traversal.algorithm.steps.RepeatEdgeStep, - org.apache.hugegraph.traversal.algorithm.steps.WeightedEdgeStep, - org.apache.hugegraph.traversal.optimize.ConditionP, - org.apache.hugegraph.traversal.optimize.Text, - org.apache.hugegraph.traversal.optimize.TraversalUtil, - org.opencypher.gremlin.traversal.CustomFunctions, - org.opencypher.gremlin.traversal.CustomPredicate - ], - methodImports: [ - java.lang.Math#*, - org.opencypher.gremlin.traversal.CustomPredicate#*, - org.opencypher.gremlin.traversal.CustomFunctions#* - ] - }, - org.apache.tinkerpop.gremlin.jsr223.ScriptFileGremlinPlugin: { - files: [scripts/empty-sample.groovy] - } - } - } -} -serializers: - - {className: org.apache.tinkerpop.gremlin.driver.ser.GraphBinaryMessageSerializerV1, - config: { - serializeResultToString: false, - ioRegistries: [org.apache.hugegraph.io.HugeGraphIoRegistry] - } - } - - {className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV1d0, - config: { - serializeResultToString: false, - ioRegistries: [org.apache.hugegraph.io.HugeGraphIoRegistry] - } - } - - {className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV2d0, - config: { - serializeResultToString: false, - ioRegistries: [org.apache.hugegraph.io.HugeGraphIoRegistry] - } - } - - {className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV3d0, - config: { - serializeResultToString: false, - ioRegistries: [org.apache.hugegraph.io.HugeGraphIoRegistry] - } - } -metrics: { - consoleReporter: {enabled: false, interval: 180000}, - csvReporter: {enabled: false, interval: 180000, fileName: ./metrics/gremlin-server-metrics.csv}, - jmxReporter: {enabled: false}, - slf4jReporter: {enabled: false, interval: 180000}, - gangliaReporter: {enabled: false, interval: 180000, addressingMode: MULTICAST}, - graphiteReporter: {enabled: false, interval: 180000} -} -maxInitialLineLength: 4096 -maxHeaderSize: 8192 -maxChunkSize: 8192 -maxContentLength: 65536 -maxAccumulationBufferComponents: 1024 -resultIterationBatchSize: 64 -writeBufferLowWaterMark: 32768 -writeBufferHighWaterMark: 65536 -ssl: { - enabled: false -} diff --git a/hugegraph-it/hg-it-dist/src/assembly/static/multi/server/A/conf/hugegraph-server.keystore b/hugegraph-it/hg-it-dist/src/assembly/static/multi/server/A/conf/hugegraph-server.keystore deleted file mode 100644 index e60c6b4c4ca066e165da3d5d880d1d780fb976fa..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1733 zcmY+Ddpy$%AIG=fE(|Ga?rAuU*g9>lOK50Vh`IC}mng;DNp@z;ZSGOxoCwvnE-uGq zDvFJhdlwG}L!yr6l3Oi0E~QnE=XpKPdCvLc^ZLGCpU?OE`Rn_}v*8^87=mZR6W|EL zEXSD}sBL@KwiMv<|GiR>0|Q((a39YG_;>@j z-2d$Da!n}8dwGrI^Jeazr<}U>@X`FvaOUzL00DKmLD@j6-U}=!sw|0~-#YB(_U&lC z;2bWbKk3MH1SjB*xD{hl9zVztK2i@k`6_a{AsjrB_*RV-5p=s7em>x9dHui`?TStC zew}Gp>C>!?6P|Te@;$LGQQ@!!h8+yzSu0*0XVnWI?$fJP2^-eKF0Cx!V*U^-{v7&A zZA)dtgq1S4RU$X4xG}fPdshqkuFQ-5jQQqNzPxSM^!`N$P^S0`-_ zX(=iHHj(PsxSFVEf0maY!V~9bRul*qF&EgQVYVAJ2g33ytqjMa`v#g3W)e>XCt&8$ z9If&8^~q8hYo?*IcbyxxCP?xwDcKHGKu(6Dd-o;A^ri$)$$tD$r(Ao8=wH@58K(W_ z@_}~?6j58xVHV?g_CpdfR*5+Z$=PkI3-MhCL^TIVk3N15Er{zpuTJWsGzsHJ%Fru! z{o15CkKJtFt}OfYy)IMcnF?&wDVLp&W7H<-_kf#+s5fv6V^)xZ{ZCw1m}vp)HD)J$SzCL@+;WnBb& zyw0C5jzAGmdy$|J5FJDV1#K%9bQ%-`3i<1bG64ledWJ>@X%o!wrg)+m{*VdL%zT>% zlRtZ8;9NEYvu)`BV9@r^_b3!Eq#=y}Xp}6cncLNk)#myqh|?Uf zu#q_2Km9KKA=C@ZP+&<}b1Iu^JHhUU?UR|!$f-I^6W-~x5qUwla8u_tX*$ZoHT<&b3|1oa%&cIWheq1!vp7}vo&|KS@csHK&>Ce4GlhAG-Q1r zmnF8Bp{++bw3liV*ab;^waVWNQ;cbFZ9VA1Y)=RD7Lm^7r6NZm?O5cBk_7eT9(@ z#V+49ncJ&NBfmTO%vM3)>L&@ogFTk>U}`zLNH-nz>fD=Q|AZrYr&Ek8yxr5%1lJq$ zuMC8=D>7uEsuqvT5>#cyV1BMNg~w2vHB1buzv1(+;CD=JxXaDf`~hox#GZLq(_uo9 zrPofrOMz?k<-#fe_p&8jfMHP2SZt({*B$Grc^_|u%?x?dy@TIK@fTrtVsZ%qKVGz? zJ(&Vd#8Db?$uzt1l<{UG^LdhGlfFhen!o3hw%YK(kA|3QKO|X^MHcRGJK?XP)O(z- z^uo_Ssjc@571 diff --git a/hugegraph-it/hg-it-dist/src/assembly/static/multi/server/A/conf/log4j2.xml b/hugegraph-it/hg-it-dist/src/assembly/static/multi/server/A/conf/log4j2.xml deleted file mode 100644 index f1dd7e8395..0000000000 --- a/hugegraph-it/hg-it-dist/src/assembly/static/multi/server/A/conf/log4j2.xml +++ /dev/null @@ -1,144 +0,0 @@ - - - - - - logs - hugegraph-server - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/hugegraph-it/hg-it-dist/src/assembly/static/multi/server/A/conf/remote-objects.yaml b/hugegraph-it/hg-it-dist/src/assembly/static/multi/server/A/conf/remote-objects.yaml deleted file mode 100644 index 94ebc99190..0000000000 --- a/hugegraph-it/hg-it-dist/src/assembly/static/multi/server/A/conf/remote-objects.yaml +++ /dev/null @@ -1,30 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -hosts: [localhost] -port: 8181 -serializer: { - className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV1d0, - config: { - serializeResultToString: false, - # The duplication of HugeGraphIoRegistry is meant to fix a bug in the - # 'org.apache.tinkerpop.gremlin.driver.Settings:from(Configuration)' method. - ioRegistries: [ - org.apache.hugegraph.io.HugeGraphIoRegistry, - org.apache.hugegraph.io.HugeGraphIoRegistry - ] - } -} diff --git a/hugegraph-it/hg-it-dist/src/assembly/static/multi/server/A/conf/remote.yaml b/hugegraph-it/hg-it-dist/src/assembly/static/multi/server/A/conf/remote.yaml deleted file mode 100644 index 2f60ff8379..0000000000 --- a/hugegraph-it/hg-it-dist/src/assembly/static/multi/server/A/conf/remote.yaml +++ /dev/null @@ -1,25 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -hosts: [localhost] -port: 8181 -serializer: { - className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV1d0, - config: { - serializeResultToString: false, - ioRegistries: [org.apache.hugegraph.io.HugeGraphIoRegistry] - } -} diff --git a/hugegraph-it/hg-it-dist/src/assembly/static/multi/server/A/conf/rest-server.properties b/hugegraph-it/hg-it-dist/src/assembly/static/multi/server/A/conf/rest-server.properties deleted file mode 100644 index 305bdfa805..0000000000 --- a/hugegraph-it/hg-it-dist/src/assembly/static/multi/server/A/conf/rest-server.properties +++ /dev/null @@ -1,70 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -# bind url -restserver.url=http://127.0.0.1:8081 -# gremlin server url, need to be consistent with host and port in gremlin-server.yaml -gremlinserver.url=http://127.0.0.1:8181 - -graphs=./conf/graphs - -# The maximum thread ratio for batch writing, only take effect if the batch.max_write_threads is 0 -batch.max_write_ratio=80 -batch.max_write_threads=0 - -# configuration of arthas -arthas.telnet_port=8562 -arthas.http_port=8561 -arthas.ip=127.0.0.1 -arthas.disabled_commands=jad - -# authentication configs -# choose 'org.apache.hugegraph.auth.StandardAuthenticator' or -# 'org.apache.hugegraph.auth.ConfigAuthenticator' -#auth.authenticator= - -# for StandardAuthenticator mode -#auth.graph_store=hugegraph -# auth client config -#auth.remote_url=127.0.0.1:8899,127.0.0.1:8898,127.0.0.1:8897 - -# for ConfigAuthenticator mode -#auth.admin_token= -#auth.user_tokens=[] - -# rpc server configs for multi graph-servers or raft-servers -rpc.server_host=127.0.0.1 -rpc.server_port=8091 -#rpc.server_timeout=30 - -# rpc client configs (like enable to keep cache consistency) -#rpc.remote_url=127.0.0.1:8091,127.0.0.1:8092,127.0.0.1:8093 -#rpc.client_connect_timeout=20 -#rpc.client_reconnect_period=10 -#rpc.client_read_timeout=40 -#rpc.client_retries=3 -#rpc.client_load_balancer=consistentHash - -# raft group initial peers -#raft.group_peers=127.0.0.1:8091,127.0.0.1:8092,127.0.0.1:8093 - -# lightweight load balancing (beta) -server.id=server-1 -server.role=master - -# slow query log -log.slow_query_threshold=1000 diff --git a/hugegraph-it/hg-it-dist/src/assembly/static/multi/server/B/conf/computer.yaml b/hugegraph-it/hg-it-dist/src/assembly/static/multi/server/B/conf/computer.yaml deleted file mode 100644 index 1c69388bb0..0000000000 --- a/hugegraph-it/hg-it-dist/src/assembly/static/multi/server/B/conf/computer.yaml +++ /dev/null @@ -1,39 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# common parameters -common: { - worker_heap: 10000, - vertex_input_dir: /data, - workers: 51, - zookeeper_list: "127.0.0.1:2181", - max_edges_per_segment: 10485760, - edges_immutable: true, - partitions: 255, - compute_threads: 5, - input_threads: 5, - message_async: false, - message_queue_size: 1000, - message_send_threads: 10, - messages_per_segment: 104857600, - hugegraph_url: "http://127.0.0.1:8080", - hugegraph_name: hugegraph, - hugegraph_timeout: 60 -} - -env: { - computer_home: /home/computer -} diff --git a/hugegraph-it/hg-it-dist/src/assembly/static/multi/server/B/conf/graphs/hugegraph.properties b/hugegraph-it/hg-it-dist/src/assembly/static/multi/server/B/conf/graphs/hugegraph.properties deleted file mode 100644 index 02b2d43270..0000000000 --- a/hugegraph-it/hg-it-dist/src/assembly/static/multi/server/B/conf/graphs/hugegraph.properties +++ /dev/null @@ -1,126 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -# gremlin entrance to create graph -# auth config: org.apache.hugegraph.auth.HugeFactoryAuthProxy -gremlin.graph=org.apache.hugegraph.HugeFactory - -# cache config -#schema.cache_capacity=100000 -# vertex-cache default is 1000w, 10min expired -vertex.cache_type=l2 -#vertex.cache_capacity=10000000 -#vertex.cache_expire=600 -# edge-cache default is 100w, 10min expired -edge.cache_type=l2 -#edge.cache_capacity=1000000 -#edge.cache_expire=600 - - -# schema illegal name template -#schema.illegal_name_regex=\s+|~.* - -#vertex.default_label=vertex - -backend=hstore -serializer=binary - -store=hugegraph - -# pd config -pd.peers=127.0.0.1:8686,127.0.0.1:8687,127.0.0.1:8688 - -# task config -task.scheduler_type=local -task.schedule_period=10 -task.retry=0 -task.wait_timeout=10 - -# raft config -raft.mode=false -raft.path=./raft-log -raft.safe_read=true -raft.use_replicator_pipeline=true -raft.election_timeout=10000 -raft.snapshot_interval=3600 -raft.backend_threads=48 -raft.read_index_threads=8 -raft.snapshot_threads=4 -raft.snapshot_parallel_compress=false -raft.snapshot_compress_threads=4 -raft.snapshot_decompress_threads=4 -raft.read_strategy=ReadOnlyLeaseBased -raft.queue_size=16384 -raft.queue_publish_timeout=60 -raft.apply_batch=1 -raft.rpc_threads=80 -raft.rpc_connect_timeout=5000 -raft.rpc_timeout=60 -raft.install_snapshot_rpc_timeout=36000 - -# search config -search.text_analyzer=jieba -search.text_analyzer_mode=INDEX - -# rocksdb backend config -#rocksdb.data_path=/path/to/disk -#rocksdb.wal_path=/path/to/disk - - -# cassandra backend config -cassandra.host=localhost -cassandra.port=9042 -cassandra.username= -cassandra.password= -#cassandra.connect_timeout=5 -#cassandra.read_timeout=20 -#cassandra.keyspace.strategy=SimpleStrategy -#cassandra.keyspace.replication=3 - -# hbase backend config -#hbase.hosts=localhost -#hbase.port=2181 -#hbase.znode_parent=/hbase -#hbase.threads_max=64 -# IMPORTANT: recommend to modify the HBase partition number -# by the actual/env data amount & RS amount before init store -# It will influence the load speed a lot -#hbase.enable_partition=true -#hbase.vertex_partitions=10 -#hbase.edge_partitions=30 - -# mysql backend config -#jdbc.driver=com.mysql.jdbc.Driver -#jdbc.url=jdbc:mysql://127.0.0.1:3306 -#jdbc.username=root -#jdbc.password= -#jdbc.reconnect_max_times=3 -#jdbc.reconnect_interval=3 -#jdbc.ssl_mode=false - -# postgresql & cockroachdb backend config -#jdbc.driver=org.postgresql.Driver -#jdbc.url=jdbc:postgresql://localhost:5432/ -#jdbc.username=postgres -#jdbc.password= -#jdbc.postgresql.connect_database=template1 - -# palo backend config -#palo.host=127.0.0.1 -#palo.poll_interval=10 -#palo.temp_dir=./palo-data -#palo.file_limit_size=32 diff --git a/hugegraph-it/hg-it-dist/src/assembly/static/multi/server/B/conf/gremlin-driver-settings.yaml b/hugegraph-it/hg-it-dist/src/assembly/static/multi/server/B/conf/gremlin-driver-settings.yaml deleted file mode 100644 index 55f38ab97d..0000000000 --- a/hugegraph-it/hg-it-dist/src/assembly/static/multi/server/B/conf/gremlin-driver-settings.yaml +++ /dev/null @@ -1,25 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -hosts: [localhost] -port: 8182 -serializer: { - className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV1d0, - config: { - serializeResultToString: false, - ioRegistries: [org.apache.hugegraph.io.HugeGraphIoRegistry] - } -} diff --git a/hugegraph-it/hg-it-dist/src/assembly/static/multi/server/B/conf/gremlin-server.yaml b/hugegraph-it/hg-it-dist/src/assembly/static/multi/server/B/conf/gremlin-server.yaml deleted file mode 100644 index 048dded559..0000000000 --- a/hugegraph-it/hg-it-dist/src/assembly/static/multi/server/B/conf/gremlin-server.yaml +++ /dev/null @@ -1,127 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# host and port of gremlin server, need to be consistent with host and port in rest-server.properties -host: 127.0.0.1 -port: 8182 - -# timeout in ms of gremlin query -evaluationTimeout: 30000 - -channelizer: org.apache.tinkerpop.gremlin.server.channel.WsAndHttpChannelizer -# don't set graph at here, this happens after support for dynamically adding graph -graphs: { -} -scriptEngines: { - gremlin-groovy: { - staticImports: [ - org.opencypher.gremlin.process.traversal.CustomPredicates.*', - org.opencypher.gremlin.traversal.CustomFunctions.* - ], - plugins: { - org.apache.hugegraph.plugin.HugeGraphGremlinPlugin: {}, - org.apache.tinkerpop.gremlin.server.jsr223.GremlinServerGremlinPlugin: {}, - org.apache.tinkerpop.gremlin.jsr223.ImportGremlinPlugin: { - classImports: [ - java.lang.Math, - org.apache.hugegraph.backend.id.IdGenerator, - org.apache.hugegraph.type.define.Directions, - org.apache.hugegraph.type.define.NodeRole, - org.apache.hugegraph.masterelection.GlobalMasterInfo, - org.apache.hugegraph.util.DateUtil, - org.apache.hugegraph.traversal.algorithm.CollectionPathsTraverser, - org.apache.hugegraph.traversal.algorithm.CountTraverser, - org.apache.hugegraph.traversal.algorithm.CustomizedCrosspointsTraverser, - org.apache.hugegraph.traversal.algorithm.CustomizePathsTraverser, - org.apache.hugegraph.traversal.algorithm.FusiformSimilarityTraverser, - org.apache.hugegraph.traversal.algorithm.HugeTraverser, - org.apache.hugegraph.traversal.algorithm.JaccardSimilarTraverser, - org.apache.hugegraph.traversal.algorithm.KneighborTraverser, - org.apache.hugegraph.traversal.algorithm.KoutTraverser, - org.apache.hugegraph.traversal.algorithm.MultiNodeShortestPathTraverser, - org.apache.hugegraph.traversal.algorithm.NeighborRankTraverser, - org.apache.hugegraph.traversal.algorithm.PathsTraverser, - org.apache.hugegraph.traversal.algorithm.PersonalRankTraverser, - org.apache.hugegraph.traversal.algorithm.SameNeighborTraverser, - org.apache.hugegraph.traversal.algorithm.ShortestPathTraverser, - org.apache.hugegraph.traversal.algorithm.SingleSourceShortestPathTraverser, - org.apache.hugegraph.traversal.algorithm.SubGraphTraverser, - org.apache.hugegraph.traversal.algorithm.TemplatePathsTraverser, - org.apache.hugegraph.traversal.algorithm.steps.EdgeStep, - org.apache.hugegraph.traversal.algorithm.steps.RepeatEdgeStep, - org.apache.hugegraph.traversal.algorithm.steps.WeightedEdgeStep, - org.apache.hugegraph.traversal.optimize.ConditionP, - org.apache.hugegraph.traversal.optimize.Text, - org.apache.hugegraph.traversal.optimize.TraversalUtil, - org.opencypher.gremlin.traversal.CustomFunctions, - org.opencypher.gremlin.traversal.CustomPredicate - ], - methodImports: [ - java.lang.Math#*, - org.opencypher.gremlin.traversal.CustomPredicate#*, - org.opencypher.gremlin.traversal.CustomFunctions#* - ] - }, - org.apache.tinkerpop.gremlin.jsr223.ScriptFileGremlinPlugin: { - files: [scripts/empty-sample.groovy] - } - } - } -} -serializers: - - {className: org.apache.tinkerpop.gremlin.driver.ser.GraphBinaryMessageSerializerV1, - config: { - serializeResultToString: false, - ioRegistries: [org.apache.hugegraph.io.HugeGraphIoRegistry] - } - } - - {className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV1d0, - config: { - serializeResultToString: false, - ioRegistries: [org.apache.hugegraph.io.HugeGraphIoRegistry] - } - } - - {className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV2d0, - config: { - serializeResultToString: false, - ioRegistries: [org.apache.hugegraph.io.HugeGraphIoRegistry] - } - } - - {className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV3d0, - config: { - serializeResultToString: false, - ioRegistries: [org.apache.hugegraph.io.HugeGraphIoRegistry] - } - } -metrics: { - consoleReporter: {enabled: false, interval: 180000}, - csvReporter: {enabled: false, interval: 180000, fileName: ./metrics/gremlin-server-metrics.csv}, - jmxReporter: {enabled: false}, - slf4jReporter: {enabled: false, interval: 180000}, - gangliaReporter: {enabled: false, interval: 180000, addressingMode: MULTICAST}, - graphiteReporter: {enabled: false, interval: 180000} -} -maxInitialLineLength: 4096 -maxHeaderSize: 8192 -maxChunkSize: 8192 -maxContentLength: 65536 -maxAccumulationBufferComponents: 1024 -resultIterationBatchSize: 64 -writeBufferLowWaterMark: 32768 -writeBufferHighWaterMark: 65536 -ssl: { - enabled: false -} diff --git a/hugegraph-it/hg-it-dist/src/assembly/static/multi/server/B/conf/hugegraph-server.keystore b/hugegraph-it/hg-it-dist/src/assembly/static/multi/server/B/conf/hugegraph-server.keystore deleted file mode 100644 index e60c6b4c4ca066e165da3d5d880d1d780fb976fa..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1733 zcmY+Ddpy$%AIG=fE(|Ga?rAuU*g9>lOK50Vh`IC}mng;DNp@z;ZSGOxoCwvnE-uGq zDvFJhdlwG}L!yr6l3Oi0E~QnE=XpKPdCvLc^ZLGCpU?OE`Rn_}v*8^87=mZR6W|EL zEXSD}sBL@KwiMv<|GiR>0|Q((a39YG_;>@j z-2d$Da!n}8dwGrI^Jeazr<}U>@X`FvaOUzL00DKmLD@j6-U}=!sw|0~-#YB(_U&lC z;2bWbKk3MH1SjB*xD{hl9zVztK2i@k`6_a{AsjrB_*RV-5p=s7em>x9dHui`?TStC zew}Gp>C>!?6P|Te@;$LGQQ@!!h8+yzSu0*0XVnWI?$fJP2^-eKF0Cx!V*U^-{v7&A zZA)dtgq1S4RU$X4xG}fPdshqkuFQ-5jQQqNzPxSM^!`N$P^S0`-_ zX(=iHHj(PsxSFVEf0maY!V~9bRul*qF&EgQVYVAJ2g33ytqjMa`v#g3W)e>XCt&8$ z9If&8^~q8hYo?*IcbyxxCP?xwDcKHGKu(6Dd-o;A^ri$)$$tD$r(Ao8=wH@58K(W_ z@_}~?6j58xVHV?g_CpdfR*5+Z$=PkI3-MhCL^TIVk3N15Er{zpuTJWsGzsHJ%Fru! z{o15CkKJtFt}OfYy)IMcnF?&wDVLp&W7H<-_kf#+s5fv6V^)xZ{ZCw1m}vp)HD)J$SzCL@+;WnBb& zyw0C5jzAGmdy$|J5FJDV1#K%9bQ%-`3i<1bG64ledWJ>@X%o!wrg)+m{*VdL%zT>% zlRtZ8;9NEYvu)`BV9@r^_b3!Eq#=y}Xp}6cncLNk)#myqh|?Uf zu#q_2Km9KKA=C@ZP+&<}b1Iu^JHhUU?UR|!$f-I^6W-~x5qUwla8u_tX*$ZoHT<&b3|1oa%&cIWheq1!vp7}vo&|KS@csHK&>Ce4GlhAG-Q1r zmnF8Bp{++bw3liV*ab;^waVWNQ;cbFZ9VA1Y)=RD7Lm^7r6NZm?O5cBk_7eT9(@ z#V+49ncJ&NBfmTO%vM3)>L&@ogFTk>U}`zLNH-nz>fD=Q|AZrYr&Ek8yxr5%1lJq$ zuMC8=D>7uEsuqvT5>#cyV1BMNg~w2vHB1buzv1(+;CD=JxXaDf`~hox#GZLq(_uo9 zrPofrOMz?k<-#fe_p&8jfMHP2SZt({*B$Grc^_|u%?x?dy@TIK@fTrtVsZ%qKVGz? zJ(&Vd#8Db?$uzt1l<{UG^LdhGlfFhen!o3hw%YK(kA|3QKO|X^MHcRGJK?XP)O(z- z^uo_Ssjc@571 diff --git a/hugegraph-it/hg-it-dist/src/assembly/static/multi/server/B/conf/log4j2.xml b/hugegraph-it/hg-it-dist/src/assembly/static/multi/server/B/conf/log4j2.xml deleted file mode 100644 index f1dd7e8395..0000000000 --- a/hugegraph-it/hg-it-dist/src/assembly/static/multi/server/B/conf/log4j2.xml +++ /dev/null @@ -1,144 +0,0 @@ - - - - - - logs - hugegraph-server - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/hugegraph-it/hg-it-dist/src/assembly/static/multi/server/B/conf/remote-objects.yaml b/hugegraph-it/hg-it-dist/src/assembly/static/multi/server/B/conf/remote-objects.yaml deleted file mode 100644 index 39679d8c30..0000000000 --- a/hugegraph-it/hg-it-dist/src/assembly/static/multi/server/B/conf/remote-objects.yaml +++ /dev/null @@ -1,30 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -hosts: [localhost] -port: 8182 -serializer: { - className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV1d0, - config: { - serializeResultToString: false, - # The duplication of HugeGraphIoRegistry is meant to fix a bug in the - # 'org.apache.tinkerpop.gremlin.driver.Settings:from(Configuration)' method. - ioRegistries: [ - org.apache.hugegraph.io.HugeGraphIoRegistry, - org.apache.hugegraph.io.HugeGraphIoRegistry - ] - } -} diff --git a/hugegraph-it/hg-it-dist/src/assembly/static/multi/server/B/conf/remote.yaml b/hugegraph-it/hg-it-dist/src/assembly/static/multi/server/B/conf/remote.yaml deleted file mode 100644 index 55f38ab97d..0000000000 --- a/hugegraph-it/hg-it-dist/src/assembly/static/multi/server/B/conf/remote.yaml +++ /dev/null @@ -1,25 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -hosts: [localhost] -port: 8182 -serializer: { - className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV1d0, - config: { - serializeResultToString: false, - ioRegistries: [org.apache.hugegraph.io.HugeGraphIoRegistry] - } -} diff --git a/hugegraph-it/hg-it-dist/src/assembly/static/multi/server/B/conf/rest-server.properties b/hugegraph-it/hg-it-dist/src/assembly/static/multi/server/B/conf/rest-server.properties deleted file mode 100644 index ee4fcd6db5..0000000000 --- a/hugegraph-it/hg-it-dist/src/assembly/static/multi/server/B/conf/rest-server.properties +++ /dev/null @@ -1,70 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -# bind url -restserver.url=http://127.0.0.1:8082 -# gremlin server url, need to be consistent with host and port in gremlin-server.yaml -gremlinserver.url=http://127.0.0.1:8182 - -graphs=./conf/graphs - -# The maximum thread ratio for batch writing, only take effect if the batch.max_write_threads is 0 -batch.max_write_ratio=80 -batch.max_write_threads=0 - -# configuration of arthas -arthas.telnet_port=8572 -arthas.http_port=8571 -arthas.ip=127.0.0.1 -arthas.disabled_commands=jad - -# authentication configs -# choose 'org.apache.hugegraph.auth.StandardAuthenticator' or -# 'org.apache.hugegraph.auth.ConfigAuthenticator' -#auth.authenticator= - -# for StandardAuthenticator mode -#auth.graph_store=hugegraph -# auth client config -#auth.remote_url=127.0.0.1:8899,127.0.0.1:8898,127.0.0.1:8897 - -# for ConfigAuthenticator mode -#auth.admin_token= -#auth.user_tokens=[] - -# rpc server configs for multi graph-servers or raft-servers -rpc.server_host=127.0.0.1 -rpc.server_port=8092 -#rpc.server_timeout=30 - -# rpc client configs (like enable to keep cache consistency) -#rpc.remote_url=127.0.0.1:8091,127.0.0.1:8092,127.0.0.1:8093 -#rpc.client_connect_timeout=20 -#rpc.client_reconnect_period=10 -#rpc.client_read_timeout=40 -#rpc.client_retries=3 -#rpc.client_load_balancer=consistentHash - -# raft group initial peers -#raft.group_peers=127.0.0.1:8091,127.0.0.1:8092,127.0.0.1:8093 - -# lightweight load balancing (beta) -server.id=server-2 -server.role=worker - -# slow query log -log.slow_query_threshold=1000 diff --git a/hugegraph-it/hg-it-dist/src/assembly/static/multi/server/C/conf/computer.yaml b/hugegraph-it/hg-it-dist/src/assembly/static/multi/server/C/conf/computer.yaml deleted file mode 100644 index 1c69388bb0..0000000000 --- a/hugegraph-it/hg-it-dist/src/assembly/static/multi/server/C/conf/computer.yaml +++ /dev/null @@ -1,39 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# common parameters -common: { - worker_heap: 10000, - vertex_input_dir: /data, - workers: 51, - zookeeper_list: "127.0.0.1:2181", - max_edges_per_segment: 10485760, - edges_immutable: true, - partitions: 255, - compute_threads: 5, - input_threads: 5, - message_async: false, - message_queue_size: 1000, - message_send_threads: 10, - messages_per_segment: 104857600, - hugegraph_url: "http://127.0.0.1:8080", - hugegraph_name: hugegraph, - hugegraph_timeout: 60 -} - -env: { - computer_home: /home/computer -} diff --git a/hugegraph-it/hg-it-dist/src/assembly/static/multi/server/C/conf/graphs/hugegraph.properties b/hugegraph-it/hg-it-dist/src/assembly/static/multi/server/C/conf/graphs/hugegraph.properties deleted file mode 100644 index 02b2d43270..0000000000 --- a/hugegraph-it/hg-it-dist/src/assembly/static/multi/server/C/conf/graphs/hugegraph.properties +++ /dev/null @@ -1,126 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -# gremlin entrance to create graph -# auth config: org.apache.hugegraph.auth.HugeFactoryAuthProxy -gremlin.graph=org.apache.hugegraph.HugeFactory - -# cache config -#schema.cache_capacity=100000 -# vertex-cache default is 1000w, 10min expired -vertex.cache_type=l2 -#vertex.cache_capacity=10000000 -#vertex.cache_expire=600 -# edge-cache default is 100w, 10min expired -edge.cache_type=l2 -#edge.cache_capacity=1000000 -#edge.cache_expire=600 - - -# schema illegal name template -#schema.illegal_name_regex=\s+|~.* - -#vertex.default_label=vertex - -backend=hstore -serializer=binary - -store=hugegraph - -# pd config -pd.peers=127.0.0.1:8686,127.0.0.1:8687,127.0.0.1:8688 - -# task config -task.scheduler_type=local -task.schedule_period=10 -task.retry=0 -task.wait_timeout=10 - -# raft config -raft.mode=false -raft.path=./raft-log -raft.safe_read=true -raft.use_replicator_pipeline=true -raft.election_timeout=10000 -raft.snapshot_interval=3600 -raft.backend_threads=48 -raft.read_index_threads=8 -raft.snapshot_threads=4 -raft.snapshot_parallel_compress=false -raft.snapshot_compress_threads=4 -raft.snapshot_decompress_threads=4 -raft.read_strategy=ReadOnlyLeaseBased -raft.queue_size=16384 -raft.queue_publish_timeout=60 -raft.apply_batch=1 -raft.rpc_threads=80 -raft.rpc_connect_timeout=5000 -raft.rpc_timeout=60 -raft.install_snapshot_rpc_timeout=36000 - -# search config -search.text_analyzer=jieba -search.text_analyzer_mode=INDEX - -# rocksdb backend config -#rocksdb.data_path=/path/to/disk -#rocksdb.wal_path=/path/to/disk - - -# cassandra backend config -cassandra.host=localhost -cassandra.port=9042 -cassandra.username= -cassandra.password= -#cassandra.connect_timeout=5 -#cassandra.read_timeout=20 -#cassandra.keyspace.strategy=SimpleStrategy -#cassandra.keyspace.replication=3 - -# hbase backend config -#hbase.hosts=localhost -#hbase.port=2181 -#hbase.znode_parent=/hbase -#hbase.threads_max=64 -# IMPORTANT: recommend to modify the HBase partition number -# by the actual/env data amount & RS amount before init store -# It will influence the load speed a lot -#hbase.enable_partition=true -#hbase.vertex_partitions=10 -#hbase.edge_partitions=30 - -# mysql backend config -#jdbc.driver=com.mysql.jdbc.Driver -#jdbc.url=jdbc:mysql://127.0.0.1:3306 -#jdbc.username=root -#jdbc.password= -#jdbc.reconnect_max_times=3 -#jdbc.reconnect_interval=3 -#jdbc.ssl_mode=false - -# postgresql & cockroachdb backend config -#jdbc.driver=org.postgresql.Driver -#jdbc.url=jdbc:postgresql://localhost:5432/ -#jdbc.username=postgres -#jdbc.password= -#jdbc.postgresql.connect_database=template1 - -# palo backend config -#palo.host=127.0.0.1 -#palo.poll_interval=10 -#palo.temp_dir=./palo-data -#palo.file_limit_size=32 diff --git a/hugegraph-it/hg-it-dist/src/assembly/static/multi/server/C/conf/gremlin-driver-settings.yaml b/hugegraph-it/hg-it-dist/src/assembly/static/multi/server/C/conf/gremlin-driver-settings.yaml deleted file mode 100644 index 00ef046699..0000000000 --- a/hugegraph-it/hg-it-dist/src/assembly/static/multi/server/C/conf/gremlin-driver-settings.yaml +++ /dev/null @@ -1,25 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -hosts: [localhost] -port: 8183 -serializer: { - className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV1d0, - config: { - serializeResultToString: false, - ioRegistries: [org.apache.hugegraph.io.HugeGraphIoRegistry] - } -} diff --git a/hugegraph-it/hg-it-dist/src/assembly/static/multi/server/C/conf/gremlin-server.yaml b/hugegraph-it/hg-it-dist/src/assembly/static/multi/server/C/conf/gremlin-server.yaml deleted file mode 100644 index e153926bc9..0000000000 --- a/hugegraph-it/hg-it-dist/src/assembly/static/multi/server/C/conf/gremlin-server.yaml +++ /dev/null @@ -1,127 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# host and port of gremlin server, need to be consistent with host and port in rest-server.properties -host: 127.0.0.1 -port: 8183 - -# timeout in ms of gremlin query -evaluationTimeout: 30000 - -channelizer: org.apache.tinkerpop.gremlin.server.channel.WsAndHttpChannelizer -# don't set graph at here, this happens after support for dynamically adding graph -graphs: { -} -scriptEngines: { - gremlin-groovy: { - staticImports: [ - org.opencypher.gremlin.process.traversal.CustomPredicates.*', - org.opencypher.gremlin.traversal.CustomFunctions.* - ], - plugins: { - org.apache.hugegraph.plugin.HugeGraphGremlinPlugin: {}, - org.apache.tinkerpop.gremlin.server.jsr223.GremlinServerGremlinPlugin: {}, - org.apache.tinkerpop.gremlin.jsr223.ImportGremlinPlugin: { - classImports: [ - java.lang.Math, - org.apache.hugegraph.backend.id.IdGenerator, - org.apache.hugegraph.type.define.Directions, - org.apache.hugegraph.type.define.NodeRole, - org.apache.hugegraph.masterelection.GlobalMasterInfo, - org.apache.hugegraph.util.DateUtil, - org.apache.hugegraph.traversal.algorithm.CollectionPathsTraverser, - org.apache.hugegraph.traversal.algorithm.CountTraverser, - org.apache.hugegraph.traversal.algorithm.CustomizedCrosspointsTraverser, - org.apache.hugegraph.traversal.algorithm.CustomizePathsTraverser, - org.apache.hugegraph.traversal.algorithm.FusiformSimilarityTraverser, - org.apache.hugegraph.traversal.algorithm.HugeTraverser, - org.apache.hugegraph.traversal.algorithm.JaccardSimilarTraverser, - org.apache.hugegraph.traversal.algorithm.KneighborTraverser, - org.apache.hugegraph.traversal.algorithm.KoutTraverser, - org.apache.hugegraph.traversal.algorithm.MultiNodeShortestPathTraverser, - org.apache.hugegraph.traversal.algorithm.NeighborRankTraverser, - org.apache.hugegraph.traversal.algorithm.PathsTraverser, - org.apache.hugegraph.traversal.algorithm.PersonalRankTraverser, - org.apache.hugegraph.traversal.algorithm.SameNeighborTraverser, - org.apache.hugegraph.traversal.algorithm.ShortestPathTraverser, - org.apache.hugegraph.traversal.algorithm.SingleSourceShortestPathTraverser, - org.apache.hugegraph.traversal.algorithm.SubGraphTraverser, - org.apache.hugegraph.traversal.algorithm.TemplatePathsTraverser, - org.apache.hugegraph.traversal.algorithm.steps.EdgeStep, - org.apache.hugegraph.traversal.algorithm.steps.RepeatEdgeStep, - org.apache.hugegraph.traversal.algorithm.steps.WeightedEdgeStep, - org.apache.hugegraph.traversal.optimize.ConditionP, - org.apache.hugegraph.traversal.optimize.Text, - org.apache.hugegraph.traversal.optimize.TraversalUtil, - org.opencypher.gremlin.traversal.CustomFunctions, - org.opencypher.gremlin.traversal.CustomPredicate - ], - methodImports: [ - java.lang.Math#*, - org.opencypher.gremlin.traversal.CustomPredicate#*, - org.opencypher.gremlin.traversal.CustomFunctions#* - ] - }, - org.apache.tinkerpop.gremlin.jsr223.ScriptFileGremlinPlugin: { - files: [scripts/empty-sample.groovy] - } - } - } -} -serializers: - - {className: org.apache.tinkerpop.gremlin.driver.ser.GraphBinaryMessageSerializerV1, - config: { - serializeResultToString: false, - ioRegistries: [org.apache.hugegraph.io.HugeGraphIoRegistry] - } - } - - {className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV1d0, - config: { - serializeResultToString: false, - ioRegistries: [org.apache.hugegraph.io.HugeGraphIoRegistry] - } - } - - {className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV2d0, - config: { - serializeResultToString: false, - ioRegistries: [org.apache.hugegraph.io.HugeGraphIoRegistry] - } - } - - {className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV3d0, - config: { - serializeResultToString: false, - ioRegistries: [org.apache.hugegraph.io.HugeGraphIoRegistry] - } - } -metrics: { - consoleReporter: {enabled: false, interval: 180000}, - csvReporter: {enabled: false, interval: 180000, fileName: ./metrics/gremlin-server-metrics.csv}, - jmxReporter: {enabled: false}, - slf4jReporter: {enabled: false, interval: 180000}, - gangliaReporter: {enabled: false, interval: 180000, addressingMode: MULTICAST}, - graphiteReporter: {enabled: false, interval: 180000} -} -maxInitialLineLength: 4096 -maxHeaderSize: 8192 -maxChunkSize: 8192 -maxContentLength: 65536 -maxAccumulationBufferComponents: 1024 -resultIterationBatchSize: 64 -writeBufferLowWaterMark: 32768 -writeBufferHighWaterMark: 65536 -ssl: { - enabled: false -} diff --git a/hugegraph-it/hg-it-dist/src/assembly/static/multi/server/C/conf/hugegraph-server.keystore b/hugegraph-it/hg-it-dist/src/assembly/static/multi/server/C/conf/hugegraph-server.keystore deleted file mode 100644 index e60c6b4c4ca066e165da3d5d880d1d780fb976fa..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1733 zcmY+Ddpy$%AIG=fE(|Ga?rAuU*g9>lOK50Vh`IC}mng;DNp@z;ZSGOxoCwvnE-uGq zDvFJhdlwG}L!yr6l3Oi0E~QnE=XpKPdCvLc^ZLGCpU?OE`Rn_}v*8^87=mZR6W|EL zEXSD}sBL@KwiMv<|GiR>0|Q((a39YG_;>@j z-2d$Da!n}8dwGrI^Jeazr<}U>@X`FvaOUzL00DKmLD@j6-U}=!sw|0~-#YB(_U&lC z;2bWbKk3MH1SjB*xD{hl9zVztK2i@k`6_a{AsjrB_*RV-5p=s7em>x9dHui`?TStC zew}Gp>C>!?6P|Te@;$LGQQ@!!h8+yzSu0*0XVnWI?$fJP2^-eKF0Cx!V*U^-{v7&A zZA)dtgq1S4RU$X4xG}fPdshqkuFQ-5jQQqNzPxSM^!`N$P^S0`-_ zX(=iHHj(PsxSFVEf0maY!V~9bRul*qF&EgQVYVAJ2g33ytqjMa`v#g3W)e>XCt&8$ z9If&8^~q8hYo?*IcbyxxCP?xwDcKHGKu(6Dd-o;A^ri$)$$tD$r(Ao8=wH@58K(W_ z@_}~?6j58xVHV?g_CpdfR*5+Z$=PkI3-MhCL^TIVk3N15Er{zpuTJWsGzsHJ%Fru! z{o15CkKJtFt}OfYy)IMcnF?&wDVLp&W7H<-_kf#+s5fv6V^)xZ{ZCw1m}vp)HD)J$SzCL@+;WnBb& zyw0C5jzAGmdy$|J5FJDV1#K%9bQ%-`3i<1bG64ledWJ>@X%o!wrg)+m{*VdL%zT>% zlRtZ8;9NEYvu)`BV9@r^_b3!Eq#=y}Xp}6cncLNk)#myqh|?Uf zu#q_2Km9KKA=C@ZP+&<}b1Iu^JHhUU?UR|!$f-I^6W-~x5qUwla8u_tX*$ZoHT<&b3|1oa%&cIWheq1!vp7}vo&|KS@csHK&>Ce4GlhAG-Q1r zmnF8Bp{++bw3liV*ab;^waVWNQ;cbFZ9VA1Y)=RD7Lm^7r6NZm?O5cBk_7eT9(@ z#V+49ncJ&NBfmTO%vM3)>L&@ogFTk>U}`zLNH-nz>fD=Q|AZrYr&Ek8yxr5%1lJq$ zuMC8=D>7uEsuqvT5>#cyV1BMNg~w2vHB1buzv1(+;CD=JxXaDf`~hox#GZLq(_uo9 zrPofrOMz?k<-#fe_p&8jfMHP2SZt({*B$Grc^_|u%?x?dy@TIK@fTrtVsZ%qKVGz? zJ(&Vd#8Db?$uzt1l<{UG^LdhGlfFhen!o3hw%YK(kA|3QKO|X^MHcRGJK?XP)O(z- z^uo_Ssjc@571 diff --git a/hugegraph-it/hg-it-dist/src/assembly/static/multi/server/C/conf/log4j2.xml b/hugegraph-it/hg-it-dist/src/assembly/static/multi/server/C/conf/log4j2.xml deleted file mode 100644 index f1dd7e8395..0000000000 --- a/hugegraph-it/hg-it-dist/src/assembly/static/multi/server/C/conf/log4j2.xml +++ /dev/null @@ -1,144 +0,0 @@ - - - - - - logs - hugegraph-server - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/hugegraph-it/hg-it-dist/src/assembly/static/multi/server/C/conf/remote-objects.yaml b/hugegraph-it/hg-it-dist/src/assembly/static/multi/server/C/conf/remote-objects.yaml deleted file mode 100644 index ce99fcb2f6..0000000000 --- a/hugegraph-it/hg-it-dist/src/assembly/static/multi/server/C/conf/remote-objects.yaml +++ /dev/null @@ -1,30 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -hosts: [localhost] -port: 8183 -serializer: { - className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV1d0, - config: { - serializeResultToString: false, - # The duplication of HugeGraphIoRegistry is meant to fix a bug in the - # 'org.apache.tinkerpop.gremlin.driver.Settings:from(Configuration)' method. - ioRegistries: [ - org.apache.hugegraph.io.HugeGraphIoRegistry, - org.apache.hugegraph.io.HugeGraphIoRegistry - ] - } -} diff --git a/hugegraph-it/hg-it-dist/src/assembly/static/multi/server/C/conf/remote.yaml b/hugegraph-it/hg-it-dist/src/assembly/static/multi/server/C/conf/remote.yaml deleted file mode 100644 index 00ef046699..0000000000 --- a/hugegraph-it/hg-it-dist/src/assembly/static/multi/server/C/conf/remote.yaml +++ /dev/null @@ -1,25 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -hosts: [localhost] -port: 8183 -serializer: { - className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV1d0, - config: { - serializeResultToString: false, - ioRegistries: [org.apache.hugegraph.io.HugeGraphIoRegistry] - } -} diff --git a/hugegraph-it/hg-it-dist/src/assembly/static/multi/server/C/conf/rest-server.properties b/hugegraph-it/hg-it-dist/src/assembly/static/multi/server/C/conf/rest-server.properties deleted file mode 100644 index 962065bfa4..0000000000 --- a/hugegraph-it/hg-it-dist/src/assembly/static/multi/server/C/conf/rest-server.properties +++ /dev/null @@ -1,70 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -# bind url -restserver.url=http://127.0.0.1:8083 -# gremlin server url, need to be consistent with host and port in gremlin-server.yaml -gremlinserver.url=http://127.0.0.1:8183 - -graphs=./conf/graphs - -# The maximum thread ratio for batch writing, only take effect if the batch.max_write_threads is 0 -batch.max_write_ratio=80 -batch.max_write_threads=0 - -# configuration of arthas -arthas.telnet_port=8582 -arthas.http_port=8581 -arthas.ip=127.0.0.1 -arthas.disabled_commands=jad - -# authentication configs -# choose 'org.apache.hugegraph.auth.StandardAuthenticator' or -# 'org.apache.hugegraph.auth.ConfigAuthenticator' -#auth.authenticator= - -# for StandardAuthenticator mode -#auth.graph_store=hugegraph -# auth client config -#auth.remote_url=127.0.0.1:8899,127.0.0.1:8898,127.0.0.1:8897 - -# for ConfigAuthenticator mode -#auth.admin_token= -#auth.user_tokens=[] - -# rpc server configs for multi graph-servers or raft-servers -rpc.server_host=127.0.0.1 -rpc.server_port=8093 -#rpc.server_timeout=30 - -# rpc client configs (like enable to keep cache consistency) -#rpc.remote_url=127.0.0.1:8091,127.0.0.1:8092,127.0.0.1:8093 -#rpc.client_connect_timeout=20 -#rpc.client_reconnect_period=10 -#rpc.client_read_timeout=40 -#rpc.client_retries=3 -#rpc.client_load_balancer=consistentHash - -# raft group initial peers -#raft.group_peers=127.0.0.1:8091,127.0.0.1:8092,127.0.0.1:8093 - -# lightweight load balancing (beta) -server.id=server-3 -server.role=worker - -# slow query log -log.slow_query_threshold=1000 diff --git a/hugegraph-it/hg-it-dist/src/assembly/static/multi/store/A/conf/application-pd.yml b/hugegraph-it/hg-it-dist/src/assembly/static/multi/store/A/conf/application-pd.yml deleted file mode 100644 index df535953fc..0000000000 --- a/hugegraph-it/hg-it-dist/src/assembly/static/multi/store/A/conf/application-pd.yml +++ /dev/null @@ -1,34 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -management: - metrics: - export: - prometheus: - enabled: true - endpoints: - web: - exposure: - include: "*" - -rocksdb: - # rocksdb 使用的总内存大小,达到该值强制写盘 - total_memory_size: 32000000000 - # rocksdb 使用的 memtable 大小 - write_buffer_size: 32000000 - # 对于每个 rocksdb 来说,memtable 个数达到该值进行写盘 - min_write_buffer_number_to_merge: 16 diff --git a/hugegraph-it/hg-it-dist/src/assembly/static/multi/store/A/conf/application.yml b/hugegraph-it/hg-it-dist/src/assembly/static/multi/store/A/conf/application.yml deleted file mode 100644 index 75b743c2a3..0000000000 --- a/hugegraph-it/hg-it-dist/src/assembly/static/multi/store/A/conf/application.yml +++ /dev/null @@ -1,64 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -pdserver: - # pd 服务地址,多个 pd 地址用逗号分割 - address: 127.0.0.1:8686,127.0.0.1:8687,127.0.0.1:8688 - -management: - metrics: - export: - prometheus: - enabled: true - endpoints: - web: - exposure: - include: "*" - -grpc: - # grpc 的服务地址 - host: 127.0.0.1 - port: 8500 - netty-server: - max-inbound-message-size: 1000MB -raft: - # raft 缓存队列大小 - disruptorBufferSize: 1024 - address: 127.0.0.1:8510 - max-log-file-size: 600000000000 - # 快照生成时间间隔,单位秒 - snapshotInterval: 1800 -server: - # rest 服务地址 - port: 8520 - -app: - # 存储路径,支持多个路径,逗号分割 - data-path: ./storage - #raft-path: ./storage - -spring: - application: - name: store-node-grpc-server - profiles: - active: default - include: pd - -logging: - config: 'file:./conf/log4j2.xml' - level: - root: info diff --git a/hugegraph-it/hg-it-dist/src/assembly/static/multi/store/A/conf/log4j2.xml b/hugegraph-it/hg-it-dist/src/assembly/static/multi/store/A/conf/log4j2.xml deleted file mode 100644 index 9dbaa7e89d..0000000000 --- a/hugegraph-it/hg-it-dist/src/assembly/static/multi/store/A/conf/log4j2.xml +++ /dev/null @@ -1,137 +0,0 @@ - - - - - - - - logs - hugegraph-store - raft-hugegraph-store - audit-hugegraph-store - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/hugegraph-it/hg-it-dist/src/assembly/static/multi/store/B/conf/application-pd.yml b/hugegraph-it/hg-it-dist/src/assembly/static/multi/store/B/conf/application-pd.yml deleted file mode 100644 index df535953fc..0000000000 --- a/hugegraph-it/hg-it-dist/src/assembly/static/multi/store/B/conf/application-pd.yml +++ /dev/null @@ -1,34 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -management: - metrics: - export: - prometheus: - enabled: true - endpoints: - web: - exposure: - include: "*" - -rocksdb: - # rocksdb 使用的总内存大小,达到该值强制写盘 - total_memory_size: 32000000000 - # rocksdb 使用的 memtable 大小 - write_buffer_size: 32000000 - # 对于每个 rocksdb 来说,memtable 个数达到该值进行写盘 - min_write_buffer_number_to_merge: 16 diff --git a/hugegraph-it/hg-it-dist/src/assembly/static/multi/store/B/conf/application.yml b/hugegraph-it/hg-it-dist/src/assembly/static/multi/store/B/conf/application.yml deleted file mode 100644 index e4b2824ff9..0000000000 --- a/hugegraph-it/hg-it-dist/src/assembly/static/multi/store/B/conf/application.yml +++ /dev/null @@ -1,64 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -pdserver: - # pd 服务地址,多个 pd 地址用逗号分割 - address: 127.0.0.1:8686,127.0.0.1:8687,127.0.0.1:8688 - -management: - metrics: - export: - prometheus: - enabled: true - endpoints: - web: - exposure: - include: "*" - -grpc: - # grpc 的服务地址 - host: 127.0.0.1 - port: 8501 - netty-server: - max-inbound-message-size: 1000MB -raft: - # raft 缓存队列大小 - disruptorBufferSize: 1024 - address: 127.0.0.1:8511 - max-log-file-size: 600000000000 - # 快照生成时间间隔,单位秒 - snapshotInterval: 1800 -server: - # rest 服务地址 - port: 8521 - -app: - # 存储路径,支持多个路径,逗号分割 - data-path: ./storage - #raft-path: ./storage - -spring: - application: - name: store-node-grpc-server - profiles: - active: default - include: pd - -logging: - config: 'file:./conf/log4j2.xml' - level: - root: info diff --git a/hugegraph-it/hg-it-dist/src/assembly/static/multi/store/B/conf/log4j2.xml b/hugegraph-it/hg-it-dist/src/assembly/static/multi/store/B/conf/log4j2.xml deleted file mode 100644 index 9dbaa7e89d..0000000000 --- a/hugegraph-it/hg-it-dist/src/assembly/static/multi/store/B/conf/log4j2.xml +++ /dev/null @@ -1,137 +0,0 @@ - - - - - - - - logs - hugegraph-store - raft-hugegraph-store - audit-hugegraph-store - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/hugegraph-it/hg-it-dist/src/assembly/static/multi/store/C/conf/application-pd.yml b/hugegraph-it/hg-it-dist/src/assembly/static/multi/store/C/conf/application-pd.yml deleted file mode 100644 index df535953fc..0000000000 --- a/hugegraph-it/hg-it-dist/src/assembly/static/multi/store/C/conf/application-pd.yml +++ /dev/null @@ -1,34 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -management: - metrics: - export: - prometheus: - enabled: true - endpoints: - web: - exposure: - include: "*" - -rocksdb: - # rocksdb 使用的总内存大小,达到该值强制写盘 - total_memory_size: 32000000000 - # rocksdb 使用的 memtable 大小 - write_buffer_size: 32000000 - # 对于每个 rocksdb 来说,memtable 个数达到该值进行写盘 - min_write_buffer_number_to_merge: 16 diff --git a/hugegraph-it/hg-it-dist/src/assembly/static/multi/store/C/conf/application.yml b/hugegraph-it/hg-it-dist/src/assembly/static/multi/store/C/conf/application.yml deleted file mode 100644 index 324327cea7..0000000000 --- a/hugegraph-it/hg-it-dist/src/assembly/static/multi/store/C/conf/application.yml +++ /dev/null @@ -1,64 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -pdserver: - # pd 服务地址,多个 pd 地址用逗号分割 - address: 127.0.0.1:8686,127.0.0.1:8687,127.0.0.1:8688 - -management: - metrics: - export: - prometheus: - enabled: true - endpoints: - web: - exposure: - include: "*" - -grpc: - # grpc 的服务地址 - host: 127.0.0.1 - port: 8502 - netty-server: - max-inbound-message-size: 1000MB -raft: - # raft 缓存队列大小 - disruptorBufferSize: 1024 - address: 127.0.0.1:8512 - max-log-file-size: 600000000000 - # 快照生成时间间隔,单位秒 - snapshotInterval: 1800 -server: - # rest 服务地址 - port: 8522 - -app: - # 存储路径,支持多个路径,逗号分割 - data-path: ./storage - #raft-path: ./storage - -spring: - application: - name: store-node-grpc-server - profiles: - active: default - include: pd - -logging: - config: 'file:./conf/log4j2.xml' - level: - root: info diff --git a/hugegraph-it/hg-it-dist/src/assembly/static/multi/store/C/conf/log4j2.xml b/hugegraph-it/hg-it-dist/src/assembly/static/multi/store/C/conf/log4j2.xml deleted file mode 100644 index 9dbaa7e89d..0000000000 --- a/hugegraph-it/hg-it-dist/src/assembly/static/multi/store/C/conf/log4j2.xml +++ /dev/null @@ -1,137 +0,0 @@ - - - - - - - - logs - hugegraph-store - raft-hugegraph-store - audit-hugegraph-store - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/hugegraph-it/hg-it-dist/src/assembly/static/simple/pd/conf/application.yml b/hugegraph-it/hg-it-dist/src/assembly/static/simple/pd/conf/application.yml deleted file mode 100644 index eb8fda4526..0000000000 --- a/hugegraph-it/hg-it-dist/src/assembly/static/simple/pd/conf/application.yml +++ /dev/null @@ -1,79 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -spring: - application: - name: hugegraph-pd - -management: - metrics: - export: - prometheus: - enabled: true - endpoints: - web: - exposure: - include: "*" - -logging: - config: 'file:./conf/log4j2.xml' -# TODO: handle the license file later (PDConfig) -license: - verify-path: ./conf/verify-license.json - license-path: ./conf/hugegraph.license -grpc: - port: 8686 - # The service address of grpc needs to be changed to the actual local IPv4 address when deploying. - host: 127.0.0.1 - -server: - # REST service port number - port: 8620 - -pd: - # Storage path - data-path: ./pd_data - # The check cycle of automatic expansion regularly checks the number of partitions in each store and automatically balances the number of partitions - patrol-interval: 1800 - # The minimum number of surviving store nodes, less than which the entire cluster is unavailable - initial-store-count: 1 - # The initial store list, grpc IP: grpc port, the store in the list is automatically activated - initial-store-list: 127.0.0.1:8500 - -raft: - # The address of the local raft service - address: 127.0.0.1:8610 - # The service address of the PD cluster - peers-list: 127.0.0.1:8610 - -store: - # The time when the store went offline. After that time, the store is considered permanently unavailable, and the replica is allocated to another machine, in seconds - max-down-time: 172800 - # Specifies whether to enable store monitoring data storage - monitor_data_enabled: true - # The interval between monitoring data, minute, hour, second - # default: 1 min * 1 day = 1440 - monitor_data_interval: 1 minute - # Retention time of monitoring data is 1 day; day, month, year - monitor_data_retention: 1 day - -partition: - # Default number of replicas per partition - default-shard-count: 1 - # The default maximum number of replicas per machine - # the initial number of partitions= store-max-shard-count * store-number / default-shard-count - store-max-shard-count: 12 diff --git a/hugegraph-it/hg-it-dist/src/assembly/static/simple/pd/conf/application.yml.template b/hugegraph-it/hg-it-dist/src/assembly/static/simple/pd/conf/application.yml.template deleted file mode 100644 index 8b8f0d63c5..0000000000 --- a/hugegraph-it/hg-it-dist/src/assembly/static/simple/pd/conf/application.yml.template +++ /dev/null @@ -1,72 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -spring: - application: - name: hugegraph-pd -logging: - config: file:./conf/log4j2.xml - -management: - metrics: - export: - prometheus: - enabled: true - endpoints: - web: - exposure: - include: "*" - -grpc: - port: $GRPC_PORT$ - # grpc's service address, - # Note: You need to change to the local actual Iv 4 address when deploying. - host: $GRPC_HOST$ - netty-server: - max-inbound-message-size: 100MB - -server: - port : $SERVER_PORT$ - -pd: - # Cluster ID: to distinguish different PD clusters - - patrol-interval: 2147483647 - data-path: $PD_DATA_PATH$ - -raft: - address: $RAFT_ADDRESS$ - # raft cluster - peers-list: $RAFT_PEERS_LIST$ - # The interval between snapshot generation, in seconds - snapshotInterval: 300 - metrics: true -store: - # If the store heartbeat timeout period exceeds this time, the store is temporarily unavailable and the leader is transferred to another replica in seconds - keepAlive-timeout: 60 - # The time when the store went offline. After that time, the store is considered permanently unavailable, and the replica is allocated to another machine, in seconds - max-down-time: 1800 -partition: - # The default total number of partitions - default-total-count: 30 - # Default number of replicas per partition - default-shard-count: 3 - -discovery: - # After the client registers, the maximum number of heartbeats is not reached, and after that, the - previous registration information will be deleted - heartbeat-try-count: 3 diff --git a/hugegraph-it/hg-it-dist/src/assembly/static/simple/pd/conf/log4j2.xml b/hugegraph-it/hg-it-dist/src/assembly/static/simple/pd/conf/log4j2.xml deleted file mode 100644 index a804948703..0000000000 --- a/hugegraph-it/hg-it-dist/src/assembly/static/simple/pd/conf/log4j2.xml +++ /dev/null @@ -1,135 +0,0 @@ - - - - - - - - logs - hugegraph-pd - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/hugegraph-it/hg-it-dist/src/assembly/static/simple/pd/conf/verify-license.json b/hugegraph-it/hg-it-dist/src/assembly/static/simple/pd/conf/verify-license.json deleted file mode 100644 index 868ccbebbb..0000000000 --- a/hugegraph-it/hg-it-dist/src/assembly/static/simple/pd/conf/verify-license.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "subject": "hugegraph-license", - "public_alias": "publiccert", - "store_ticket": "803b6cc3-d144-47e8-948f-ec8b39c8881e", - "publickey_path": "/public-certs.store" -} diff --git a/hugegraph-it/hg-it-dist/src/assembly/static/simple/server/conf/computer.yaml b/hugegraph-it/hg-it-dist/src/assembly/static/simple/server/conf/computer.yaml deleted file mode 100644 index 1c69388bb0..0000000000 --- a/hugegraph-it/hg-it-dist/src/assembly/static/simple/server/conf/computer.yaml +++ /dev/null @@ -1,39 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# common parameters -common: { - worker_heap: 10000, - vertex_input_dir: /data, - workers: 51, - zookeeper_list: "127.0.0.1:2181", - max_edges_per_segment: 10485760, - edges_immutable: true, - partitions: 255, - compute_threads: 5, - input_threads: 5, - message_async: false, - message_queue_size: 1000, - message_send_threads: 10, - messages_per_segment: 104857600, - hugegraph_url: "http://127.0.0.1:8080", - hugegraph_name: hugegraph, - hugegraph_timeout: 60 -} - -env: { - computer_home: /home/computer -} diff --git a/hugegraph-it/hg-it-dist/src/assembly/static/simple/server/conf/graphs/hugegraph.properties b/hugegraph-it/hg-it-dist/src/assembly/static/simple/server/conf/graphs/hugegraph.properties deleted file mode 100644 index 1a3532914b..0000000000 --- a/hugegraph-it/hg-it-dist/src/assembly/static/simple/server/conf/graphs/hugegraph.properties +++ /dev/null @@ -1,109 +0,0 @@ -# gremlin entrance to create graph -# auth config: org.apache.hugegraph.auth.HugeFactoryAuthProxy -gremlin.graph=org.apache.hugegraph.HugeFactory - -# cache config -#schema.cache_capacity=100000 -# vertex-cache default is 1000w, 10min expired -vertex.cache_type=l2 -#vertex.cache_capacity=10000000 -#vertex.cache_expire=600 -# edge-cache default is 100w, 10min expired -edge.cache_type=l2 -#edge.cache_capacity=1000000 -#edge.cache_expire=600 - - -# schema illegal name template -#schema.illegal_name_regex=\s+|~.* - -#vertex.default_label=vertex - -backend=hstore -serializer=binary - -store=hugegraph - -# pd config -pd.peers=127.0.0.1:8686 - -# task config -task.scheduler_type=local -task.schedule_period=10 -task.retry=0 -task.wait_timeout=10 - -# raft config -raft.mode=false -raft.path=./raft-log -raft.safe_read=true -raft.use_replicator_pipeline=true -raft.election_timeout=10000 -raft.snapshot_interval=3600 -raft.backend_threads=48 -raft.read_index_threads=8 -raft.snapshot_threads=4 -raft.snapshot_parallel_compress=false -raft.snapshot_compress_threads=4 -raft.snapshot_decompress_threads=4 -raft.read_strategy=ReadOnlyLeaseBased -raft.queue_size=16384 -raft.queue_publish_timeout=60 -raft.apply_batch=1 -raft.rpc_threads=80 -raft.rpc_connect_timeout=5000 -raft.rpc_timeout=60 -raft.install_snapshot_rpc_timeout=36000 - -# search config -search.text_analyzer=jieba -search.text_analyzer_mode=INDEX - -# rocksdb backend config -#rocksdb.data_path=/path/to/disk -#rocksdb.wal_path=/path/to/disk - - -# cassandra backend config -cassandra.host=localhost -cassandra.port=9042 -cassandra.username= -cassandra.password= -#cassandra.connect_timeout=5 -#cassandra.read_timeout=20 -#cassandra.keyspace.strategy=SimpleStrategy -#cassandra.keyspace.replication=3 - -# hbase backend config -#hbase.hosts=localhost -#hbase.port=2181 -#hbase.znode_parent=/hbase -#hbase.threads_max=64 -# IMPORTANT: recommend to modify the HBase partition number -# by the actual/env data amount & RS amount before init store -# It will influence the load speed a lot -#hbase.enable_partition=true -#hbase.vertex_partitions=10 -#hbase.edge_partitions=30 - -# mysql backend config -#jdbc.driver=com.mysql.jdbc.Driver -#jdbc.url=jdbc:mysql://127.0.0.1:3306 -#jdbc.username=root -#jdbc.password= -#jdbc.reconnect_max_times=3 -#jdbc.reconnect_interval=3 -#jdbc.ssl_mode=false - -# postgresql & cockroachdb backend config -#jdbc.driver=org.postgresql.Driver -#jdbc.url=jdbc:postgresql://localhost:5432/ -#jdbc.username=postgres -#jdbc.password= -#jdbc.postgresql.connect_database=template1 - -# palo backend config -#palo.host=127.0.0.1 -#palo.poll_interval=10 -#palo.temp_dir=./palo-data -#palo.file_limit_size=32 diff --git a/hugegraph-it/hg-it-dist/src/assembly/static/simple/server/conf/gremlin-driver-settings.yaml b/hugegraph-it/hg-it-dist/src/assembly/static/simple/server/conf/gremlin-driver-settings.yaml deleted file mode 100644 index 55f38ab97d..0000000000 --- a/hugegraph-it/hg-it-dist/src/assembly/static/simple/server/conf/gremlin-driver-settings.yaml +++ /dev/null @@ -1,25 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -hosts: [localhost] -port: 8182 -serializer: { - className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV1d0, - config: { - serializeResultToString: false, - ioRegistries: [org.apache.hugegraph.io.HugeGraphIoRegistry] - } -} diff --git a/hugegraph-it/hg-it-dist/src/assembly/static/simple/server/conf/gremlin-server.yaml b/hugegraph-it/hg-it-dist/src/assembly/static/simple/server/conf/gremlin-server.yaml deleted file mode 100644 index 32135163fd..0000000000 --- a/hugegraph-it/hg-it-dist/src/assembly/static/simple/server/conf/gremlin-server.yaml +++ /dev/null @@ -1,127 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# host and port of gremlin server, need to be consistent with host and port in rest-server.properties -#host: 127.0.0.1 -#port: 8182 - -# timeout in ms of gremlin query -evaluationTimeout: 30000 - -channelizer: org.apache.tinkerpop.gremlin.server.channel.WsAndHttpChannelizer -# don't set graph at here, this happens after support for dynamically adding graph -graphs: { -} -scriptEngines: { - gremlin-groovy: { - staticImports: [ - org.opencypher.gremlin.process.traversal.CustomPredicates.*', - org.opencypher.gremlin.traversal.CustomFunctions.* - ], - plugins: { - org.apache.hugegraph.plugin.HugeGraphGremlinPlugin: {}, - org.apache.tinkerpop.gremlin.server.jsr223.GremlinServerGremlinPlugin: {}, - org.apache.tinkerpop.gremlin.jsr223.ImportGremlinPlugin: { - classImports: [ - java.lang.Math, - org.apache.hugegraph.backend.id.IdGenerator, - org.apache.hugegraph.type.define.Directions, - org.apache.hugegraph.type.define.NodeRole, - org.apache.hugegraph.masterelection.GlobalMasterInfo, - org.apache.hugegraph.util.DateUtil, - org.apache.hugegraph.traversal.algorithm.CollectionPathsTraverser, - org.apache.hugegraph.traversal.algorithm.CountTraverser, - org.apache.hugegraph.traversal.algorithm.CustomizedCrosspointsTraverser, - org.apache.hugegraph.traversal.algorithm.CustomizePathsTraverser, - org.apache.hugegraph.traversal.algorithm.FusiformSimilarityTraverser, - org.apache.hugegraph.traversal.algorithm.HugeTraverser, - org.apache.hugegraph.traversal.algorithm.JaccardSimilarTraverser, - org.apache.hugegraph.traversal.algorithm.KneighborTraverser, - org.apache.hugegraph.traversal.algorithm.KoutTraverser, - org.apache.hugegraph.traversal.algorithm.MultiNodeShortestPathTraverser, - org.apache.hugegraph.traversal.algorithm.NeighborRankTraverser, - org.apache.hugegraph.traversal.algorithm.PathsTraverser, - org.apache.hugegraph.traversal.algorithm.PersonalRankTraverser, - org.apache.hugegraph.traversal.algorithm.SameNeighborTraverser, - org.apache.hugegraph.traversal.algorithm.ShortestPathTraverser, - org.apache.hugegraph.traversal.algorithm.SingleSourceShortestPathTraverser, - org.apache.hugegraph.traversal.algorithm.SubGraphTraverser, - org.apache.hugegraph.traversal.algorithm.TemplatePathsTraverser, - org.apache.hugegraph.traversal.algorithm.steps.EdgeStep, - org.apache.hugegraph.traversal.algorithm.steps.RepeatEdgeStep, - org.apache.hugegraph.traversal.algorithm.steps.WeightedEdgeStep, - org.apache.hugegraph.traversal.optimize.ConditionP, - org.apache.hugegraph.traversal.optimize.Text, - org.apache.hugegraph.traversal.optimize.TraversalUtil, - org.opencypher.gremlin.traversal.CustomFunctions, - org.opencypher.gremlin.traversal.CustomPredicate - ], - methodImports: [ - java.lang.Math#*, - org.opencypher.gremlin.traversal.CustomPredicate#*, - org.opencypher.gremlin.traversal.CustomFunctions#* - ] - }, - org.apache.tinkerpop.gremlin.jsr223.ScriptFileGremlinPlugin: { - files: [scripts/empty-sample.groovy] - } - } - } -} -serializers: - - {className: org.apache.tinkerpop.gremlin.driver.ser.GraphBinaryMessageSerializerV1, - config: { - serializeResultToString: false, - ioRegistries: [org.apache.hugegraph.io.HugeGraphIoRegistry] - } - } - - {className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV1d0, - config: { - serializeResultToString: false, - ioRegistries: [org.apache.hugegraph.io.HugeGraphIoRegistry] - } - } - - {className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV2d0, - config: { - serializeResultToString: false, - ioRegistries: [org.apache.hugegraph.io.HugeGraphIoRegistry] - } - } - - {className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV3d0, - config: { - serializeResultToString: false, - ioRegistries: [org.apache.hugegraph.io.HugeGraphIoRegistry] - } - } -metrics: { - consoleReporter: {enabled: false, interval: 180000}, - csvReporter: {enabled: false, interval: 180000, fileName: ./metrics/gremlin-server-metrics.csv}, - jmxReporter: {enabled: false}, - slf4jReporter: {enabled: false, interval: 180000}, - gangliaReporter: {enabled: false, interval: 180000, addressingMode: MULTICAST}, - graphiteReporter: {enabled: false, interval: 180000} -} -maxInitialLineLength: 4096 -maxHeaderSize: 8192 -maxChunkSize: 8192 -maxContentLength: 65536 -maxAccumulationBufferComponents: 1024 -resultIterationBatchSize: 64 -writeBufferLowWaterMark: 32768 -writeBufferHighWaterMark: 65536 -ssl: { - enabled: false -} diff --git a/hugegraph-it/hg-it-dist/src/assembly/static/simple/server/conf/log4j2.xml b/hugegraph-it/hg-it-dist/src/assembly/static/simple/server/conf/log4j2.xml deleted file mode 100644 index f1dd7e8395..0000000000 --- a/hugegraph-it/hg-it-dist/src/assembly/static/simple/server/conf/log4j2.xml +++ /dev/null @@ -1,144 +0,0 @@ - - - - - - logs - hugegraph-server - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/hugegraph-it/hg-it-dist/src/assembly/static/simple/server/conf/remote-objects.yaml b/hugegraph-it/hg-it-dist/src/assembly/static/simple/server/conf/remote-objects.yaml deleted file mode 100644 index 39679d8c30..0000000000 --- a/hugegraph-it/hg-it-dist/src/assembly/static/simple/server/conf/remote-objects.yaml +++ /dev/null @@ -1,30 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -hosts: [localhost] -port: 8182 -serializer: { - className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV1d0, - config: { - serializeResultToString: false, - # The duplication of HugeGraphIoRegistry is meant to fix a bug in the - # 'org.apache.tinkerpop.gremlin.driver.Settings:from(Configuration)' method. - ioRegistries: [ - org.apache.hugegraph.io.HugeGraphIoRegistry, - org.apache.hugegraph.io.HugeGraphIoRegistry - ] - } -} diff --git a/hugegraph-it/hg-it-dist/src/assembly/static/simple/server/conf/remote.yaml b/hugegraph-it/hg-it-dist/src/assembly/static/simple/server/conf/remote.yaml deleted file mode 100644 index 55f38ab97d..0000000000 --- a/hugegraph-it/hg-it-dist/src/assembly/static/simple/server/conf/remote.yaml +++ /dev/null @@ -1,25 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -hosts: [localhost] -port: 8182 -serializer: { - className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV1d0, - config: { - serializeResultToString: false, - ioRegistries: [org.apache.hugegraph.io.HugeGraphIoRegistry] - } -} diff --git a/hugegraph-it/hg-it-dist/src/assembly/static/simple/server/conf/rest-server.properties b/hugegraph-it/hg-it-dist/src/assembly/static/simple/server/conf/rest-server.properties deleted file mode 100644 index d28e6cf406..0000000000 --- a/hugegraph-it/hg-it-dist/src/assembly/static/simple/server/conf/rest-server.properties +++ /dev/null @@ -1,71 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -# bind url -# could use '0.0.0.0' or specified (real)IP to expose external network access -restserver.url=http://127.0.0.1:8080 -# gremlin server url, need to be consistent with host and port in gremlin-server.yaml -#gremlinserver.url=http://127.0.0.1:8182 - -graphs=./conf/graphs - -# The maximum thread ratio for batch writing, only take effect if the batch.max_write_threads is 0 -batch.max_write_ratio=80 -batch.max_write_threads=0 - -# configuration of arthas -arthas.telnet_port=8562 -arthas.http_port=8561 -arthas.ip=127.0.0.1 -arthas.disabled_commands=jad - -# authentication configs -# choose 'org.apache.hugegraph.auth.StandardAuthenticator' or -# 'org.apache.hugegraph.auth.ConfigAuthenticator' -#auth.authenticator= - -# for StandardAuthenticator mode -#auth.graph_store=hugegraph -# auth client config -#auth.remote_url=127.0.0.1:8899,127.0.0.1:8898,127.0.0.1:8897 - -# for ConfigAuthenticator mode -#auth.admin_token= -#auth.user_tokens=[] - -# rpc server configs for multi graph-servers or raft-servers -rpc.server_host=127.0.0.1 -rpc.server_port=8091 -#rpc.server_timeout=30 - -# rpc client configs (like enable to keep cache consistency) -#rpc.remote_url=127.0.0.1:8091,127.0.0.1:8092,127.0.0.1:8093 -#rpc.client_connect_timeout=20 -#rpc.client_reconnect_period=10 -#rpc.client_read_timeout=40 -#rpc.client_retries=3 -#rpc.client_load_balancer=consistentHash - -# raft group initial peers -#raft.group_peers=127.0.0.1:8091,127.0.0.1:8092,127.0.0.1:8093 - -# lightweight load balancing (beta) -server.id=server-1 -server.role=master - -# slow query log -log.slow_query_threshold=1000 diff --git a/hugegraph-it/hg-it-dist/src/assembly/static/simple/store/conf/application-pd.yml b/hugegraph-it/hg-it-dist/src/assembly/static/simple/store/conf/application-pd.yml deleted file mode 100644 index df535953fc..0000000000 --- a/hugegraph-it/hg-it-dist/src/assembly/static/simple/store/conf/application-pd.yml +++ /dev/null @@ -1,34 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -management: - metrics: - export: - prometheus: - enabled: true - endpoints: - web: - exposure: - include: "*" - -rocksdb: - # rocksdb 使用的总内存大小,达到该值强制写盘 - total_memory_size: 32000000000 - # rocksdb 使用的 memtable 大小 - write_buffer_size: 32000000 - # 对于每个 rocksdb 来说,memtable 个数达到该值进行写盘 - min_write_buffer_number_to_merge: 16 diff --git a/hugegraph-it/hg-it-dist/src/assembly/static/simple/store/conf/application.yml b/hugegraph-it/hg-it-dist/src/assembly/static/simple/store/conf/application.yml deleted file mode 100644 index 4ca3d34dd6..0000000000 --- a/hugegraph-it/hg-it-dist/src/assembly/static/simple/store/conf/application.yml +++ /dev/null @@ -1,64 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -pdserver: - # pd 服务地址,多个 pd 地址用逗号分割 - address: localhost:8686 - -management: - metrics: - export: - prometheus: - enabled: true - endpoints: - web: - exposure: - include: "*" - -grpc: - # grpc 的服务地址 - host: 127.0.0.1 - port: 8500 - netty-server: - max-inbound-message-size: 1000MB -raft: - # raft 缓存队列大小 - disruptorBufferSize: 1024 - address: 127.0.0.1:8510 - max-log-file-size: 600000000000 - # 快照生成时间间隔,单位秒 - snapshotInterval: 1800 -server: - # rest 服务地址 - port: 8520 - -app: - # 存储路径,支持多个路径,逗号分割 - data-path: ./storage - #raft-path: ./storage - -spring: - application: - name: store-node-grpc-server - profiles: - active: default - include: pd - -logging: - config: 'file:./conf/log4j2.xml' - level: - root: info diff --git a/hugegraph-it/hg-it-dist/src/assembly/static/simple/store/conf/log4j2.xml b/hugegraph-it/hg-it-dist/src/assembly/static/simple/store/conf/log4j2.xml deleted file mode 100644 index 388d09e2fd..0000000000 --- a/hugegraph-it/hg-it-dist/src/assembly/static/simple/store/conf/log4j2.xml +++ /dev/null @@ -1,137 +0,0 @@ - - - - - - - - logs - hugegraph-store - raft-hugegraph-store - audit-hugegraph-store - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/config/ClusterConfImpl.java b/hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/config/ClusterConfImpl.java deleted file mode 100644 index 569804b252..0000000000 --- a/hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/config/ClusterConfImpl.java +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hugegraph.it.config; - -public class ClusterConfImpl implements ClusterConf { - -} diff --git a/hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/env/SimpleEnv.java b/hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/env/SimpleEnv.java deleted file mode 100644 index cd59a0e303..0000000000 --- a/hugegraph-it/hg-it-minicluster/src/main/java/org/apache/hugegraph/it/env/SimpleEnv.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hugegraph.it.env; - -import static org.apache.hugegraph.it.base.ClusterConstant.PD_LIB_PATH; -import static org.apache.hugegraph.it.base.ClusterConstant.SERVER_LIB_PATH; -import static org.apache.hugegraph.it.base.ClusterConstant.SIMPLE_PD_CONFIG_PATH; -import static org.apache.hugegraph.it.base.ClusterConstant.SIMPLE_SERVER_CONFIG_PATH; -import static org.apache.hugegraph.it.base.ClusterConstant.SIMPLE_STORE_CONFIG_PATH; -import static org.apache.hugegraph.it.base.ClusterConstant.STORE_LIB_PATH; - -import org.apache.hugegraph.it.node.PDNodeWrapper; -import org.apache.hugegraph.it.node.ServerNodeWrapper; -import org.apache.hugegraph.it.node.StoreNodeWrapper; - -public class SimpleEnv extends AbstractEnv { - - public SimpleEnv() { - PDNodeWrapper pdNodeWrapper = new PDNodeWrapper("127.0.0.1", 8686, 1, 1); - StoreNodeWrapper storeNodeWrapper = new StoreNodeWrapper(1, 1); - ServerNodeWrapper serverNodeWrapper = new ServerNodeWrapper(1, 1); - - pdNodeWrapper.updateWorkPath(PD_LIB_PATH); - pdNodeWrapper.updateConfigPath(SIMPLE_PD_CONFIG_PATH); - super.addPDNode(pdNodeWrapper); - - storeNodeWrapper.updateWorkPath(STORE_LIB_PATH); - storeNodeWrapper.updateConfigPath(SIMPLE_STORE_CONFIG_PATH); - super.addStoreNode(storeNodeWrapper); - - serverNodeWrapper.updateWorkPath(SERVER_LIB_PATH); - serverNodeWrapper.updateConfigPath(SIMPLE_SERVER_CONFIG_PATH); - super.addServerNode(serverNodeWrapper); - } - -} diff --git a/pom.xml b/pom.xml index d0fe3bce2a..fe6ad5868c 100644 --- a/pom.xml +++ b/pom.xml @@ -100,7 +100,7 @@ hugegraph-pd hugegraph-store install-dist - hugegraph-it + hugegraph-cluster-test From ce20f44a739f73c53ff7568d281a905532b29e5c Mon Sep 17 00:00:00 2001 From: 145425491 <1245294786@qq.com> Date: Sat, 17 Aug 2024 17:04:09 +0800 Subject: [PATCH 11/40] fix(it): fix the bug of coping wrong node dir --- .../src/assembly/descriptor/assembly.xml | 20 +--- .../hugegraph/ct/base/ClusterConstant.java | 8 +- .../org/apache/hugegraph/ct/base/EnvUtil.java | 49 ++++++++++ .../hugegraph/ct/config/AbstractConfig.java | 75 +++++++++++++++ .../hugegraph/ct/config/ClusterConf.java | 5 +- .../apache/hugegraph/ct/config/PDConfig.java | 92 +++++++++++++++++++ .../hugegraph/ct/config/StoreConfig.java | 78 ++++++++++++++++ .../apache/hugegraph/ct/env/AbstractEnv.java | 4 - .../ct/node/AbstractNodeWrapper.java | 30 +++--- .../hugegraph/ct/node/PDNodeWrapper.java | 9 +- .../hugegraph/ct/node/ServerNodeWrapper.java | 22 +++++ .../hugegraph/ct/node/StoreNodeWrapper.java | 7 ++ 12 files changed, 358 insertions(+), 41 deletions(-) create mode 100644 hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/base/EnvUtil.java create mode 100644 hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/config/AbstractConfig.java create mode 100644 hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/config/PDConfig.java create mode 100644 hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/config/StoreConfig.java diff --git a/hugegraph-cluster-test/hg-ct-dist/src/assembly/descriptor/assembly.xml b/hugegraph-cluster-test/hg-ct-dist/src/assembly/descriptor/assembly.xml index 207230e7ef..3db49f4266 100644 --- a/hugegraph-cluster-test/hg-ct-dist/src/assembly/descriptor/assembly.xml +++ b/hugegraph-cluster-test/hg-ct-dist/src/assembly/descriptor/assembly.xml @@ -24,28 +24,14 @@ - - - - - - - - - ${assembly.static.dir}/simple - simple - - **/* - - - - ${assembly.static.dir}/multi - multi + ${assembly.static.dir} + / **/* + diff --git a/hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/base/ClusterConstant.java b/hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/base/ClusterConstant.java index 983ee45f96..11850c8e58 100644 --- a/hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/base/ClusterConstant.java +++ b/hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/base/ClusterConstant.java @@ -42,13 +42,19 @@ public class ClusterConstant { public static final String APPLICATION_FILE = "application.yml"; public static final String SERVER_PROPERTIES = "rest-server.properties"; - public static final String HUGEGRAPH_PROPERTIES = "hugegraph.properties"; + public static final String HUGEGRAPH_PROPERTIES = "graphs/hugegraph.properties"; public static final String LOG4J_FILE = "log4j2.xml"; public static final String VERIFY_LICENSE_FILE = "verify-license.json"; public static final String LICENSE_FILE = "hugegraph.license"; public static final String PD_TEMPLATE_FILE = "pd-application.yml.template"; public static final String STORE_TEMPLATE_FILE = "store-application.yml.template"; public static final String SERVER_TEMPLATE_FILE = "rest-server.properties.template"; + public static final String GREMLIN_DRIVER_SETTING_FILE = "gremlin-driver-settings.yaml"; + public static final String GREMLIN_SERVER_FILE = "gremlin-server.yaml"; + public static final String COMPUTER_SETTING_FILE = "computer.yaml"; + public static final String HUGEGRAPH_SERVER_KEYSTORE = "hugegraph-server.keystore"; + public static final String REMOTE_SETTING_FILE = "remote.yaml"; + public static final String REMOTE_OBJECTS_SETTING_FILE = "remote-objects.yaml"; public static final String JAVA_CMD = System.getProperty("java.home") diff --git a/hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/base/EnvUtil.java b/hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/base/EnvUtil.java new file mode 100644 index 0000000000..5ff32261f1 --- /dev/null +++ b/hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/base/EnvUtil.java @@ -0,0 +1,49 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.hugegraph.ct.base; + +import java.io.IOException; +import java.net.ServerSocket; +import java.util.ArrayList; +import java.util.List; + +import org.slf4j.Logger; + +public class EnvUtil { + + private static final Logger LOG = HGTestLogger.LOG; + private static final List ports = new ArrayList<>(); + + public static int getAvailablePort() { + try { + ServerSocket socket = new ServerSocket(0); + int port = socket.getLocalPort(); + while (ports.contains(port)) { + socket = new ServerSocket(0); + port = socket.getLocalPort(); + socket.close(); + } + ports.add(port); + return port; + }catch (IOException e) { + LOG.error("fail to get available ports", e); + return -1; + } + } + +} diff --git a/hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/config/AbstractConfig.java b/hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/config/AbstractConfig.java new file mode 100644 index 0000000000..e076c26cf2 --- /dev/null +++ b/hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/config/AbstractConfig.java @@ -0,0 +1,75 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.hugegraph.ct.config; + +import java.io.File; +import java.io.FileWriter; +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.util.HashMap; +import java.util.Map; + +import org.apache.hugegraph.ct.base.HGTestLogger; +import org.slf4j.Logger; + +public abstract class AbstractConfig { + + protected static final Logger LOG = HGTestLogger.LOG; + protected String config; + protected Map properties = new HashMap<>(); + protected String fileName; + + protected void readTemplate(String filePath) { + try { + this.config = new String(Files.readAllBytes(Paths.get(filePath))); + } catch (IOException e) { + LOG.error("failed to get file", e); + } + } + + protected void updateConfigs() { + for (Map.Entry entry : properties.entrySet()) { + String placeholder = "$" + entry.getKey() + "$"; + config = config.replace(placeholder, entry.getValue()); + } + } + + public void writeConfig(String filePath) { + updateConfigs(); + try (FileWriter writer = new FileWriter(filePath + + File.separator + + fileName)) { + writer.write(config); + } catch (IOException e) { + e.printStackTrace(); + } + } + + public String getProperty(String propertyName) { + return properties.get(propertyName); + } + + protected void setProperty(String propertyName, String value) { + if (properties.containsKey(propertyName)) { + properties.replace(propertyName, value); + } else { + properties.put(propertyName, value); + } + } +} diff --git a/hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/config/ClusterConf.java b/hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/config/ClusterConf.java index e03dbda993..fe11a87e9e 100644 --- a/hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/config/ClusterConf.java +++ b/hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/config/ClusterConf.java @@ -36,6 +36,9 @@ public ClusterConf(int pdCnt, int storeCnt, int serverCnt) { pdConfigs = new ArrayList<>(); storeConfigs = new ArrayList<>(); serverConfigs = new ArrayList<>(); + pdGrpcList = new ArrayList<>(); + pdRaftList = new ArrayList<>(); + storeGrpcList = new ArrayList<>(); for (int i = 0; i < pdCnt; i++) { PDConfig pdConfig = new PDConfig(); @@ -59,7 +62,7 @@ public ClusterConf(int pdCnt, int storeCnt, int serverCnt) { for (int i = 0; i < pdCnt; i++) { PDConfig pdConfig = pdConfigs.get(i); - pdConfig.setRaftPeerList(pdGrpcList); + pdConfig.setRaftPeerList(pdRaftList); pdConfig.setStoreGrpcList(storeGrpcList); } } diff --git a/hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/config/PDConfig.java b/hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/config/PDConfig.java new file mode 100644 index 0000000000..83a774a3c8 --- /dev/null +++ b/hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/config/PDConfig.java @@ -0,0 +1,92 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.hugegraph.ct.config; + +import static org.apache.hugegraph.ct.base.ClusterConstant.APPLICATION_FILE; +import static org.apache.hugegraph.ct.base.ClusterConstant.CT_PACKAGE_PATH; +import static org.apache.hugegraph.ct.base.ClusterConstant.PD_TEMPLATE_FILE; +import static org.apache.hugegraph.ct.base.EnvUtil.getAvailablePort; + +import java.util.List; +import java.util.stream.Collectors; + +import lombok.Getter; + +public class PDConfig extends AbstractConfig { + + @Getter + private final int raftPort, grpcPort, restPort; + @Getter + private String grpcHost, dataPath, raftHost; + + public PDConfig() { + readTemplate(CT_PACKAGE_PATH + PD_TEMPLATE_FILE); + this.fileName = APPLICATION_FILE; + this.grpcHost = "127.0.0.1"; + this.raftHost = "127.0.0.1"; + this.dataPath = "./pd_data"; + this.raftPort = getAvailablePort(); + this.grpcPort = getAvailablePort(); + this.restPort = getAvailablePort(); + properties.put("GRPC_HOST", grpcHost); + properties.put("GRPC_PORT", String.valueOf(grpcPort)); + properties.put("REST_PORT", String.valueOf(restPort)); + properties.put("PD_DATA_PATH", dataPath); + properties.put("RAFT_ADDRESS", raftHost + ":" + + raftPort); + } + + public void setGrpcHost(String grpcHost) { + this.grpcHost = grpcHost; + setProperty("GRPC_HOST", grpcHost); + } + + public void setDataPath(String dataPath) { + this.dataPath = dataPath; + setProperty("PD_DATA_PATH", dataPath); + } + + public void setRaftHost(String raftHost) { + this.raftHost = raftHost; + setProperty("RAFT_ADDRESS", raftHost + ":" + raftPort); + } + + public void setRaftPeerList(List raftPeerList) { + String raftPeers = raftPeerList.stream() + .collect(Collectors.joining(",")); + setProperty("RAFT_PEERS_LIST", raftPeers); + } + + public void setStoreCount(int storeCount) { + setProperty("STORE_COUNT", String.valueOf(storeCount)); + } + + public void setStoreGrpcList(List storeGrpcList) { + String storeGrpcLists = storeGrpcList.stream() + .collect(Collectors.joining(",")); + setProperty("STORE_GRPC_LIST", storeGrpcLists); + } + + public String getRaftAddress() { + return raftHost + ":" + raftPort; + } + + public String getGrpcAddress() { + return grpcHost + ":" + grpcPort; + } +} diff --git a/hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/config/StoreConfig.java b/hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/config/StoreConfig.java new file mode 100644 index 0000000000..96132e9c39 --- /dev/null +++ b/hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/config/StoreConfig.java @@ -0,0 +1,78 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.hugegraph.ct.config; + +import static org.apache.hugegraph.ct.base.ClusterConstant.APPLICATION_FILE; +import static org.apache.hugegraph.ct.base.ClusterConstant.CT_PACKAGE_PATH; +import static org.apache.hugegraph.ct.base.ClusterConstant.STORE_TEMPLATE_FILE; +import static org.apache.hugegraph.ct.base.EnvUtil.getAvailablePort; + +import java.util.List; +import java.util.stream.Collectors; + +import lombok.Getter; + +public class StoreConfig extends AbstractConfig { + + @Getter + private int raftPort, grpcPort, restPort; + @Getter + private String grpcHost, dataPath, raftHost; + + public StoreConfig() { + readTemplate(CT_PACKAGE_PATH + STORE_TEMPLATE_FILE); + this.fileName = APPLICATION_FILE; + this.grpcHost = "127.0.0.1"; + this.raftHost = "127.0.0.1"; + this.dataPath = "./storage"; + this.raftPort = getAvailablePort(); + this.grpcPort = getAvailablePort(); + this.restPort = getAvailablePort(); + properties.put("GRPC_HOST", grpcHost); + properties.put("GRPC_PORT", String.valueOf(grpcPort)); + properties.put("REST_PORT", String.valueOf(restPort)); + properties.put("STORE_DATA_PATH", dataPath); + properties.put("RAFT_ADDRESS", raftHost + ":" + + raftPort); + } + + public void setGrpcHost(String grpcHost) { + this.grpcHost = grpcHost; + setProperty("GRPC_HOST", grpcHost); + } + + public void setDataPath(String dataPath) { + this.dataPath = dataPath; + setProperty("PD_DATA_PATH", dataPath); + } + + public void setRaftHost(String raftHost) { + this.raftHost = raftHost; + setProperty("RAFT_ADDRESS", raftHost + ":" + raftPort); + } + + public void setPDServerList(List pdServerList) { + String pdServers = pdServerList.stream() + .collect(Collectors.joining(",")); + setProperty("PD_SERVER_ADDRESS", pdServers); + } + + public String getGrpcAddress() { + return grpcHost + ":" + grpcPort; + } +} diff --git a/hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/env/AbstractEnv.java b/hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/env/AbstractEnv.java index 1d32e008e5..fb1286b1d3 100644 --- a/hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/env/AbstractEnv.java +++ b/hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/env/AbstractEnv.java @@ -19,7 +19,6 @@ import static org.apache.hugegraph.ct.base.ClusterConstant.CONF_DIR; -import java.io.File; import java.util.ArrayList; import java.util.List; @@ -60,7 +59,6 @@ public void init(int pdCnt, int storeCnt, int serverCnt) { PDConfig pdConfig = clusterConf.getPDConfig(i); pdNodeWrappers.add(pdNodeWrapper); pdConfig.writeConfig(pdNodeWrapper.getNodePath() - + File.separator + CONF_DIR); } @@ -69,7 +67,6 @@ public void init(int pdCnt, int storeCnt, int serverCnt) { StoreConfig storeConfig = clusterConf.getStoreConfig(i); storeNodeWrappers.add(storeNodeWrapper); storeConfig.writeConfig(storeNodeWrapper.getNodePath() - + File.separator + CONF_DIR); } @@ -84,7 +81,6 @@ public void init(int pdCnt, int storeCnt, int serverCnt) { serverConfig.setRole("worker"); } serverConfig.writeConfig(serverNodeWrapper.getNodePath() - + File.separator + CONF_DIR); } } diff --git a/hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/node/AbstractNodeWrapper.java b/hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/node/AbstractNodeWrapper.java index 16ecfe7601..287122d549 100644 --- a/hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/node/AbstractNodeWrapper.java +++ b/hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/node/AbstractNodeWrapper.java @@ -24,7 +24,6 @@ import java.io.IOException; import java.nio.charset.StandardCharsets; import java.nio.file.Files; -import java.nio.file.LinkOption; import java.nio.file.NoSuchFileException; import java.nio.file.Path; import java.nio.file.Paths; @@ -58,8 +57,6 @@ public AbstractNodeWrapper() { this.clusterIndex = 1; fileNames = new ArrayList<>(); this.configPath = getNodePath(); - createNodeDir(); - createLogDir(); } /** @@ -67,30 +64,31 @@ public AbstractNodeWrapper() { */ @Override public void createNodeDir() { - String destDir = getNodePath() + File.separator + CONF_DIR; + String destDir = getNodePath() + CONF_DIR + File.separator; try { try { - if (new File(destDir).exists()) { - PathUtils.delete(Paths.get(destDir)); + if (!new File(destDir).exists()) { + FileUtils.createParentDirectories(new File(destDir)); } } catch (NoSuchFileException fileException) { //no need to handle } + Path sourcePath = Paths.get(CT_PACKAGE_PATH); // To avoid following symbolic links - try (Stream stream = Files.walk(Paths.get(CT_PACKAGE_PATH))) { + try (Stream stream = Files.walk(sourcePath)) { stream.forEach( source -> { - String fileName = source.getFileName().toString(); + Path relativePath = sourcePath.relativize(source); Path destination = - Paths.get(destDir, - source.toString() - .substring(CT_PACKAGE_PATH.length())); - if (fileNames.contains(fileName)) { + Paths.get(destDir).resolve(relativePath); + if (fileNames.contains(relativePath.toString())) { try { + if (Files.notExists(destination.getParent())) { + Files.createDirectories(destination.getParent()); + } Files.copy(source, destination, - LinkOption.NOFOLLOW_LINKS, - StandardCopyOption.COPY_ATTRIBUTES); + StandardCopyOption.REPLACE_EXISTING); } catch (IOException ioException) { LOG.error("Fail to copy files to destination dir", ioException); throw new RuntimeException(ioException); @@ -134,11 +132,11 @@ public void deleteDir() { * @return (user.dir).id */ public String getNodePath() { - return CT_PACKAGE_PATH + getID(); + return CT_PACKAGE_PATH + getID() + File.separator; } public String getLogPath() { - return getNodePath() + ClusterConstant.LOG + getID() + "-start.log"; + return getNodePath() + ClusterConstant.LOG + File.separator + getID() + "-start.log"; } public void updateWorkPath(String workPath) { diff --git a/hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/node/PDNodeWrapper.java b/hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/node/PDNodeWrapper.java index 03c459575e..548d67ac8c 100644 --- a/hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/node/PDNodeWrapper.java +++ b/hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/node/PDNodeWrapper.java @@ -43,18 +43,22 @@ public PDNodeWrapper() { VERIFY_LICENSE_FILE) ); this.workPath = PD_LIB_PATH; + createNodeDir(); + createLogDir(); } public PDNodeWrapper(int clusterIndex, int index) { super(); this.clusterIndex = clusterIndex; this.index = index; - fileNames = new ArrayList( + this.fileNames = new ArrayList<>( Arrays.asList(LOG4J_FILE, LICENSE_FILE, VERIFY_LICENSE_FILE) ); this.workPath = PD_LIB_PATH; + createNodeDir(); + createLogDir(); } /* @@ -78,7 +82,8 @@ public void start() { "-Xmx4g", "-XX:+HeapDumpOnOutOfMemoryError", "-XX:HeapDumpPath=" + configPath + "logs", - "-Dlog4j.configurationFile=" + configPath + CONF_DIR + File.separator + + "-Dlog4j.configurationFile=" + configPath + File.separator + CONF_DIR + + File.separator + "log4j2.xml", "-Dspring.config.location=" + configPath + CONF_DIR + File.separator + "application.yml", diff --git a/hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/node/ServerNodeWrapper.java b/hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/node/ServerNodeWrapper.java index e17ba87654..28bf0c3804 100644 --- a/hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/node/ServerNodeWrapper.java +++ b/hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/node/ServerNodeWrapper.java @@ -17,10 +17,19 @@ package org.apache.hugegraph.ct.node; +import static org.apache.hugegraph.ct.base.ClusterConstant.COMPUTER_SETTING_FILE; import static org.apache.hugegraph.ct.base.ClusterConstant.EXT_DIR; +import static org.apache.hugegraph.ct.base.ClusterConstant.GREMLIN_DRIVER_SETTING_FILE; +import static org.apache.hugegraph.ct.base.ClusterConstant.GREMLIN_SERVER_FILE; +import static org.apache.hugegraph.ct.base.ClusterConstant.HUGEGRAPH_PROPERTIES; +import static org.apache.hugegraph.ct.base.ClusterConstant.HUGEGRAPH_SERVER_KEYSTORE; import static org.apache.hugegraph.ct.base.ClusterConstant.JAVA_CMD; import static org.apache.hugegraph.ct.base.ClusterConstant.LIB_DIR; +import static org.apache.hugegraph.ct.base.ClusterConstant.LOG4J_FILE; import static org.apache.hugegraph.ct.base.ClusterConstant.PLUGINS_DIR; +import static org.apache.hugegraph.ct.base.ClusterConstant.REMOTE_OBJECTS_SETTING_FILE; +import static org.apache.hugegraph.ct.base.ClusterConstant.REMOTE_SETTING_FILE; +import static org.apache.hugegraph.ct.base.ClusterConstant.SERVER_LIB_PATH; import static org.apache.hugegraph.ct.base.ClusterConstant.isJava11OrHigher; import java.io.File; @@ -32,8 +41,21 @@ public class ServerNodeWrapper extends AbstractNodeWrapper { public ServerNodeWrapper(int clusterIndex, int index) { + super(); this.clusterIndex = clusterIndex; this.index = index; + this.fileNames = new ArrayList<>( + List.of(LOG4J_FILE, + HUGEGRAPH_PROPERTIES, + HUGEGRAPH_SERVER_KEYSTORE, + COMPUTER_SETTING_FILE, + GREMLIN_SERVER_FILE, + GREMLIN_DRIVER_SETTING_FILE, + REMOTE_SETTING_FILE, + REMOTE_OBJECTS_SETTING_FILE)); + this.workPath = SERVER_LIB_PATH; + createNodeDir(); + createLogDir(); } private static void addJarsToClasspath(File directory, List classpath) { diff --git a/hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/node/StoreNodeWrapper.java b/hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/node/StoreNodeWrapper.java index 5616086e6f..6f4758c058 100644 --- a/hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/node/StoreNodeWrapper.java +++ b/hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/node/StoreNodeWrapper.java @@ -19,7 +19,9 @@ import static org.apache.hugegraph.ct.base.ClusterConstant.CONF_DIR; import static org.apache.hugegraph.ct.base.ClusterConstant.JAVA_CMD; +import static org.apache.hugegraph.ct.base.ClusterConstant.LOG4J_FILE; import static org.apache.hugegraph.ct.base.ClusterConstant.STORE_JAR_PREFIX; +import static org.apache.hugegraph.ct.base.ClusterConstant.STORE_LIB_PATH; import static org.apache.hugegraph.ct.base.ClusterConstant.getFileInDir; import static org.apache.hugegraph.ct.base.ClusterConstant.isJava11OrHigher; @@ -33,8 +35,13 @@ public class StoreNodeWrapper extends AbstractNodeWrapper { public StoreNodeWrapper(int clusterId, int index) { super(); + this.fileNames = new ArrayList<>( + List.of(LOG4J_FILE)); this.clusterIndex = clusterId; this.index = index; + this.workPath = STORE_LIB_PATH; + createNodeDir(); + createLogDir(); } @Override From 31c58f40a75b679c3e79be264f27f36dbf793d1a Mon Sep 17 00:00:00 2001 From: 145425491 <1245294786@qq.com> Date: Sat, 17 Aug 2024 17:05:47 +0800 Subject: [PATCH 12/40] fix(it): add configuration files in dist --- .../src/assembly/static/computer.yaml | 39 +++++ .../static/graphs/hugegraph.properties | 126 ++++++++++++++++ .../static/gremlin-driver-settings.yaml | 25 ++++ .../src/assembly/static/gremlin-server.yaml | 127 ++++++++++++++++ .../assembly/static/hugegraph-server.keystore | Bin 0 -> 1733 bytes .../src/assembly/static/hugegraph.license | Bin 0 -> 1499 bytes .../hg-ct-dist/src/assembly/static/log4j2.xml | 135 ++++++++++++++++++ .../static/pd-application.yml.template | 75 ++++++++++ .../src/assembly/static/remote-objects.yaml | 30 ++++ .../src/assembly/static/remote.yaml | 25 ++++ .../static/rest-server.properties.template | 71 +++++++++ .../static/store-application.yml.template | 64 +++++++++ .../src/assembly/static/verify-license.json | 6 + .../hugegraph/ct/config/ServerConfig.java | 60 ++++++++ 14 files changed, 783 insertions(+) create mode 100644 hugegraph-cluster-test/hg-ct-dist/src/assembly/static/computer.yaml create mode 100644 hugegraph-cluster-test/hg-ct-dist/src/assembly/static/graphs/hugegraph.properties create mode 100644 hugegraph-cluster-test/hg-ct-dist/src/assembly/static/gremlin-driver-settings.yaml create mode 100644 hugegraph-cluster-test/hg-ct-dist/src/assembly/static/gremlin-server.yaml create mode 100644 hugegraph-cluster-test/hg-ct-dist/src/assembly/static/hugegraph-server.keystore create mode 100644 hugegraph-cluster-test/hg-ct-dist/src/assembly/static/hugegraph.license create mode 100644 hugegraph-cluster-test/hg-ct-dist/src/assembly/static/log4j2.xml create mode 100644 hugegraph-cluster-test/hg-ct-dist/src/assembly/static/pd-application.yml.template create mode 100644 hugegraph-cluster-test/hg-ct-dist/src/assembly/static/remote-objects.yaml create mode 100644 hugegraph-cluster-test/hg-ct-dist/src/assembly/static/remote.yaml create mode 100644 hugegraph-cluster-test/hg-ct-dist/src/assembly/static/rest-server.properties.template create mode 100644 hugegraph-cluster-test/hg-ct-dist/src/assembly/static/store-application.yml.template create mode 100644 hugegraph-cluster-test/hg-ct-dist/src/assembly/static/verify-license.json create mode 100644 hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/config/ServerConfig.java diff --git a/hugegraph-cluster-test/hg-ct-dist/src/assembly/static/computer.yaml b/hugegraph-cluster-test/hg-ct-dist/src/assembly/static/computer.yaml new file mode 100644 index 0000000000..1c69388bb0 --- /dev/null +++ b/hugegraph-cluster-test/hg-ct-dist/src/assembly/static/computer.yaml @@ -0,0 +1,39 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# common parameters +common: { + worker_heap: 10000, + vertex_input_dir: /data, + workers: 51, + zookeeper_list: "127.0.0.1:2181", + max_edges_per_segment: 10485760, + edges_immutable: true, + partitions: 255, + compute_threads: 5, + input_threads: 5, + message_async: false, + message_queue_size: 1000, + message_send_threads: 10, + messages_per_segment: 104857600, + hugegraph_url: "http://127.0.0.1:8080", + hugegraph_name: hugegraph, + hugegraph_timeout: 60 +} + +env: { + computer_home: /home/computer +} diff --git a/hugegraph-cluster-test/hg-ct-dist/src/assembly/static/graphs/hugegraph.properties b/hugegraph-cluster-test/hg-ct-dist/src/assembly/static/graphs/hugegraph.properties new file mode 100644 index 0000000000..4fcb400129 --- /dev/null +++ b/hugegraph-cluster-test/hg-ct-dist/src/assembly/static/graphs/hugegraph.properties @@ -0,0 +1,126 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# gremlin entrance to create graph +# auth config: org.apache.hugegraph.auth.HugeFactoryAuthProxy +gremlin.graph=org.apache.hugegraph.HugeFactory + +# cache config +#schema.cache_capacity=100000 +# vertex-cache default is 1000w, 10min expired +vertex.cache_type=l2 +#vertex.cache_capacity=10000000 +#vertex.cache_expire=600 +# edge-cache default is 100w, 10min expired +edge.cache_type=l2 +#edge.cache_capacity=1000000 +#edge.cache_expire=600 + + +# schema illegal name template +#schema.illegal_name_regex=\s+|~.* + +#vertex.default_label=vertex + +backend=hstore +serializer=binary + +store=hugegraph + +# pd config +pd.peers=127.0.0.1:8686 + +# task config +task.scheduler_type=local +task.schedule_period=10 +task.retry=0 +task.wait_timeout=10 + +# raft config +raft.mode=false +raft.path=./raft-log +raft.safe_read=true +raft.use_replicator_pipeline=true +raft.election_timeout=10000 +raft.snapshot_interval=3600 +raft.backend_threads=48 +raft.read_index_threads=8 +raft.snapshot_threads=4 +raft.snapshot_parallel_compress=false +raft.snapshot_compress_threads=4 +raft.snapshot_decompress_threads=4 +raft.read_strategy=ReadOnlyLeaseBased +raft.queue_size=16384 +raft.queue_publish_timeout=60 +raft.apply_batch=1 +raft.rpc_threads=80 +raft.rpc_connect_timeout=5000 +raft.rpc_timeout=60 +raft.install_snapshot_rpc_timeout=36000 + +# search config +search.text_analyzer=jieba +search.text_analyzer_mode=INDEX + +# rocksdb backend config +#rocksdb.data_path=/path/to/disk +#rocksdb.wal_path=/path/to/disk + + +# cassandra backend config +cassandra.host=localhost +cassandra.port=9042 +cassandra.username= +cassandra.password= +#cassandra.connect_timeout=5 +#cassandra.read_timeout=20 +#cassandra.keyspace.strategy=SimpleStrategy +#cassandra.keyspace.replication=3 + +# hbase backend config +#hbase.hosts=localhost +#hbase.port=2181 +#hbase.znode_parent=/hbase +#hbase.threads_max=64 +# IMPORTANT: recommend to modify the HBase partition number +# by the actual/env data amount & RS amount before init store +# It will influence the load speed a lot +#hbase.enable_partition=true +#hbase.vertex_partitions=10 +#hbase.edge_partitions=30 + +# mysql backend config +#jdbc.driver=com.mysql.jdbc.Driver +#jdbc.url=jdbc:mysql://127.0.0.1:3306 +#jdbc.username=root +#jdbc.password= +#jdbc.reconnect_max_times=3 +#jdbc.reconnect_interval=3 +#jdbc.ssl_mode=false + +# postgresql & cockroachdb backend config +#jdbc.driver=org.postgresql.Driver +#jdbc.url=jdbc:postgresql://localhost:5432/ +#jdbc.username=postgres +#jdbc.password= +#jdbc.postgresql.connect_database=template1 + +# palo backend config +#palo.host=127.0.0.1 +#palo.poll_interval=10 +#palo.temp_dir=./palo-data +#palo.file_limit_size=32 diff --git a/hugegraph-cluster-test/hg-ct-dist/src/assembly/static/gremlin-driver-settings.yaml b/hugegraph-cluster-test/hg-ct-dist/src/assembly/static/gremlin-driver-settings.yaml new file mode 100644 index 0000000000..55f38ab97d --- /dev/null +++ b/hugegraph-cluster-test/hg-ct-dist/src/assembly/static/gremlin-driver-settings.yaml @@ -0,0 +1,25 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +hosts: [localhost] +port: 8182 +serializer: { + className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV1d0, + config: { + serializeResultToString: false, + ioRegistries: [org.apache.hugegraph.io.HugeGraphIoRegistry] + } +} diff --git a/hugegraph-cluster-test/hg-ct-dist/src/assembly/static/gremlin-server.yaml b/hugegraph-cluster-test/hg-ct-dist/src/assembly/static/gremlin-server.yaml new file mode 100644 index 0000000000..048dded559 --- /dev/null +++ b/hugegraph-cluster-test/hg-ct-dist/src/assembly/static/gremlin-server.yaml @@ -0,0 +1,127 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# host and port of gremlin server, need to be consistent with host and port in rest-server.properties +host: 127.0.0.1 +port: 8182 + +# timeout in ms of gremlin query +evaluationTimeout: 30000 + +channelizer: org.apache.tinkerpop.gremlin.server.channel.WsAndHttpChannelizer +# don't set graph at here, this happens after support for dynamically adding graph +graphs: { +} +scriptEngines: { + gremlin-groovy: { + staticImports: [ + org.opencypher.gremlin.process.traversal.CustomPredicates.*', + org.opencypher.gremlin.traversal.CustomFunctions.* + ], + plugins: { + org.apache.hugegraph.plugin.HugeGraphGremlinPlugin: {}, + org.apache.tinkerpop.gremlin.server.jsr223.GremlinServerGremlinPlugin: {}, + org.apache.tinkerpop.gremlin.jsr223.ImportGremlinPlugin: { + classImports: [ + java.lang.Math, + org.apache.hugegraph.backend.id.IdGenerator, + org.apache.hugegraph.type.define.Directions, + org.apache.hugegraph.type.define.NodeRole, + org.apache.hugegraph.masterelection.GlobalMasterInfo, + org.apache.hugegraph.util.DateUtil, + org.apache.hugegraph.traversal.algorithm.CollectionPathsTraverser, + org.apache.hugegraph.traversal.algorithm.CountTraverser, + org.apache.hugegraph.traversal.algorithm.CustomizedCrosspointsTraverser, + org.apache.hugegraph.traversal.algorithm.CustomizePathsTraverser, + org.apache.hugegraph.traversal.algorithm.FusiformSimilarityTraverser, + org.apache.hugegraph.traversal.algorithm.HugeTraverser, + org.apache.hugegraph.traversal.algorithm.JaccardSimilarTraverser, + org.apache.hugegraph.traversal.algorithm.KneighborTraverser, + org.apache.hugegraph.traversal.algorithm.KoutTraverser, + org.apache.hugegraph.traversal.algorithm.MultiNodeShortestPathTraverser, + org.apache.hugegraph.traversal.algorithm.NeighborRankTraverser, + org.apache.hugegraph.traversal.algorithm.PathsTraverser, + org.apache.hugegraph.traversal.algorithm.PersonalRankTraverser, + org.apache.hugegraph.traversal.algorithm.SameNeighborTraverser, + org.apache.hugegraph.traversal.algorithm.ShortestPathTraverser, + org.apache.hugegraph.traversal.algorithm.SingleSourceShortestPathTraverser, + org.apache.hugegraph.traversal.algorithm.SubGraphTraverser, + org.apache.hugegraph.traversal.algorithm.TemplatePathsTraverser, + org.apache.hugegraph.traversal.algorithm.steps.EdgeStep, + org.apache.hugegraph.traversal.algorithm.steps.RepeatEdgeStep, + org.apache.hugegraph.traversal.algorithm.steps.WeightedEdgeStep, + org.apache.hugegraph.traversal.optimize.ConditionP, + org.apache.hugegraph.traversal.optimize.Text, + org.apache.hugegraph.traversal.optimize.TraversalUtil, + org.opencypher.gremlin.traversal.CustomFunctions, + org.opencypher.gremlin.traversal.CustomPredicate + ], + methodImports: [ + java.lang.Math#*, + org.opencypher.gremlin.traversal.CustomPredicate#*, + org.opencypher.gremlin.traversal.CustomFunctions#* + ] + }, + org.apache.tinkerpop.gremlin.jsr223.ScriptFileGremlinPlugin: { + files: [scripts/empty-sample.groovy] + } + } + } +} +serializers: + - {className: org.apache.tinkerpop.gremlin.driver.ser.GraphBinaryMessageSerializerV1, + config: { + serializeResultToString: false, + ioRegistries: [org.apache.hugegraph.io.HugeGraphIoRegistry] + } + } + - {className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV1d0, + config: { + serializeResultToString: false, + ioRegistries: [org.apache.hugegraph.io.HugeGraphIoRegistry] + } + } + - {className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV2d0, + config: { + serializeResultToString: false, + ioRegistries: [org.apache.hugegraph.io.HugeGraphIoRegistry] + } + } + - {className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV3d0, + config: { + serializeResultToString: false, + ioRegistries: [org.apache.hugegraph.io.HugeGraphIoRegistry] + } + } +metrics: { + consoleReporter: {enabled: false, interval: 180000}, + csvReporter: {enabled: false, interval: 180000, fileName: ./metrics/gremlin-server-metrics.csv}, + jmxReporter: {enabled: false}, + slf4jReporter: {enabled: false, interval: 180000}, + gangliaReporter: {enabled: false, interval: 180000, addressingMode: MULTICAST}, + graphiteReporter: {enabled: false, interval: 180000} +} +maxInitialLineLength: 4096 +maxHeaderSize: 8192 +maxChunkSize: 8192 +maxContentLength: 65536 +maxAccumulationBufferComponents: 1024 +resultIterationBatchSize: 64 +writeBufferLowWaterMark: 32768 +writeBufferHighWaterMark: 65536 +ssl: { + enabled: false +} diff --git a/hugegraph-cluster-test/hg-ct-dist/src/assembly/static/hugegraph-server.keystore b/hugegraph-cluster-test/hg-ct-dist/src/assembly/static/hugegraph-server.keystore new file mode 100644 index 0000000000000000000000000000000000000000..e60c6b4c4ca066e165da3d5d880d1d780fb976fa GIT binary patch literal 1733 zcmY+Ddpy$%AIG=fE(|Ga?rAuU*g9>lOK50Vh`IC}mng;DNp@z;ZSGOxoCwvnE-uGq zDvFJhdlwG}L!yr6l3Oi0E~QnE=XpKPdCvLc^ZLGCpU?OE`Rn_}v*8^87=mZR6W|EL zEXSD}sBL@KwiMv<|GiR>0|Q((a39YG_;>@j z-2d$Da!n}8dwGrI^Jeazr<}U>@X`FvaOUzL00DKmLD@j6-U}=!sw|0~-#YB(_U&lC z;2bWbKk3MH1SjB*xD{hl9zVztK2i@k`6_a{AsjrB_*RV-5p=s7em>x9dHui`?TStC zew}Gp>C>!?6P|Te@;$LGQQ@!!h8+yzSu0*0XVnWI?$fJP2^-eKF0Cx!V*U^-{v7&A zZA)dtgq1S4RU$X4xG}fPdshqkuFQ-5jQQqNzPxSM^!`N$P^S0`-_ zX(=iHHj(PsxSFVEf0maY!V~9bRul*qF&EgQVYVAJ2g33ytqjMa`v#g3W)e>XCt&8$ z9If&8^~q8hYo?*IcbyxxCP?xwDcKHGKu(6Dd-o;A^ri$)$$tD$r(Ao8=wH@58K(W_ z@_}~?6j58xVHV?g_CpdfR*5+Z$=PkI3-MhCL^TIVk3N15Er{zpuTJWsGzsHJ%Fru! z{o15CkKJtFt}OfYy)IMcnF?&wDVLp&W7H<-_kf#+s5fv6V^)xZ{ZCw1m}vp)HD)J$SzCL@+;WnBb& zyw0C5jzAGmdy$|J5FJDV1#K%9bQ%-`3i<1bG64ledWJ>@X%o!wrg)+m{*VdL%zT>% zlRtZ8;9NEYvu)`BV9@r^_b3!Eq#=y}Xp}6cncLNk)#myqh|?Uf zu#q_2Km9KKA=C@ZP+&<}b1Iu^JHhUU?UR|!$f-I^6W-~x5qUwla8u_tX*$ZoHT<&b3|1oa%&cIWheq1!vp7}vo&|KS@csHK&>Ce4GlhAG-Q1r zmnF8Bp{++bw3liV*ab;^waVWNQ;cbFZ9VA1Y)=RD7Lm^7r6NZm?O5cBk_7eT9(@ z#V+49ncJ&NBfmTO%vM3)>L&@ogFTk>U}`zLNH-nz>fD=Q|AZrYr&Ek8yxr5%1lJq$ zuMC8=D>7uEsuqvT5>#cyV1BMNg~w2vHB1buzv1(+;CD=JxXaDf`~hox#GZLq(_uo9 zrPofrOMz?k<-#fe_p&8jfMHP2SZt({*B$Grc^_|u%?x?dy@TIK@fTrtVsZ%qKVGz? zJ(&Vd#8Db?$uzt1l<{UG^LdhGlfFhen!o3hw%YK(kA|3QKO|X^MHcRGJK?XP)O(z- z^uo_Ssjc@571 literal 0 HcmV?d00001 diff --git a/hugegraph-cluster-test/hg-ct-dist/src/assembly/static/hugegraph.license b/hugegraph-cluster-test/hg-ct-dist/src/assembly/static/hugegraph.license new file mode 100644 index 0000000000000000000000000000000000000000..437a8ebe33666ac5b1fd10e0a598b10cc49fd5a6 GIT binary patch literal 1499 zcmZ8hNl#Nz6fO;xF}4gc*+QAhBuF8QN(C*2GFoJYQjjnRmAQesHX=qZ!7-s0S|~*k|%esUl~7cr%1O1#E?o zwggFT!`!@Gw94DymN*DE;$6(lgjvsCvXeUXjB>)K}`n{Y^y( z*1J=$OD@_R1D|Sy^fmr?S_L0s0;HrtY7U-r0sn&+e0ic(co>5CPFy|V<#uNs?;#Ec7u1Gt<;g$0Vr=7xlELCD zQhEU68MD^B=5GJGFLmc|ut#0(mx?G?1C(&8c;dkP>CP-HgAM()#q(e3AG7Bi?b$gc zoF$i4b<#JDY=Gm=@nYNCxKo~u8#E-^iuiz-Q3!ClD;}!eP-L#}AE801hwv_yj#g-- zH^7d>x$~emz`hM5RL6C4WG|q!Pzv4a774s!jzm)mmjx`USDj~)y9D7-WECWzJma)+ zL!(FUq2a0}2I<0w8Ym2(%~cQ;TSkOJH!u{IxIxR9^ao=kJFPD)$>u>{I=^? zi*`m&>S{TkfbH|^D77bKUEocSeQup*cLC0P@Y2$%(ZU(-41u(OPVV*KjdvbKYFI|Z lX$Ioxu@X + + + + + + + logs + hugegraph-pd + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/hugegraph-cluster-test/hg-ct-dist/src/assembly/static/pd-application.yml.template b/hugegraph-cluster-test/hg-ct-dist/src/assembly/static/pd-application.yml.template new file mode 100644 index 0000000000..838be5e7a9 --- /dev/null +++ b/hugegraph-cluster-test/hg-ct-dist/src/assembly/static/pd-application.yml.template @@ -0,0 +1,75 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +spring: + application: + name: hugegraph-pd + +management: + metrics: + export: + prometheus: + enabled: true + endpoints: + web: + exposure: + include: "*" + +logging: + config: file:./conf/log4j2.xml +license: + verify-path: ./conf/verify-license.json + license-path: ./conf/hugegraph.license +grpc: + port: $GRPC_PORT$ + host: $GRPC_HOST$ + +server: + port : $REST_PORT$ + +pd: + # 存储路径 + data-path: $PD_DATA_PATH$ + # 自动扩容的检查周期,定时检查每个 store 的分区数量,自动进行分区数量平衡 + patrol-interval: 1800 + # 初始 store 列表,在列表内的 store 自动激活 + initial-store-count: $STORE_COUNT$ + # grpc IP:grpc port + initial-store-list: $STORE_GRPC_LIST$ + + +raft: + address: $RAFT_ADDRESS$ + peers-list: $RAFT_PEERS_LIST$ + +store: + # store 下线时间。超过该时间,认为 store 永久不可用,分配副本到其他机器,单位秒 + max-down-time: 172800 + # 是否开启 store 监控数据存储 + monitor_data_enabled: true + # 监控数据的间隔,minute (默认), hour, second + # default: 1 min * 1 day = 1440 + monitor_data_interval: 1 minute + # 监控数据的保留时间 1 天; day, month, year + monitor_data_retention: 1 day + initial-store-count: 1 + +partition: + # 默认每个分区副本数 + default-shard-count: 1 + # 默认每机器最大副本数,初始分区数 = store-max-shard-count * store-number / default-shard-count + store-max-shard-count: 12 diff --git a/hugegraph-cluster-test/hg-ct-dist/src/assembly/static/remote-objects.yaml b/hugegraph-cluster-test/hg-ct-dist/src/assembly/static/remote-objects.yaml new file mode 100644 index 0000000000..39679d8c30 --- /dev/null +++ b/hugegraph-cluster-test/hg-ct-dist/src/assembly/static/remote-objects.yaml @@ -0,0 +1,30 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +hosts: [localhost] +port: 8182 +serializer: { + className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV1d0, + config: { + serializeResultToString: false, + # The duplication of HugeGraphIoRegistry is meant to fix a bug in the + # 'org.apache.tinkerpop.gremlin.driver.Settings:from(Configuration)' method. + ioRegistries: [ + org.apache.hugegraph.io.HugeGraphIoRegistry, + org.apache.hugegraph.io.HugeGraphIoRegistry + ] + } +} diff --git a/hugegraph-cluster-test/hg-ct-dist/src/assembly/static/remote.yaml b/hugegraph-cluster-test/hg-ct-dist/src/assembly/static/remote.yaml new file mode 100644 index 0000000000..55f38ab97d --- /dev/null +++ b/hugegraph-cluster-test/hg-ct-dist/src/assembly/static/remote.yaml @@ -0,0 +1,25 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +hosts: [localhost] +port: 8182 +serializer: { + className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV1d0, + config: { + serializeResultToString: false, + ioRegistries: [org.apache.hugegraph.io.HugeGraphIoRegistry] + } +} diff --git a/hugegraph-cluster-test/hg-ct-dist/src/assembly/static/rest-server.properties.template b/hugegraph-cluster-test/hg-ct-dist/src/assembly/static/rest-server.properties.template new file mode 100644 index 0000000000..62f8fe8a4d --- /dev/null +++ b/hugegraph-cluster-test/hg-ct-dist/src/assembly/static/rest-server.properties.template @@ -0,0 +1,71 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# bind url +# could use '0.0.0.0' or specified (real)IP to expose external network access +restserver.url=http://$REST_SERVER_ADDRESS$ +# gremlin server url, need to be consistent with host and port in gremlin-server.yaml +#gremlinserver.url=http://$REST_SERVER_ADDRESS$ + +graphs=./conf/graphs + +# The maximum thread ratio for batch writing, only take effect if the batch.max_write_threads is 0 +batch.max_write_ratio=80 +batch.max_write_threads=0 + +# configuration of arthas +arthas.telnet_port=8562 +arthas.http_port=8561 +arthas.ip=127.0.0.1 +arthas.disabled_commands=jad + +# authentication configs +# choose 'org.apache.hugegraph.auth.StandardAuthenticator' or +# 'org.apache.hugegraph.auth.ConfigAuthenticator' +#auth.authenticator= + +# for StandardAuthenticator mode +#auth.graph_store=hugegraph +# auth client config +#auth.remote_url=127.0.0.1:8899,127.0.0.1:8898,127.0.0.1:8897 + +# for ConfigAuthenticator mode +#auth.admin_token= +#auth.user_tokens=[] + +# rpc server configs for multi graph-servers or raft-servers +rpc.server_host=$RPC_HOST$ +rpc.server_port=$RPC_PORT$ +#rpc.server_timeout=30 + +# rpc client configs (like enable to keep cache consistency) +#rpc.remote_url=127.0.0.1:8091,127.0.0.1:8092,127.0.0.1:8093 +#rpc.client_connect_timeout=20 +#rpc.client_reconnect_period=10 +#rpc.client_read_timeout=40 +#rpc.client_retries=3 +#rpc.client_load_balancer=consistentHash + +# raft group initial peers +#raft.group_peers=127.0.0.1:8091,127.0.0.1:8092,127.0.0.1:8093 + +# lightweight load balancing (beta) +server.id=$SERVER_ID$ +server.role=$ROLE$ + +# slow query log +log.slow_query_threshold=1000 diff --git a/hugegraph-cluster-test/hg-ct-dist/src/assembly/static/store-application.yml.template b/hugegraph-cluster-test/hg-ct-dist/src/assembly/static/store-application.yml.template new file mode 100644 index 0000000000..ddb664486a --- /dev/null +++ b/hugegraph-cluster-test/hg-ct-dist/src/assembly/static/store-application.yml.template @@ -0,0 +1,64 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +pdserver: + # pd 服务地址,多个 pd 地址用逗号分割 + address: $PD_SERVER_ADDRESS$ + +management: + metrics: + export: + prometheus: + enabled: true + endpoints: + web: + exposure: + include: "*" + +grpc: + # grpc 的服务地址 + host: $GRPC_HOST$ + port: $GRPC_PORT$ + netty-server: + max-inbound-message-size: 1000MB +raft: + # raft 缓存队列大小 + disruptorBufferSize: 1024 + address: $RAFT_ADDRESS$ + max-log-file-size: 600000000000 + # 快照生成时间间隔,单位秒 + snapshotInterval: 1800 +server: + # rest 服务地址 + port: $REST_PORT$ + +app: + # 存储路径,支持多个路径,逗号分割 + data-path: $STORE_DATA_PATH$ + #raft-path: $STORE_DATA_PATH$ + +spring: + application: + name: store-node-grpc-server + profiles: + active: default + include: pd + +logging: + config: 'file:./conf/log4j2.xml' + level: + root: info diff --git a/hugegraph-cluster-test/hg-ct-dist/src/assembly/static/verify-license.json b/hugegraph-cluster-test/hg-ct-dist/src/assembly/static/verify-license.json new file mode 100644 index 0000000000..868ccbebbb --- /dev/null +++ b/hugegraph-cluster-test/hg-ct-dist/src/assembly/static/verify-license.json @@ -0,0 +1,6 @@ +{ + "subject": "hugegraph-license", + "public_alias": "publiccert", + "store_ticket": "803b6cc3-d144-47e8-948f-ec8b39c8881e", + "publickey_path": "/public-certs.store" +} diff --git a/hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/config/ServerConfig.java b/hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/config/ServerConfig.java new file mode 100644 index 0000000000..c166aa4e9c --- /dev/null +++ b/hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/config/ServerConfig.java @@ -0,0 +1,60 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.hugegraph.ct.config; + +import static org.apache.hugegraph.ct.base.ClusterConstant.CT_PACKAGE_PATH; +import static org.apache.hugegraph.ct.base.ClusterConstant.SERVER_PROPERTIES; +import static org.apache.hugegraph.ct.base.ClusterConstant.SERVER_TEMPLATE_FILE; +import static org.apache.hugegraph.ct.base.EnvUtil.getAvailablePort; + +import lombok.Getter; + +public class ServerConfig extends AbstractConfig { + + @Getter + private int rpcPort, restPort; + @Getter + private String restHost, rpcHost; + + public ServerConfig() { + readTemplate(CT_PACKAGE_PATH + SERVER_TEMPLATE_FILE); + this.fileName = SERVER_PROPERTIES; + this.restHost = "127.0.0.1"; + this.rpcHost = "127.0.0.1"; + this.rpcPort = getAvailablePort(); + this.restPort = getAvailablePort(); + properties.put("REST_SERVER_ADDRESS", restHost + ":" + restPort); + properties.put("RPC_PORT", String.valueOf(rpcPort)); + properties.put("RPC_HOST", rpcHost); + } + + public void setRestHost(String restHost) { + this.restHost = restHost; + setProperty("REST_SERVER_ADDRESS", restHost + ":" + restPort); + } + + public void setServerID(String serverID) { + setProperty("SERVER_ID", serverID); + } + + public void setRole(String role) { + setProperty("ROLE", role); + } +} + + From 9f02e27bd6167e648441c42429606ca648ccb117 Mon Sep 17 00:00:00 2001 From: 145425491 <1245294786@qq.com> Date: Sat, 17 Aug 2024 21:32:36 +0800 Subject: [PATCH 13/40] fix(it): get hugegraph.properties through template file --- ...operties => hugegraph.properties.template} | 2 +- .../hugegraph/ct/base/ClusterConstant.java | 19 +++------ .../hugegraph/ct/config/AbstractConfig.java | 13 +++++-- .../hugegraph/ct/config/ClusterConf.java | 9 +++++ .../hugegraph/ct/config/GraphConfig.java | 39 +++++++++++++++++++ .../apache/hugegraph/ct/env/AbstractEnv.java | 4 ++ .../hugegraph/ct/node/ServerNodeWrapper.java | 2 - .../main/java/org/apache/hugegraph/Main.java | 29 ++++++++++++++ hugegraph-cluster-test/pom.xml | 2 +- 9 files changed, 98 insertions(+), 21 deletions(-) rename hugegraph-cluster-test/hg-ct-dist/src/assembly/static/{graphs/hugegraph.properties => hugegraph.properties.template} (99%) create mode 100644 hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/config/GraphConfig.java create mode 100644 hugegraph-cluster-test/hg-ct-test/src/main/java/org/apache/hugegraph/Main.java diff --git a/hugegraph-cluster-test/hg-ct-dist/src/assembly/static/graphs/hugegraph.properties b/hugegraph-cluster-test/hg-ct-dist/src/assembly/static/hugegraph.properties.template similarity index 99% rename from hugegraph-cluster-test/hg-ct-dist/src/assembly/static/graphs/hugegraph.properties rename to hugegraph-cluster-test/hg-ct-dist/src/assembly/static/hugegraph.properties.template index 4fcb400129..8eaf0adffb 100644 --- a/hugegraph-cluster-test/hg-ct-dist/src/assembly/static/graphs/hugegraph.properties +++ b/hugegraph-cluster-test/hg-ct-dist/src/assembly/static/hugegraph.properties.template @@ -42,7 +42,7 @@ serializer=binary store=hugegraph # pd config -pd.peers=127.0.0.1:8686 +pd.peers=$PD_PEERS_LIST$ # task config task.scheduler_type=local diff --git a/hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/base/ClusterConstant.java b/hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/base/ClusterConstant.java index 11850c8e58..4dd5d0200a 100644 --- a/hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/base/ClusterConstant.java +++ b/hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/base/ClusterConstant.java @@ -30,15 +30,14 @@ public class ClusterConstant { public static final String EXT_DIR = "ext"; public static final String PLUGINS_DIR = "plugins"; public static final String BIN_DIR = "bin"; - public static final String DIST_DIR = "dist"; public static final String CONF_DIR = "conf"; - public static final String PD_PACKAGE_PREFIX = "hugegraph-pd"; + public static final String PD_PACKAGE_PREFIX = "apache-hugegraph-pd-incubating"; public static final String PD_JAR_PREFIX = "hg-pd-service"; - public static final String STORE_PACKAGE_PREFIX = "hugegraph-store"; + public static final String STORE_PACKAGE_PREFIX = "apache-hugegraph-store-incubating"; public static final String STORE_JAR_PREFIX = "hg-store-node"; - public static final String SERVER_PACKAGE_PREFIX = "apache-hugegraph-incubating"; - public static final String CT_PACKAGE_PREFIX = "apache-hugegraph-incubating-ct"; + public static final String SERVER_PACKAGE_PREFIX = "apache-hugegraph-server-incubating"; + public static final String CT_PACKAGE_PREFIX = "apache-hugegraph-ct-incubating"; public static final String APPLICATION_FILE = "application.yml"; public static final String SERVER_PROPERTIES = "rest-server.properties"; @@ -49,6 +48,7 @@ public class ClusterConstant { public static final String PD_TEMPLATE_FILE = "pd-application.yml.template"; public static final String STORE_TEMPLATE_FILE = "store-application.yml.template"; public static final String SERVER_TEMPLATE_FILE = "rest-server.properties.template"; + public static final String GRAPH_TEMPLATE_FILE = "hugegraph.properties.template"; public static final String GREMLIN_DRIVER_SETTING_FILE = "gremlin-driver-settings.yaml"; public static final String GREMLIN_SERVER_FILE = "gremlin-server.yaml"; public static final String COMPUTER_SETTING_FILE = "computer.yaml"; @@ -67,8 +67,6 @@ public class ClusterConstant { System.getProperty(USER_DIR) + File.separator + "hugegraph-pd" - + File.separator - + DIST_DIR + File.separator; public static final String PD_LIB_PATH = @@ -81,8 +79,6 @@ public class ClusterConstant { System.getProperty(USER_DIR) + File.separator + "hugegraph-store" - + File.separator - + DIST_DIR + File.separator; public static final String STORE_LIB_PATH = @@ -111,11 +107,6 @@ public class ClusterConstant { getFileInDir(CT_DIST_PATH, CT_PACKAGE_PREFIX) + File.separator; - public static final String IT_LOG_PATH = - CT_PACKAGE_PATH - + LOG - + File.separator; - private ClusterConstant() { throw new IllegalStateException("Utility class"); } diff --git a/hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/config/AbstractConfig.java b/hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/config/AbstractConfig.java index e076c26cf2..96e585bd64 100644 --- a/hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/config/AbstractConfig.java +++ b/hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/config/AbstractConfig.java @@ -21,6 +21,7 @@ import java.io.FileWriter; import java.io.IOException; import java.nio.file.Files; +import java.nio.file.Path; import java.nio.file.Paths; import java.util.HashMap; import java.util.Map; @@ -52,9 +53,15 @@ protected void updateConfigs() { public void writeConfig(String filePath) { updateConfigs(); - try (FileWriter writer = new FileWriter(filePath - + File.separator - + fileName)) { + String destPath = filePath + File.separator + fileName; + try { + if (Files.notExists(Path.of(destPath).getParent())) { + Files.createDirectories(Path.of(destPath).getParent()); + } + } catch (IOException e) { + e.printStackTrace(); + } + try (FileWriter writer = new FileWriter(destPath)) { writer.write(config); } catch (IOException e) { e.printStackTrace(); diff --git a/hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/config/ClusterConf.java b/hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/config/ClusterConf.java index fe11a87e9e..fafad67fda 100644 --- a/hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/config/ClusterConf.java +++ b/hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/config/ClusterConf.java @@ -29,6 +29,7 @@ public class ClusterConf { protected List pdConfigs; protected List storeConfigs; protected List serverConfigs; + protected List graphConfigs; protected List pdGrpcList, pdRaftList, storeGrpcList; @@ -36,6 +37,7 @@ public ClusterConf(int pdCnt, int storeCnt, int serverCnt) { pdConfigs = new ArrayList<>(); storeConfigs = new ArrayList<>(); serverConfigs = new ArrayList<>(); + graphConfigs = new ArrayList<>(); pdGrpcList = new ArrayList<>(); pdRaftList = new ArrayList<>(); storeGrpcList = new ArrayList<>(); @@ -58,6 +60,9 @@ public ClusterConf(int pdCnt, int storeCnt, int serverCnt) { for (int i = 0; i < serverCnt; i++) { ServerConfig serverConfig = new ServerConfig(); serverConfigs.add(serverConfig); + GraphConfig graphConfig = new GraphConfig(); + graphConfig.setPDPeersList(pdGrpcList); + graphConfigs.add(graphConfig); } for (int i = 0; i < pdCnt; i++) { @@ -78,4 +83,8 @@ public StoreConfig getStoreConfig(int i) { public ServerConfig getServerConfig(int i) { return serverConfigs.get(i); } + + public GraphConfig getGraphConfig(int i) { + return graphConfigs.get(i); + } } diff --git a/hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/config/GraphConfig.java b/hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/config/GraphConfig.java new file mode 100644 index 0000000000..7c04f4b07c --- /dev/null +++ b/hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/config/GraphConfig.java @@ -0,0 +1,39 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.hugegraph.ct.config; + +import static org.apache.hugegraph.ct.base.ClusterConstant.CT_PACKAGE_PATH; +import static org.apache.hugegraph.ct.base.ClusterConstant.GRAPH_TEMPLATE_FILE; +import static org.apache.hugegraph.ct.base.ClusterConstant.HUGEGRAPH_PROPERTIES; + +import java.util.List; +import java.util.stream.Collectors; + +public class GraphConfig extends AbstractConfig { + + public GraphConfig() { + readTemplate(CT_PACKAGE_PATH + GRAPH_TEMPLATE_FILE); + this.fileName = HUGEGRAPH_PROPERTIES; + } + + public void setPDPeersList(List pdPeersList) { + String pdPeers = pdPeersList.stream().collect(Collectors.joining(",")); + setProperty("PD_PEERS_LIST", pdPeers); + } + +} diff --git a/hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/env/AbstractEnv.java b/hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/env/AbstractEnv.java index fb1286b1d3..f7483e9f22 100644 --- a/hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/env/AbstractEnv.java +++ b/hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/env/AbstractEnv.java @@ -24,6 +24,7 @@ import org.apache.hugegraph.ct.base.HGTestLogger; import org.apache.hugegraph.ct.config.ClusterConf; +import org.apache.hugegraph.ct.config.GraphConfig; import org.apache.hugegraph.ct.config.PDConfig; import org.apache.hugegraph.ct.config.ServerConfig; import org.apache.hugegraph.ct.config.StoreConfig; @@ -75,6 +76,7 @@ public void init(int pdCnt, int storeCnt, int serverCnt) { serverNodeWrappers.add(serverNodeWrapper); ServerConfig serverConfig = clusterConf.getServerConfig(i); serverConfig.setServerID(serverNodeWrapper.getID()); + GraphConfig graphConfig = clusterConf.getGraphConfig(i); if (i == 0) { serverConfig.setRole("master"); } else { @@ -82,6 +84,8 @@ public void init(int pdCnt, int storeCnt, int serverCnt) { } serverConfig.writeConfig(serverNodeWrapper.getNodePath() + CONF_DIR); + graphConfig.writeConfig(serverNodeWrapper.getNodePath() + + CONF_DIR); } } diff --git a/hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/node/ServerNodeWrapper.java b/hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/node/ServerNodeWrapper.java index 28bf0c3804..49fc529bbd 100644 --- a/hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/node/ServerNodeWrapper.java +++ b/hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/node/ServerNodeWrapper.java @@ -21,7 +21,6 @@ import static org.apache.hugegraph.ct.base.ClusterConstant.EXT_DIR; import static org.apache.hugegraph.ct.base.ClusterConstant.GREMLIN_DRIVER_SETTING_FILE; import static org.apache.hugegraph.ct.base.ClusterConstant.GREMLIN_SERVER_FILE; -import static org.apache.hugegraph.ct.base.ClusterConstant.HUGEGRAPH_PROPERTIES; import static org.apache.hugegraph.ct.base.ClusterConstant.HUGEGRAPH_SERVER_KEYSTORE; import static org.apache.hugegraph.ct.base.ClusterConstant.JAVA_CMD; import static org.apache.hugegraph.ct.base.ClusterConstant.LIB_DIR; @@ -46,7 +45,6 @@ public ServerNodeWrapper(int clusterIndex, int index) { this.index = index; this.fileNames = new ArrayList<>( List.of(LOG4J_FILE, - HUGEGRAPH_PROPERTIES, HUGEGRAPH_SERVER_KEYSTORE, COMPUTER_SETTING_FILE, GREMLIN_SERVER_FILE, diff --git a/hugegraph-cluster-test/hg-ct-test/src/main/java/org/apache/hugegraph/Main.java b/hugegraph-cluster-test/hg-ct-test/src/main/java/org/apache/hugegraph/Main.java new file mode 100644 index 0000000000..5ccc1e1eb1 --- /dev/null +++ b/hugegraph-cluster-test/hg-ct-test/src/main/java/org/apache/hugegraph/Main.java @@ -0,0 +1,29 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.hugegraph; + +import org.apache.hugegraph.ct.env.SimpleEnv; + +public class Main { + + public static void main(String[] args) { + SimpleEnv simpleEnv = new SimpleEnv(); + simpleEnv.init(); + simpleEnv.startCluster(); + } +} diff --git a/hugegraph-cluster-test/pom.xml b/hugegraph-cluster-test/pom.xml index 19359a2a72..e76485b739 100644 --- a/hugegraph-cluster-test/pom.xml +++ b/hugegraph-cluster-test/pom.xml @@ -42,7 +42,7 @@ 11 11 UTF-8 - apache-${release.name}-incubating-ct-${project.version} + apache-${release.name}-ct-incubating-${project.version} From 1714213d1ac8658ee61183d313ae88bca7649bae Mon Sep 17 00:00:00 2001 From: 145425491 <1245294786@qq.com> Date: Sun, 18 Aug 2024 22:18:08 +0800 Subject: [PATCH 14/40] fix(it): add 5s intervals between generation of pd nodes --- .../static/scripts/empty-sample.groovy} | 24 ++++--- .../assembly/static/scripts/example.groovy | 67 +++++++++++++++++++ .../hugegraph/ct/base/ClusterConstant.java | 5 ++ .../org/apache/hugegraph/ct/base/EnvUtil.java | 4 +- .../apache/hugegraph/ct/env/AbstractEnv.java | 11 ++- .../ct/node/AbstractNodeWrapper.java | 4 +- .../hugegraph/ct/node/BaseNodeWrapper.java | 2 +- .../hugegraph/ct/node/PDNodeWrapper.java | 4 +- .../hugegraph/ct/node/ServerNodeWrapper.java | 10 ++- .../hugegraph/ct/node/StoreNodeWrapper.java | 2 +- 10 files changed, 111 insertions(+), 22 deletions(-) rename hugegraph-cluster-test/{hg-ct-test/src/main/java/org/apache/hugegraph/Main.java => hg-ct-dist/src/assembly/static/scripts/empty-sample.groovy} (54%) create mode 100644 hugegraph-cluster-test/hg-ct-dist/src/assembly/static/scripts/example.groovy diff --git a/hugegraph-cluster-test/hg-ct-test/src/main/java/org/apache/hugegraph/Main.java b/hugegraph-cluster-test/hg-ct-dist/src/assembly/static/scripts/empty-sample.groovy similarity index 54% rename from hugegraph-cluster-test/hg-ct-test/src/main/java/org/apache/hugegraph/Main.java rename to hugegraph-cluster-test/hg-ct-dist/src/assembly/static/scripts/empty-sample.groovy index 5ccc1e1eb1..85e3669dc6 100644 --- a/hugegraph-cluster-test/hg-ct-test/src/main/java/org/apache/hugegraph/Main.java +++ b/hugegraph-cluster-test/hg-ct-dist/src/assembly/static/scripts/empty-sample.groovy @@ -14,16 +14,20 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +import org.apache.tinkerpop.gremlin.server.util.LifeCycleHook -package org.apache.hugegraph; +// an init script that returns a Map allows explicit setting of global bindings. +def globals = [:] -import org.apache.hugegraph.ct.env.SimpleEnv; +// defines a sample LifeCycleHook that prints some output to the Gremlin Server console. +// note that the name of the key in the "global" map is unimportant. +globals << [hook: [ + onStartUp : { ctx -> + ctx.logger.info("Executed once at startup of Gremlin Server.") + }, + onShutDown: { ctx -> + ctx.logger.info("Executed once at shutdown of Gremlin Server.") + } +] as LifeCycleHook] -public class Main { - - public static void main(String[] args) { - SimpleEnv simpleEnv = new SimpleEnv(); - simpleEnv.init(); - simpleEnv.startCluster(); - } -} +// define the default TraversalSource to bind queries to - this one will be named "g". diff --git a/hugegraph-cluster-test/hg-ct-dist/src/assembly/static/scripts/example.groovy b/hugegraph-cluster-test/hg-ct-dist/src/assembly/static/scripts/example.groovy new file mode 100644 index 0000000000..266206845b --- /dev/null +++ b/hugegraph-cluster-test/hg-ct-dist/src/assembly/static/scripts/example.groovy @@ -0,0 +1,67 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import org.apache.hugegraph.HugeFactory +import org.apache.hugegraph.dist.RegisterUtil +import org.apache.hugegraph.masterelection.GlobalMasterInfo +import org.apache.tinkerpop.gremlin.structure.T + +RegisterUtil.registerBackends() + +conf = "conf/graphs/hugegraph.properties" +graph = HugeFactory.open(conf) +graph.serverStarted(GlobalMasterInfo.master("server-tinkerpop")) +schema = graph.schema() + +schema.propertyKey("name").asText().ifNotExist().create() +schema.propertyKey("age").asInt().ifNotExist().create() +schema.propertyKey("city").asText().ifNotExist().create() +schema.propertyKey("weight").asDouble().ifNotExist().create() +schema.propertyKey("lang").asText().ifNotExist().create() +schema.propertyKey("date").asText().ifNotExist().create() +schema.propertyKey("price").asInt().ifNotExist().create() + +schema.vertexLabel("person").properties("name", "age", "city").primaryKeys("name").ifNotExist().create() +schema.vertexLabel("software").properties("name", "lang", "price").primaryKeys("name").ifNotExist().create() +schema.indexLabel("personByCity").onV("person").by("city").secondary().ifNotExist().create() +schema.indexLabel("personByAgeAndCity").onV("person").by("age", "city").secondary().ifNotExist().create() +schema.indexLabel("softwareByPrice").onV("software").by("price").range().ifNotExist().create() +schema.edgeLabel("knows").sourceLabel("person").targetLabel("person").properties("date", "weight").ifNotExist().create() +schema.edgeLabel("created").sourceLabel("person").targetLabel("software").properties("date", "weight").ifNotExist().create() +schema.indexLabel("createdByDate").onE("created").by("date").secondary().ifNotExist().create() +schema.indexLabel("createdByWeight").onE("created").by("weight").range().ifNotExist().create() +schema.indexLabel("knowsByWeight").onE("knows").by("weight").range().ifNotExist().create() + +marko = graph.addVertex(T.label, "person", "name", "marko", "age", 29, "city", "Beijing") +vadas = graph.addVertex(T.label, "person", "name", "vadas", "age", 27, "city", "Hongkong") +lop = graph.addVertex(T.label, "software", "name", "lop", "lang", "java", "price", 328) +josh = graph.addVertex(T.label, "person", "name", "josh", "age", 32, "city", "Beijing") +ripple = graph.addVertex(T.label, "software", "name", "ripple", "lang", "java", "price", 199) +peter = graph.addVertex(T.label, "person", "name", "peter", "age", 35, "city", "Shanghai") + +marko.addEdge("knows", vadas, "date", "20160110", "weight", 0.5) +marko.addEdge("knows", josh, "date", "20130220", "weight", 1.0) +marko.addEdge("created", lop, "date", "20171210", "weight", 0.4) +josh.addEdge("created", lop, "date", "20091111", "weight", 0.4) +josh.addEdge("created", ripple, "date", "20171210", "weight", 1.0) +peter.addEdge("created", lop, "date", "20170324", "weight", 0.2) + +graph.tx().commit() + +g = graph.traversal() + +System.out.println(">>>> query all vertices: size=" + g.V().toList().size()) +System.out.println(">>>> query all edges: size=" + g.E().toList().size()) diff --git a/hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/base/ClusterConstant.java b/hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/base/ClusterConstant.java index 4dd5d0200a..fee0f8c76f 100644 --- a/hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/base/ClusterConstant.java +++ b/hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/base/ClusterConstant.java @@ -42,11 +42,14 @@ public class ClusterConstant { public static final String APPLICATION_FILE = "application.yml"; public static final String SERVER_PROPERTIES = "rest-server.properties"; public static final String HUGEGRAPH_PROPERTIES = "graphs/hugegraph.properties"; + public static final String LOG4J_FILE = "log4j2.xml"; public static final String VERIFY_LICENSE_FILE = "verify-license.json"; public static final String LICENSE_FILE = "hugegraph.license"; public static final String PD_TEMPLATE_FILE = "pd-application.yml.template"; + public static final String STORE_TEMPLATE_FILE = "store-application.yml.template"; + public static final String SERVER_TEMPLATE_FILE = "rest-server.properties.template"; public static final String GRAPH_TEMPLATE_FILE = "hugegraph.properties.template"; public static final String GREMLIN_DRIVER_SETTING_FILE = "gremlin-driver-settings.yaml"; @@ -55,6 +58,8 @@ public class ClusterConstant { public static final String HUGEGRAPH_SERVER_KEYSTORE = "hugegraph-server.keystore"; public static final String REMOTE_SETTING_FILE = "remote.yaml"; public static final String REMOTE_OBJECTS_SETTING_FILE = "remote-objects.yaml"; + public static final String EMPTY_SAMPLE_GROOVY_FILE = "scripts/empty-sample.groovy"; + public static final String EXAMPLE_GROOVY_FILE = "scripts/example.groovy"; public static final String JAVA_CMD = System.getProperty("java.home") diff --git a/hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/base/EnvUtil.java b/hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/base/EnvUtil.java index 5ff32261f1..790c2b90d0 100644 --- a/hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/base/EnvUtil.java +++ b/hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/base/EnvUtil.java @@ -40,10 +40,10 @@ public static int getAvailablePort() { } ports.add(port); return port; - }catch (IOException e) { + } catch (IOException e) { LOG.error("fail to get available ports", e); return -1; - } + } } } diff --git a/hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/env/AbstractEnv.java b/hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/env/AbstractEnv.java index f7483e9f22..2be2a8c81c 100644 --- a/hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/env/AbstractEnv.java +++ b/hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/env/AbstractEnv.java @@ -91,10 +91,17 @@ public void init(int pdCnt, int storeCnt, int serverCnt) { @Override public void startCluster() { - for (PDNodeWrapper pdNodeWrapper : pdNodeWrappers) { + for (int i = 0; i < pdNodeWrappers.size(); i++) { + PDNodeWrapper pdNodeWrapper = pdNodeWrappers.get(i); pdNodeWrapper.start(); + try { + Thread.sleep(5000); + } catch (InterruptedException e) { + throw new RuntimeException(e); + } } - for (StoreNodeWrapper storeNodeWrapper : storeNodeWrappers) { + for (int i = 0; i < storeNodeWrappers.size(); i++) { + StoreNodeWrapper storeNodeWrapper = storeNodeWrappers.get(i); storeNodeWrapper.start(); } for (ServerNodeWrapper serverNodeWrapper : serverNodeWrappers) { diff --git a/hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/node/AbstractNodeWrapper.java b/hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/node/AbstractNodeWrapper.java index 287122d549..0c8b258824 100644 --- a/hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/node/AbstractNodeWrapper.java +++ b/hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/node/AbstractNodeWrapper.java @@ -17,7 +17,6 @@ package org.apache.hugegraph.ct.node; -import static org.apache.hugegraph.ct.base.ClusterConstant.CONF_DIR; import static org.apache.hugegraph.ct.base.ClusterConstant.CT_PACKAGE_PATH; import java.io.File; @@ -63,8 +62,7 @@ public AbstractNodeWrapper() { * Node Dir should be created before changing Config */ @Override - public void createNodeDir() { - String destDir = getNodePath() + CONF_DIR + File.separator; + public void createNodeDir(String destDir) { try { try { if (!new File(destDir).exists()) { diff --git a/hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/node/BaseNodeWrapper.java b/hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/node/BaseNodeWrapper.java index ddde71b6f0..5fabfd1996 100644 --- a/hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/node/BaseNodeWrapper.java +++ b/hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/node/BaseNodeWrapper.java @@ -19,7 +19,7 @@ public interface BaseNodeWrapper { - void createNodeDir(); + void createNodeDir(String destDir); void createLogDir(); diff --git a/hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/node/PDNodeWrapper.java b/hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/node/PDNodeWrapper.java index 548d67ac8c..73f54a493d 100644 --- a/hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/node/PDNodeWrapper.java +++ b/hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/node/PDNodeWrapper.java @@ -43,7 +43,7 @@ public PDNodeWrapper() { VERIFY_LICENSE_FILE) ); this.workPath = PD_LIB_PATH; - createNodeDir(); + createNodeDir(getNodePath() + CONF_DIR + File.separator); createLogDir(); } @@ -57,7 +57,7 @@ public PDNodeWrapper(int clusterIndex, int index) { VERIFY_LICENSE_FILE) ); this.workPath = PD_LIB_PATH; - createNodeDir(); + createNodeDir(getNodePath() + CONF_DIR + File.separator); createLogDir(); } diff --git a/hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/node/ServerNodeWrapper.java b/hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/node/ServerNodeWrapper.java index 49fc529bbd..28694dc7ad 100644 --- a/hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/node/ServerNodeWrapper.java +++ b/hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/node/ServerNodeWrapper.java @@ -18,6 +18,9 @@ package org.apache.hugegraph.ct.node; import static org.apache.hugegraph.ct.base.ClusterConstant.COMPUTER_SETTING_FILE; +import static org.apache.hugegraph.ct.base.ClusterConstant.CONF_DIR; +import static org.apache.hugegraph.ct.base.ClusterConstant.EMPTY_SAMPLE_GROOVY_FILE; +import static org.apache.hugegraph.ct.base.ClusterConstant.EXAMPLE_GROOVY_FILE; import static org.apache.hugegraph.ct.base.ClusterConstant.EXT_DIR; import static org.apache.hugegraph.ct.base.ClusterConstant.GREMLIN_DRIVER_SETTING_FILE; import static org.apache.hugegraph.ct.base.ClusterConstant.GREMLIN_SERVER_FILE; @@ -52,7 +55,12 @@ public ServerNodeWrapper(int clusterIndex, int index) { REMOTE_SETTING_FILE, REMOTE_OBJECTS_SETTING_FILE)); this.workPath = SERVER_LIB_PATH; - createNodeDir(); + createNodeDir(getNodePath() + CONF_DIR + File.separator); + this.fileNames = new ArrayList<>( + List.of(EMPTY_SAMPLE_GROOVY_FILE, + EXAMPLE_GROOVY_FILE) + ); + createNodeDir(getNodePath()); createLogDir(); } diff --git a/hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/node/StoreNodeWrapper.java b/hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/node/StoreNodeWrapper.java index 6f4758c058..31e4ff08da 100644 --- a/hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/node/StoreNodeWrapper.java +++ b/hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/node/StoreNodeWrapper.java @@ -40,7 +40,7 @@ public StoreNodeWrapper(int clusterId, int index) { this.clusterIndex = clusterId; this.index = index; this.workPath = STORE_LIB_PATH; - createNodeDir(); + createNodeDir(getNodePath() + CONF_DIR + File.separator); createLogDir(); } From a23ab6f478154e5b7e268cf73f2e755475f4d681 Mon Sep 17 00:00:00 2001 From: 145425491 <1245294786@qq.com> Date: Mon, 9 Sep 2024 18:26:03 +0800 Subject: [PATCH 15/40] feat(ct): add test and ci to CT module --- .../pom.xml | 4 +- .../src/assembly/descriptor/assembly.xml | 0 .../src/assembly/static/computer.yaml | 0 .../static/gremlin-driver-settings.yaml | 0 .../src/assembly/static/gremlin-server.yaml | 0 .../assembly/static/hugegraph-server.keystore | Bin .../src/assembly/static/hugegraph.license | Bin .../static/hugegraph.properties.template | 0 .../src/assembly/static/log4j2.xml | 0 .../static/pd-application.yml.template | 0 .../src/assembly/static/remote-objects.yaml | 0 .../src/assembly/static/remote.yaml | 0 .../static/rest-server.properties.template | 0 .../static/scripts/empty-sample.groovy | 0 .../assembly/static/scripts/example.groovy | 0 .../static/store-application.yml.template | 0 .../src/assembly/static/verify-license.json | 0 .../pom.xml | 2 +- .../hugegraph/ct/base/ClusterConstant.java | 0 .../org/apache/hugegraph/ct/base/EnvType.java | 0 .../org/apache/hugegraph/ct/base/EnvUtil.java | 0 .../hugegraph/ct/base/HGTestLogger.java | 0 .../hugegraph/ct/config/AbstractConfig.java | 2 + .../hugegraph/ct/config/ClusterConf.java | 26 +++++++ .../hugegraph/ct/config/GraphConfig.java | 0 .../apache/hugegraph/ct/config/PDConfig.java | 0 .../hugegraph/ct/config/ServerConfig.java | 0 .../hugegraph/ct/config/StoreConfig.java | 0 .../apache/hugegraph/ct/env/AbstractEnv.java | 67 +++++++++++++--- .../org/apache/hugegraph/ct/env/BaseEnv.java | 18 ++++- .../apache/hugegraph/ct/env/EnvFactory.java | 46 +++++++++++ .../apache/hugegraph/ct/env/MultiNodeEnv.java | 35 +++++++++ .../apache/hugegraph/ct/env/SimpleEnv.java | 2 +- .../ct/node/AbstractNodeWrapper.java | 25 +++++- .../hugegraph/ct/node/BaseNodeWrapper.java | 16 ++-- .../hugegraph/ct/node/PDNodeWrapper.java | 2 + .../hugegraph/ct/node/ServerNodeWrapper.java | 1 + .../hugegraph/ct/node/StoreNodeWrapper.java | 11 +++ .../pom.xml | 28 ++++++- .../SimpleClusterTest/BaseSimpleTest.java | 63 +++++++++++++++ .../SimpleClusterDeployTest.java | 72 ++++++++++++++++++ .../SimpleClusterFileTest.java | 48 ++++++++++++ .../SimpleClusterSuiteTest.java | 33 ++++++++ hugegraph-cluster-test/pom.xml | 59 +++++++++++++- 44 files changed, 530 insertions(+), 30 deletions(-) rename hugegraph-cluster-test/{hg-ct-dist => hugegraph-clustertest-dist}/pom.xml (96%) rename hugegraph-cluster-test/{hg-ct-dist => hugegraph-clustertest-dist}/src/assembly/descriptor/assembly.xml (100%) rename hugegraph-cluster-test/{hg-ct-dist => hugegraph-clustertest-dist}/src/assembly/static/computer.yaml (100%) rename hugegraph-cluster-test/{hg-ct-dist => hugegraph-clustertest-dist}/src/assembly/static/gremlin-driver-settings.yaml (100%) rename hugegraph-cluster-test/{hg-ct-dist => hugegraph-clustertest-dist}/src/assembly/static/gremlin-server.yaml (100%) rename hugegraph-cluster-test/{hg-ct-dist => hugegraph-clustertest-dist}/src/assembly/static/hugegraph-server.keystore (100%) rename hugegraph-cluster-test/{hg-ct-dist => hugegraph-clustertest-dist}/src/assembly/static/hugegraph.license (100%) rename hugegraph-cluster-test/{hg-ct-dist => hugegraph-clustertest-dist}/src/assembly/static/hugegraph.properties.template (100%) rename hugegraph-cluster-test/{hg-ct-dist => hugegraph-clustertest-dist}/src/assembly/static/log4j2.xml (100%) rename hugegraph-cluster-test/{hg-ct-dist => hugegraph-clustertest-dist}/src/assembly/static/pd-application.yml.template (100%) rename hugegraph-cluster-test/{hg-ct-dist => hugegraph-clustertest-dist}/src/assembly/static/remote-objects.yaml (100%) rename hugegraph-cluster-test/{hg-ct-dist => hugegraph-clustertest-dist}/src/assembly/static/remote.yaml (100%) rename hugegraph-cluster-test/{hg-ct-dist => hugegraph-clustertest-dist}/src/assembly/static/rest-server.properties.template (100%) rename hugegraph-cluster-test/{hg-ct-dist => hugegraph-clustertest-dist}/src/assembly/static/scripts/empty-sample.groovy (100%) rename hugegraph-cluster-test/{hg-ct-dist => hugegraph-clustertest-dist}/src/assembly/static/scripts/example.groovy (100%) rename hugegraph-cluster-test/{hg-ct-dist => hugegraph-clustertest-dist}/src/assembly/static/store-application.yml.template (100%) rename hugegraph-cluster-test/{hg-ct-dist => hugegraph-clustertest-dist}/src/assembly/static/verify-license.json (100%) rename hugegraph-cluster-test/{hg-ct-minicluster => hugegraph-clustertest-minicluster}/pom.xml (97%) rename hugegraph-cluster-test/{hg-ct-minicluster => hugegraph-clustertest-minicluster}/src/main/java/org/apache/hugegraph/ct/base/ClusterConstant.java (100%) rename hugegraph-cluster-test/{hg-ct-minicluster => hugegraph-clustertest-minicluster}/src/main/java/org/apache/hugegraph/ct/base/EnvType.java (100%) rename hugegraph-cluster-test/{hg-ct-minicluster => hugegraph-clustertest-minicluster}/src/main/java/org/apache/hugegraph/ct/base/EnvUtil.java (100%) rename hugegraph-cluster-test/{hg-ct-minicluster => hugegraph-clustertest-minicluster}/src/main/java/org/apache/hugegraph/ct/base/HGTestLogger.java (100%) rename hugegraph-cluster-test/{hg-ct-minicluster => hugegraph-clustertest-minicluster}/src/main/java/org/apache/hugegraph/ct/config/AbstractConfig.java (99%) rename hugegraph-cluster-test/{hg-ct-minicluster => hugegraph-clustertest-minicluster}/src/main/java/org/apache/hugegraph/ct/config/ClusterConf.java (79%) rename hugegraph-cluster-test/{hg-ct-minicluster => hugegraph-clustertest-minicluster}/src/main/java/org/apache/hugegraph/ct/config/GraphConfig.java (100%) rename hugegraph-cluster-test/{hg-ct-minicluster => hugegraph-clustertest-minicluster}/src/main/java/org/apache/hugegraph/ct/config/PDConfig.java (100%) rename hugegraph-cluster-test/{hg-ct-minicluster => hugegraph-clustertest-minicluster}/src/main/java/org/apache/hugegraph/ct/config/ServerConfig.java (100%) rename hugegraph-cluster-test/{hg-ct-minicluster => hugegraph-clustertest-minicluster}/src/main/java/org/apache/hugegraph/ct/config/StoreConfig.java (100%) rename hugegraph-cluster-test/{hg-ct-minicluster => hugegraph-clustertest-minicluster}/src/main/java/org/apache/hugegraph/ct/env/AbstractEnv.java (70%) rename hugegraph-cluster-test/{hg-ct-minicluster => hugegraph-clustertest-minicluster}/src/main/java/org/apache/hugegraph/ct/env/BaseEnv.java (81%) create mode 100644 hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/env/EnvFactory.java create mode 100644 hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/env/MultiNodeEnv.java rename hugegraph-cluster-test/{hg-ct-minicluster => hugegraph-clustertest-minicluster}/src/main/java/org/apache/hugegraph/ct/env/SimpleEnv.java (98%) rename hugegraph-cluster-test/{hg-ct-minicluster => hugegraph-clustertest-minicluster}/src/main/java/org/apache/hugegraph/ct/node/AbstractNodeWrapper.java (92%) rename hugegraph-cluster-test/{hg-ct-minicluster => hugegraph-clustertest-minicluster}/src/main/java/org/apache/hugegraph/ct/node/BaseNodeWrapper.java (85%) rename hugegraph-cluster-test/{hg-ct-minicluster => hugegraph-clustertest-minicluster}/src/main/java/org/apache/hugegraph/ct/node/PDNodeWrapper.java (96%) rename hugegraph-cluster-test/{hg-ct-minicluster => hugegraph-clustertest-minicluster}/src/main/java/org/apache/hugegraph/ct/node/ServerNodeWrapper.java (98%) rename hugegraph-cluster-test/{hg-ct-minicluster => hugegraph-clustertest-minicluster}/src/main/java/org/apache/hugegraph/ct/node/StoreNodeWrapper.java (88%) rename hugegraph-cluster-test/{hg-ct-test => hugegraph-clustertest-test}/pom.xml (61%) create mode 100644 hugegraph-cluster-test/hugegraph-clustertest-test/src/main/java/org/apache/hugegraph/SimpleClusterTest/BaseSimpleTest.java create mode 100644 hugegraph-cluster-test/hugegraph-clustertest-test/src/main/java/org/apache/hugegraph/SimpleClusterTest/SimpleClusterDeployTest.java create mode 100644 hugegraph-cluster-test/hugegraph-clustertest-test/src/main/java/org/apache/hugegraph/SimpleClusterTest/SimpleClusterFileTest.java create mode 100644 hugegraph-cluster-test/hugegraph-clustertest-test/src/main/java/org/apache/hugegraph/SimpleClusterTest/SimpleClusterSuiteTest.java diff --git a/hugegraph-cluster-test/hg-ct-dist/pom.xml b/hugegraph-cluster-test/hugegraph-clustertest-dist/pom.xml similarity index 96% rename from hugegraph-cluster-test/hg-ct-dist/pom.xml rename to hugegraph-cluster-test/hugegraph-clustertest-dist/pom.xml index f06d7099f9..20e3efc599 100644 --- a/hugegraph-cluster-test/hg-ct-dist/pom.xml +++ b/hugegraph-cluster-test/hugegraph-clustertest-dist/pom.xml @@ -27,7 +27,7 @@ ../pom.xml - hg-ct-dist + hugegraph-clustertest-dist ${project.parent.basedir} @@ -70,7 +70,7 @@ org.apache.hugegraph - hg-ct-minicluster + hugegraph-clustertest-minicluster ${revision} diff --git a/hugegraph-cluster-test/hg-ct-dist/src/assembly/descriptor/assembly.xml b/hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/descriptor/assembly.xml similarity index 100% rename from hugegraph-cluster-test/hg-ct-dist/src/assembly/descriptor/assembly.xml rename to hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/descriptor/assembly.xml diff --git a/hugegraph-cluster-test/hg-ct-dist/src/assembly/static/computer.yaml b/hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/computer.yaml similarity index 100% rename from hugegraph-cluster-test/hg-ct-dist/src/assembly/static/computer.yaml rename to hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/computer.yaml diff --git a/hugegraph-cluster-test/hg-ct-dist/src/assembly/static/gremlin-driver-settings.yaml b/hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/gremlin-driver-settings.yaml similarity index 100% rename from hugegraph-cluster-test/hg-ct-dist/src/assembly/static/gremlin-driver-settings.yaml rename to hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/gremlin-driver-settings.yaml diff --git a/hugegraph-cluster-test/hg-ct-dist/src/assembly/static/gremlin-server.yaml b/hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/gremlin-server.yaml similarity index 100% rename from hugegraph-cluster-test/hg-ct-dist/src/assembly/static/gremlin-server.yaml rename to hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/gremlin-server.yaml diff --git a/hugegraph-cluster-test/hg-ct-dist/src/assembly/static/hugegraph-server.keystore b/hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/hugegraph-server.keystore similarity index 100% rename from hugegraph-cluster-test/hg-ct-dist/src/assembly/static/hugegraph-server.keystore rename to hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/hugegraph-server.keystore diff --git a/hugegraph-cluster-test/hg-ct-dist/src/assembly/static/hugegraph.license b/hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/hugegraph.license similarity index 100% rename from hugegraph-cluster-test/hg-ct-dist/src/assembly/static/hugegraph.license rename to hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/hugegraph.license diff --git a/hugegraph-cluster-test/hg-ct-dist/src/assembly/static/hugegraph.properties.template b/hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/hugegraph.properties.template similarity index 100% rename from hugegraph-cluster-test/hg-ct-dist/src/assembly/static/hugegraph.properties.template rename to hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/hugegraph.properties.template diff --git a/hugegraph-cluster-test/hg-ct-dist/src/assembly/static/log4j2.xml b/hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/log4j2.xml similarity index 100% rename from hugegraph-cluster-test/hg-ct-dist/src/assembly/static/log4j2.xml rename to hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/log4j2.xml diff --git a/hugegraph-cluster-test/hg-ct-dist/src/assembly/static/pd-application.yml.template b/hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/pd-application.yml.template similarity index 100% rename from hugegraph-cluster-test/hg-ct-dist/src/assembly/static/pd-application.yml.template rename to hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/pd-application.yml.template diff --git a/hugegraph-cluster-test/hg-ct-dist/src/assembly/static/remote-objects.yaml b/hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/remote-objects.yaml similarity index 100% rename from hugegraph-cluster-test/hg-ct-dist/src/assembly/static/remote-objects.yaml rename to hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/remote-objects.yaml diff --git a/hugegraph-cluster-test/hg-ct-dist/src/assembly/static/remote.yaml b/hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/remote.yaml similarity index 100% rename from hugegraph-cluster-test/hg-ct-dist/src/assembly/static/remote.yaml rename to hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/remote.yaml diff --git a/hugegraph-cluster-test/hg-ct-dist/src/assembly/static/rest-server.properties.template b/hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/rest-server.properties.template similarity index 100% rename from hugegraph-cluster-test/hg-ct-dist/src/assembly/static/rest-server.properties.template rename to hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/rest-server.properties.template diff --git a/hugegraph-cluster-test/hg-ct-dist/src/assembly/static/scripts/empty-sample.groovy b/hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/scripts/empty-sample.groovy similarity index 100% rename from hugegraph-cluster-test/hg-ct-dist/src/assembly/static/scripts/empty-sample.groovy rename to hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/scripts/empty-sample.groovy diff --git a/hugegraph-cluster-test/hg-ct-dist/src/assembly/static/scripts/example.groovy b/hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/scripts/example.groovy similarity index 100% rename from hugegraph-cluster-test/hg-ct-dist/src/assembly/static/scripts/example.groovy rename to hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/scripts/example.groovy diff --git a/hugegraph-cluster-test/hg-ct-dist/src/assembly/static/store-application.yml.template b/hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/store-application.yml.template similarity index 100% rename from hugegraph-cluster-test/hg-ct-dist/src/assembly/static/store-application.yml.template rename to hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/store-application.yml.template diff --git a/hugegraph-cluster-test/hg-ct-dist/src/assembly/static/verify-license.json b/hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/verify-license.json similarity index 100% rename from hugegraph-cluster-test/hg-ct-dist/src/assembly/static/verify-license.json rename to hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/verify-license.json diff --git a/hugegraph-cluster-test/hg-ct-minicluster/pom.xml b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/pom.xml similarity index 97% rename from hugegraph-cluster-test/hg-ct-minicluster/pom.xml rename to hugegraph-cluster-test/hugegraph-clustertest-minicluster/pom.xml index cad9a1c7c9..f99ce537b0 100644 --- a/hugegraph-cluster-test/hg-ct-minicluster/pom.xml +++ b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/pom.xml @@ -20,7 +20,7 @@ xmlns="http://maven.apache.org/POM/4.0.0" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - hg-ct-minicluster + hugegraph-clustertest-minicluster org.apache.hugegraph diff --git a/hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/base/ClusterConstant.java b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/base/ClusterConstant.java similarity index 100% rename from hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/base/ClusterConstant.java rename to hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/base/ClusterConstant.java diff --git a/hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/base/EnvType.java b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/base/EnvType.java similarity index 100% rename from hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/base/EnvType.java rename to hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/base/EnvType.java diff --git a/hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/base/EnvUtil.java b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/base/EnvUtil.java similarity index 100% rename from hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/base/EnvUtil.java rename to hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/base/EnvUtil.java diff --git a/hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/base/HGTestLogger.java b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/base/HGTestLogger.java similarity index 100% rename from hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/base/HGTestLogger.java rename to hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/base/HGTestLogger.java diff --git a/hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/config/AbstractConfig.java b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/config/AbstractConfig.java similarity index 99% rename from hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/config/AbstractConfig.java rename to hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/config/AbstractConfig.java index 96e585bd64..91510bf07e 100644 --- a/hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/config/AbstractConfig.java +++ b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/config/AbstractConfig.java @@ -80,3 +80,5 @@ protected void setProperty(String propertyName, String value) { } } } + + diff --git a/hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/config/ClusterConf.java b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/config/ClusterConf.java similarity index 79% rename from hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/config/ClusterConf.java rename to hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/config/ClusterConf.java index fafad67fda..bbcbe5f092 100644 --- a/hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/config/ClusterConf.java +++ b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/config/ClusterConf.java @@ -87,4 +87,30 @@ public ServerConfig getServerConfig(int i) { public GraphConfig getGraphConfig(int i) { return graphConfigs.get(i); } + + public List getPDRestAddrs() { + List addrs = new ArrayList<>(); + for (PDConfig pdConfig : pdConfigs) { + addrs.add(pdConfig.getRaftAddress()); + } + return addrs; + } + + public List getStoreRestAddrs() { + List addrs = new ArrayList<>(); + for (StoreConfig storeConfig : storeConfigs) { + addrs.add("127.0.0.1" + ":" + + storeConfig.getRestPort()); + } + return addrs; + } + + public List getServerRestAddrs() { + List addrs = new ArrayList<>(); + for (ServerConfig serverConfig : serverConfigs) { + addrs.add("127.0.0.1" + ":" + + serverConfig.getRestPort()); + } + return addrs; + } } diff --git a/hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/config/GraphConfig.java b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/config/GraphConfig.java similarity index 100% rename from hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/config/GraphConfig.java rename to hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/config/GraphConfig.java diff --git a/hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/config/PDConfig.java b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/config/PDConfig.java similarity index 100% rename from hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/config/PDConfig.java rename to hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/config/PDConfig.java diff --git a/hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/config/ServerConfig.java b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/config/ServerConfig.java similarity index 100% rename from hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/config/ServerConfig.java rename to hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/config/ServerConfig.java diff --git a/hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/config/StoreConfig.java b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/config/StoreConfig.java similarity index 100% rename from hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/config/StoreConfig.java rename to hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/config/StoreConfig.java diff --git a/hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/env/AbstractEnv.java b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/env/AbstractEnv.java similarity index 70% rename from hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/env/AbstractEnv.java rename to hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/env/AbstractEnv.java index 2be2a8c81c..16ea8374f7 100644 --- a/hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/env/AbstractEnv.java +++ b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/env/AbstractEnv.java @@ -47,13 +47,13 @@ public abstract class AbstractEnv implements BaseEnv { @Setter protected int cluster_id = 0; - public AbstractEnv() { + protected AbstractEnv() { this.pdNodeWrappers = new ArrayList<>(); this.serverNodeWrappers = new ArrayList<>(); this.storeNodeWrappers = new ArrayList<>(); } - public void init(int pdCnt, int storeCnt, int serverCnt) { + protected void init(int pdCnt, int storeCnt, int serverCnt) { this.clusterConf = new ClusterConf(pdCnt, storeCnt, serverCnt); for (int i = 0; i < pdCnt; i++) { PDNodeWrapper pdNodeWrapper = new PDNodeWrapper(cluster_id, i); @@ -89,27 +89,41 @@ public void init(int pdCnt, int storeCnt, int serverCnt) { } } - @Override public void startCluster() { for (int i = 0; i < pdNodeWrappers.size(); i++) { PDNodeWrapper pdNodeWrapper = pdNodeWrappers.get(i); pdNodeWrapper.start(); - try { - Thread.sleep(5000); - } catch (InterruptedException e) { - throw new RuntimeException(e); + while (!pdNodeWrapper.isStarted()) { + try { + Thread.sleep(1000); + } catch (InterruptedException e) { + throw new RuntimeException(e); + } } } for (int i = 0; i < storeNodeWrappers.size(); i++) { StoreNodeWrapper storeNodeWrapper = storeNodeWrappers.get(i); storeNodeWrapper.start(); + while (!storeNodeWrapper.isStarted()) { + try { + Thread.sleep(1000); + } catch (InterruptedException e) { + throw new RuntimeException(e); + } + } } for (ServerNodeWrapper serverNodeWrapper : serverNodeWrappers) { serverNodeWrapper.start(); + while (!serverNodeWrapper.isStarted()) { + try { + Thread.sleep(1000); + } catch (InterruptedException e) { + throw new RuntimeException(e); + } + } } } - @Override public void clearCluster() { for (PDNodeWrapper pdNodeWrapper : pdNodeWrappers) { pdNodeWrapper.stop(); @@ -122,9 +136,44 @@ public void clearCluster() { } } - @Override public ClusterConf getConf() { return this.clusterConf; } + public List getPDRestAddrs() { + return clusterConf.getPDRestAddrs(); + } + + public List getStoreRestAddrs() { + return clusterConf.getStoreRestAddrs(); + } + + public List getServerRestAddrs() { + return clusterConf.getServerRestAddrs(); + } + + public List getPDNodeDir() { + List nodeDirs = new ArrayList<>(); + for (PDNodeWrapper pdNodeWrapper : pdNodeWrappers) { + nodeDirs.add(pdNodeWrapper.getNodePath()); + } + return nodeDirs; + } + + public List getStoreNodeDir() { + List nodeDirs = new ArrayList<>(); + for (StoreNodeWrapper storeNodeWrapper : storeNodeWrappers) { + nodeDirs.add(storeNodeWrapper.getNodePath()); + } + return nodeDirs; + } + + public List getServerNodeDir() { + List nodeDirs = new ArrayList<>(); + for (ServerNodeWrapper serverNodeWrapper : serverNodeWrappers) { + nodeDirs.add(serverNodeWrapper.getNodePath()); + } + return nodeDirs; + } + } diff --git a/hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/env/BaseEnv.java b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/env/BaseEnv.java similarity index 81% rename from hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/env/BaseEnv.java rename to hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/env/BaseEnv.java index d3c18ad7bd..bdf41b1f0f 100644 --- a/hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/env/BaseEnv.java +++ b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/env/BaseEnv.java @@ -17,12 +17,12 @@ package org.apache.hugegraph.ct.env; +import java.util.List; + import org.apache.hugegraph.ct.config.ClusterConf; public interface BaseEnv { - void init(); - /* init the cluster environment with simple mode */ void startCluster(); @@ -30,4 +30,18 @@ public interface BaseEnv { void clearCluster(); ClusterConf getConf(); + + void init(); + + List getPDRestAddrs(); + + List getStoreRestAddrs(); + + List getServerRestAddrs(); + + List getPDNodeDir(); + + List getStoreNodeDir(); + + List getServerNodeDir(); } diff --git a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/env/EnvFactory.java b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/env/EnvFactory.java new file mode 100644 index 0000000000..2747a03d3c --- /dev/null +++ b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/env/EnvFactory.java @@ -0,0 +1,46 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.hugegraph.ct.env; + +import org.apache.hugegraph.ct.base.EnvType; +import org.apache.hugegraph.ct.base.HGTestLogger; +import org.slf4j.Logger; + +public class EnvFactory { + + private static final Logger LOG = HGTestLogger.LOG; + private static BaseEnv env; + + public static BaseEnv getEnv() { + if (env == null) { + EnvType envType = EnvType.getSystemEnvType(); + switch (envType) { + case Simple: + env = new SimpleEnv(); + break; + case MultiNode: + env = new MultiNodeEnv(); + break; + default: + LOG.error("No such env type :{}", envType); + } + } + return env; + } + +} diff --git a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/env/MultiNodeEnv.java b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/env/MultiNodeEnv.java new file mode 100644 index 0000000000..2cd38bdbc4 --- /dev/null +++ b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/env/MultiNodeEnv.java @@ -0,0 +1,35 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.hugegraph.ct.env; + +public class MultiNodeEnv extends AbstractEnv { + + public MultiNodeEnv() { + super(); + this.init(); + } + + public MultiNodeEnv(int pdNum, int storeNum, int serverNum) { + super.init(pdNum, storeNum, serverNum); + } + + @Override + public void init() { + super.init(3, 3, 3); + } +} diff --git a/hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/env/SimpleEnv.java b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/env/SimpleEnv.java similarity index 98% rename from hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/env/SimpleEnv.java rename to hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/env/SimpleEnv.java index bdcb359661..595ed0fbe1 100644 --- a/hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/env/SimpleEnv.java +++ b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/env/SimpleEnv.java @@ -21,9 +21,9 @@ public class SimpleEnv extends AbstractEnv { public SimpleEnv() { super(); + init(); } - @Override public void init() { super.init(1, 1, 1); } diff --git a/hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/node/AbstractNodeWrapper.java b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/node/AbstractNodeWrapper.java similarity index 92% rename from hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/node/AbstractNodeWrapper.java rename to hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/node/AbstractNodeWrapper.java index 0c8b258824..c6210b4fe9 100644 --- a/hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/node/AbstractNodeWrapper.java +++ b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/node/AbstractNodeWrapper.java @@ -20,6 +20,8 @@ import static org.apache.hugegraph.ct.base.ClusterConstant.CT_PACKAGE_PATH; import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileReader; import java.io.IOException; import java.nio.charset.StandardCharsets; import java.nio.file.Files; @@ -29,6 +31,7 @@ import java.nio.file.StandardCopyOption; import java.util.ArrayList; import java.util.List; +import java.util.Scanner; import java.util.concurrent.TimeUnit; import java.util.stream.Stream; @@ -51,6 +54,7 @@ public abstract class AbstractNodeWrapper implements BaseNodeWrapper { protected Process instance; protected int index; protected List fileNames; + protected String startLine; public AbstractNodeWrapper() { this.clusterIndex = 1; @@ -61,7 +65,6 @@ public AbstractNodeWrapper() { /** * Node Dir should be created before changing Config */ - @Override public void createNodeDir(String destDir) { try { try { @@ -69,7 +72,6 @@ public void createNodeDir(String destDir) { FileUtils.createParentDirectories(new File(destDir)); } } catch (NoSuchFileException fileException) { - //no need to handle } Path sourcePath = Paths.get(CT_PACKAGE_PATH); // To avoid following symbolic links @@ -101,7 +103,6 @@ public void createNodeDir(String destDir) { } } - @Override public void createLogDir() { String logPath = getLogPath(); try { @@ -129,28 +130,43 @@ public void deleteDir() { /** * @return (user.dir).id */ + @Override public String getNodePath() { return CT_PACKAGE_PATH + getID() + File.separator; } + @Override public String getLogPath() { return getNodePath() + ClusterConstant.LOG + File.separator + getID() + "-start.log"; } + @Override public void updateWorkPath(String workPath) { this.workPath = workPath; } + @Override public void updateConfigPath(String ConfigPath) { this.configPath = ConfigPath; } + @Override + public boolean isStarted() { + try (Scanner sc = new Scanner(new FileReader(getLogPath()))) { + while (sc.hasNextLine()) { //按行读取字符串 + String line = sc.nextLine(); + if (line.contains(startLine)) return true; + } + } catch (FileNotFoundException e) { + } + return false; + } + public void stop() { if (this.instance == null) { return; } this.instance.destroy(); - deleteDir(); try { if (!this.instance.waitFor(20, TimeUnit.SECONDS)) { this.instance.destroyForcibly().waitFor(10, TimeUnit.SECONDS); @@ -159,6 +175,7 @@ public void stop() { Thread.currentThread().interrupt(); LOG.error("Waiting node to shutdown error.", e); } + deleteDir(); } public boolean isAlive() { diff --git a/hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/node/BaseNodeWrapper.java b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/node/BaseNodeWrapper.java similarity index 85% rename from hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/node/BaseNodeWrapper.java rename to hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/node/BaseNodeWrapper.java index 5fabfd1996..f428b227c4 100644 --- a/hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/node/BaseNodeWrapper.java +++ b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/node/BaseNodeWrapper.java @@ -19,12 +19,6 @@ public interface BaseNodeWrapper { - void createNodeDir(String destDir); - - void createLogDir(); - - void deleteDir(); - void start(); void stop(); @@ -32,4 +26,14 @@ public interface BaseNodeWrapper { boolean isAlive(); String getID(); + + String getNodePath(); + + String getLogPath(); + + void updateWorkPath(String workPath); + + void updateConfigPath(String ConfigPath); + + boolean isStarted(); } diff --git a/hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/node/PDNodeWrapper.java b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/node/PDNodeWrapper.java similarity index 96% rename from hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/node/PDNodeWrapper.java rename to hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/node/PDNodeWrapper.java index 73f54a493d..b014441792 100644 --- a/hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/node/PDNodeWrapper.java +++ b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/node/PDNodeWrapper.java @@ -43,6 +43,7 @@ public PDNodeWrapper() { VERIFY_LICENSE_FILE) ); this.workPath = PD_LIB_PATH; + this.startLine = "o.a.h.p.s.PDService - PDService init"; createNodeDir(getNodePath() + CONF_DIR + File.separator); createLogDir(); } @@ -57,6 +58,7 @@ public PDNodeWrapper(int clusterIndex, int index) { VERIFY_LICENSE_FILE) ); this.workPath = PD_LIB_PATH; + this.startLine = "o.a.h.p.s.PDService - PDService init"; createNodeDir(getNodePath() + CONF_DIR + File.separator); createLogDir(); } diff --git a/hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/node/ServerNodeWrapper.java b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/node/ServerNodeWrapper.java similarity index 98% rename from hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/node/ServerNodeWrapper.java rename to hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/node/ServerNodeWrapper.java index 28694dc7ad..dc2ae33aae 100644 --- a/hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/node/ServerNodeWrapper.java +++ b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/node/ServerNodeWrapper.java @@ -60,6 +60,7 @@ public ServerNodeWrapper(int clusterIndex, int index) { List.of(EMPTY_SAMPLE_GROOVY_FILE, EXAMPLE_GROOVY_FILE) ); + this.startLine = "INFO: [HttpServer] Started."; createNodeDir(getNodePath()); createLogDir(); } diff --git a/hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/node/StoreNodeWrapper.java b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/node/StoreNodeWrapper.java similarity index 88% rename from hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/node/StoreNodeWrapper.java rename to hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/node/StoreNodeWrapper.java index 31e4ff08da..a308420738 100644 --- a/hugegraph-cluster-test/hg-ct-minicluster/src/main/java/org/apache/hugegraph/ct/node/StoreNodeWrapper.java +++ b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/node/StoreNodeWrapper.java @@ -33,6 +33,16 @@ public class StoreNodeWrapper extends AbstractNodeWrapper { + public StoreNodeWrapper() { + super(); + this.fileNames = new ArrayList<>( + List.of(LOG4J_FILE)); + this.workPath = STORE_LIB_PATH; + this.startLine = "o.a.h.s.n.StoreNodeApplication - Starting StoreNodeApplication"; + createNodeDir(getNodePath() + CONF_DIR + File.separator); + createLogDir(); + } + public StoreNodeWrapper(int clusterId, int index) { super(); this.fileNames = new ArrayList<>( @@ -40,6 +50,7 @@ public StoreNodeWrapper(int clusterId, int index) { this.clusterIndex = clusterId; this.index = index; this.workPath = STORE_LIB_PATH; + this.startLine = "o.a.h.s.n.StoreNodeApplication - Starting StoreNodeApplication"; createNodeDir(getNodePath() + CONF_DIR + File.separator); createLogDir(); } diff --git a/hugegraph-cluster-test/hg-ct-test/pom.xml b/hugegraph-cluster-test/hugegraph-clustertest-test/pom.xml similarity index 61% rename from hugegraph-cluster-test/hg-ct-test/pom.xml rename to hugegraph-cluster-test/hugegraph-clustertest-test/pom.xml index 5a1ac28f40..d94ed53249 100644 --- a/hugegraph-cluster-test/hg-ct-test/pom.xml +++ b/hugegraph-cluster-test/hugegraph-clustertest-test/pom.xml @@ -26,7 +26,7 @@ ${revision} - hg-ct-test + hugegraph-clustertest-test 11 @@ -36,10 +36,34 @@ org.apache.hugegraph - hg-ct-minicluster + hugegraph-clustertest-minicluster ${revision} compile + + + + org.apache.maven.plugins + maven-surefire-plugin + 2.20 + + + simple-cluster-test + + ${basedir}/src/main/java/ + + ${basedir}/target/classes/ + + + **/SimpleClusterSuiteTest.java + + + + + + + + diff --git a/hugegraph-cluster-test/hugegraph-clustertest-test/src/main/java/org/apache/hugegraph/SimpleClusterTest/BaseSimpleTest.java b/hugegraph-cluster-test/hugegraph-clustertest-test/src/main/java/org/apache/hugegraph/SimpleClusterTest/BaseSimpleTest.java new file mode 100644 index 0000000000..4275c65114 --- /dev/null +++ b/hugegraph-cluster-test/hugegraph-clustertest-test/src/main/java/org/apache/hugegraph/SimpleClusterTest/BaseSimpleTest.java @@ -0,0 +1,63 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.hugegraph.SimpleClusterTest; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStreamReader; + +import org.apache.hugegraph.ct.env.BaseEnv; +import org.apache.hugegraph.ct.env.SimpleEnv; +import org.apache.hugegraph.util.Log; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.slf4j.Logger; + +public class BaseSimpleTest { + + protected static final Logger LOG = Log.logger(BaseSimpleTest.class); + + protected static BaseEnv env; + + protected static Process p; + + @BeforeClass + public static void initEnv() throws InterruptedException { + env = new SimpleEnv(); + env.startCluster(); + } + + @AfterClass + public static void clearEnv() { + env.clearCluster(); + } + + protected String execCurl(String[] cmds) throws IOException { + ProcessBuilder process = new ProcessBuilder(cmds); + p = process.start(); + BufferedReader reader = new BufferedReader(new InputStreamReader(p.getInputStream())); + StringBuilder builder = new StringBuilder(); + String line; + while ((line = reader.readLine()) != null) { + builder.append(line); + builder.append(System.getProperty("line.separator")); + } + p.destroy(); + return builder.toString(); + } +} diff --git a/hugegraph-cluster-test/hugegraph-clustertest-test/src/main/java/org/apache/hugegraph/SimpleClusterTest/SimpleClusterDeployTest.java b/hugegraph-cluster-test/hugegraph-clustertest-test/src/main/java/org/apache/hugegraph/SimpleClusterTest/SimpleClusterDeployTest.java new file mode 100644 index 0000000000..9dee5ec306 --- /dev/null +++ b/hugegraph-cluster-test/hugegraph-clustertest-test/src/main/java/org/apache/hugegraph/SimpleClusterTest/SimpleClusterDeployTest.java @@ -0,0 +1,72 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.hugegraph.SimpleClusterTest; + +import java.io.IOException; +import java.util.List; + +import org.junit.Assert; +import org.junit.Test; + +public class SimpleClusterDeployTest extends BaseSimpleTest { + + @Test + public void testPDNodesDeployment() throws IOException { + List addrs = env.getPDRestAddrs(); + for (String addr : addrs) { + String url = addr; + String[] cmds = {"curl", url}; + StringBuffer sb = new StringBuffer(); + for (int i = 0; i < cmds.length; i++) { + sb.append(cmds[i] + " "); + } + String responseMsg = execCurl(cmds); + Assert.assertEquals(responseMsg, ""); + } + } + + @Test + public void testStoreNodesDeployment() throws IOException, InterruptedException { + List addrs = env.getStoreRestAddrs(); + for (String addr : addrs) { + String url = addr; + String[] cmds = {"curl", url}; + StringBuffer sb = new StringBuffer(); + for (int i = 0; i < cmds.length; i++) { + sb.append(cmds[i] + " "); + } + String responseMsg = execCurl(cmds); + Assert.assertTrue(responseMsg.startsWith("{")); + } + } + + @Test + public void testServerNodesDeployment() throws IOException, InterruptedException { + List addrs = env.getServerRestAddrs(); + for (String addr : addrs) { + String url = addr; + String[] cmds = {"curl", url}; + StringBuffer sb = new StringBuffer(); + for (int i = 0; i < cmds.length; i++) { + sb.append(cmds[i] + " "); + } + String responseMsg = execCurl(cmds); + Assert.assertTrue(responseMsg.startsWith("{")); + } + } +} diff --git a/hugegraph-cluster-test/hugegraph-clustertest-test/src/main/java/org/apache/hugegraph/SimpleClusterTest/SimpleClusterFileTest.java b/hugegraph-cluster-test/hugegraph-clustertest-test/src/main/java/org/apache/hugegraph/SimpleClusterTest/SimpleClusterFileTest.java new file mode 100644 index 0000000000..1cae2bcdba --- /dev/null +++ b/hugegraph-cluster-test/hugegraph-clustertest-test/src/main/java/org/apache/hugegraph/SimpleClusterTest/SimpleClusterFileTest.java @@ -0,0 +1,48 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.hugegraph.SimpleClusterTest; + +import java.io.File; + +import org.junit.Assert; +import org.junit.Test; + +public class SimpleClusterFileTest extends BaseSimpleTest { + + @Test + public void checkPDNodeDir() { + for (String nodeDir : env.getPDNodeDir()) { + Assert.assertTrue(new File(nodeDir).isDirectory()); + } + } + + @Test + public void checkStoreNodeDir() { + for (String nodeDir : env.getStoreNodeDir()) { + Assert.assertTrue(new File(nodeDir).isDirectory()); + } + } + + @Test + public void checkServerNodeDir() { + for (String nodeDir : env.getServerNodeDir()) { + Assert.assertTrue(new File(nodeDir).isDirectory()); + } + } + +} diff --git a/hugegraph-cluster-test/hugegraph-clustertest-test/src/main/java/org/apache/hugegraph/SimpleClusterTest/SimpleClusterSuiteTest.java b/hugegraph-cluster-test/hugegraph-clustertest-test/src/main/java/org/apache/hugegraph/SimpleClusterTest/SimpleClusterSuiteTest.java new file mode 100644 index 0000000000..7f24d8b46c --- /dev/null +++ b/hugegraph-cluster-test/hugegraph-clustertest-test/src/main/java/org/apache/hugegraph/SimpleClusterTest/SimpleClusterSuiteTest.java @@ -0,0 +1,33 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.hugegraph.SimpleClusterTest; + +import org.junit.runner.RunWith; +import org.junit.runners.Suite; + +import lombok.extern.slf4j.Slf4j; + +@RunWith(Suite.class) +@Suite.SuiteClasses({ + SimpleClusterDeployTest.class, + SimpleClusterFileTest.class, +}) +@Slf4j +public class SimpleClusterSuiteTest { + +} diff --git a/hugegraph-cluster-test/pom.xml b/hugegraph-cluster-test/pom.xml index e76485b739..683249c255 100644 --- a/hugegraph-cluster-test/pom.xml +++ b/hugegraph-cluster-test/pom.xml @@ -33,9 +33,9 @@ - hg-ct-minicluster - hg-ct-dist - hg-ct-test + hugegraph-clustertest-minicluster + hugegraph-clustertest-dist + hugegraph-clustertest-test @@ -53,4 +53,57 @@ + + + + org.apache.maven.plugins + maven-clean-plugin + + + + ${project.basedir}/ + + *.tar + *.tar.gz + .flattened-pom.xml + ${final.name}/** + + false + + + ${final.name} + + + + + + + + + + simple-cluster-test + + true + + + + + org.apache.maven.plugins + maven-surefire-plugin + 2.20 + + + simple-cluster-test + + test + + test + + + + + + + + From deedb7df6889c311c163ae8480e70299ff5c02d4 Mon Sep 17 00:00:00 2001 From: 145425491 <1245294786@qq.com> Date: Mon, 9 Sep 2024 18:26:35 +0800 Subject: [PATCH 16/40] feat(ct): add CI yml file --- .github/workflows/cluster-test-ci.yml | 49 +++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 .github/workflows/cluster-test-ci.yml diff --git a/.github/workflows/cluster-test-ci.yml b/.github/workflows/cluster-test-ci.yml new file mode 100644 index 0000000000..fd0494a2c0 --- /dev/null +++ b/.github/workflows/cluster-test-ci.yml @@ -0,0 +1,49 @@ +name: "Cluster Test CI" + +on: + push: + branches: + - master + - 'release-*' + - 'test-*' + pull_request: + +jobs: + cluster-test: + runs-on: ubuntu-latest + env: + USE_STAGE: 'true' # Whether to include the stage repository. + + steps: + - name: Install JDK 11 + uses: actions/setup-java@v3 + with: + java-version: '11' + distribution: 'zulu' + + - name: Cache Maven packages + uses: actions/cache@v3 + with: + path: ~/.m2 + key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} + restore-keys: ${{ runner.os }}-m2 + + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 5 + + - name: use staged maven repo settings + if: ${{ env.USE_STAGE == 'true' }} + run: | + cp $HOME/.m2/settings.xml /tmp/settings.xml + mv -vf .github/configs/settings.xml $HOME/.m2/settings.xml + + - name: Package + run: | + mvn clean package -U -Dmaven.javadoc.skip=true -Dmaven.test.skip=true -ntp + + - name: Run cluster test + run: | + mvn test -pl hugegraph-cluster-test/hugegraph-clustertest-test -am -P + simple-cluster-test -DskipCommonsTests=true \ No newline at end of file From 7275b6705f74006802f29e1ab4cf3ed29d0731a0 Mon Sep 17 00:00:00 2001 From: 145425491 <1245294786@qq.com> Date: Mon, 9 Sep 2024 18:43:17 +0800 Subject: [PATCH 17/40] fix(ct): add dependency to ct-test pom --- .../hugegraph/SimpleClusterTest/BaseSimpleTest.java | 4 ---- hugegraph-cluster-test/pom.xml | 10 ++++++++++ 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/hugegraph-cluster-test/hugegraph-clustertest-test/src/main/java/org/apache/hugegraph/SimpleClusterTest/BaseSimpleTest.java b/hugegraph-cluster-test/hugegraph-clustertest-test/src/main/java/org/apache/hugegraph/SimpleClusterTest/BaseSimpleTest.java index 4275c65114..1f54da529b 100644 --- a/hugegraph-cluster-test/hugegraph-clustertest-test/src/main/java/org/apache/hugegraph/SimpleClusterTest/BaseSimpleTest.java +++ b/hugegraph-cluster-test/hugegraph-clustertest-test/src/main/java/org/apache/hugegraph/SimpleClusterTest/BaseSimpleTest.java @@ -23,15 +23,11 @@ import org.apache.hugegraph.ct.env.BaseEnv; import org.apache.hugegraph.ct.env.SimpleEnv; -import org.apache.hugegraph.util.Log; import org.junit.AfterClass; import org.junit.BeforeClass; -import org.slf4j.Logger; public class BaseSimpleTest { - protected static final Logger LOG = Log.logger(BaseSimpleTest.class); - protected static BaseEnv env; protected static Process p; diff --git a/hugegraph-cluster-test/pom.xml b/hugegraph-cluster-test/pom.xml index 683249c255..938310a6dc 100644 --- a/hugegraph-cluster-test/pom.xml +++ b/hugegraph-cluster-test/pom.xml @@ -51,6 +51,16 @@ jsr305 3.0.2 + + junit + junit + 4.13.2 + + + org.apache.hugegraph + hugegraph-utils + 1.5.0 + From 4dfea3069d27ba7e3679f03d3bf9fa872cc84c80 Mon Sep 17 00:00:00 2001 From: 145425491 <1245294786@qq.com> Date: Mon, 9 Sep 2024 19:04:08 +0800 Subject: [PATCH 18/40] fix(ct): delete unused pom dependencies --- .../hugegraph-clustertest-minicluster/pom.xml | 11 ----------- hugegraph-cluster-test/pom.xml | 5 ----- 2 files changed, 16 deletions(-) diff --git a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/pom.xml b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/pom.xml index f99ce537b0..8feb6181f2 100644 --- a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/pom.xml +++ b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/pom.xml @@ -61,17 +61,6 @@ 1.18.24 compile - - org.freemarker - freemarker - 2.3.33 - - - org.yaml - snakeyaml - 2.2 - compile - diff --git a/hugegraph-cluster-test/pom.xml b/hugegraph-cluster-test/pom.xml index 938310a6dc..caf49da609 100644 --- a/hugegraph-cluster-test/pom.xml +++ b/hugegraph-cluster-test/pom.xml @@ -56,11 +56,6 @@ junit 4.13.2 - - org.apache.hugegraph - hugegraph-utils - 1.5.0 - From 2d1896a32ef3113594a65d64a1a1f8ac5cb7d709 Mon Sep 17 00:00:00 2001 From: 145425491 <1245294786@qq.com> Date: Mon, 9 Sep 2024 19:41:02 +0800 Subject: [PATCH 19/40] fix(ct): fix ci file --- .github/workflows/cluster-test-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cluster-test-ci.yml b/.github/workflows/cluster-test-ci.yml index fd0494a2c0..7bd78ee0cc 100644 --- a/.github/workflows/cluster-test-ci.yml +++ b/.github/workflows/cluster-test-ci.yml @@ -46,4 +46,4 @@ jobs: - name: Run cluster test run: | mvn test -pl hugegraph-cluster-test/hugegraph-clustertest-test -am -P - simple-cluster-test -DskipCommonsTests=true \ No newline at end of file + simple-cluster-test -DskipCommonsTests=true From 17f96a4fb1a5b3241e89591ff1ad7e230f36a975 Mon Sep 17 00:00:00 2001 From: 145425491 <1245294786@qq.com> Date: Mon, 9 Sep 2024 19:55:08 +0800 Subject: [PATCH 20/40] fix(ct): fix ci file --- .github/workflows/cluster-test-ci.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/cluster-test-ci.yml b/.github/workflows/cluster-test-ci.yml index 7bd78ee0cc..9db7be910f 100644 --- a/.github/workflows/cluster-test-ci.yml +++ b/.github/workflows/cluster-test-ci.yml @@ -45,5 +45,4 @@ jobs: - name: Run cluster test run: | - mvn test -pl hugegraph-cluster-test/hugegraph-clustertest-test -am -P - simple-cluster-test -DskipCommonsTests=true + mvn test -pl hugegraph-cluster-test/hugegraph-clustertest-test -am -P simple-cluster-test -DskipCommonsTests=true From 94a60ba80c2663f0760884de32659a3bd944e4fa Mon Sep 17 00:00:00 2001 From: 145425491 <1245294786@qq.com> Date: Wed, 11 Sep 2024 21:28:45 +0800 Subject: [PATCH 21/40] fix(ct): fix ci file --- .../static/pd-application.yml.template | 2 +- .../hugegraph/ct/base/ClusterConstant.java | 18 ++++++++++++++---- .../org/apache/hugegraph/ct/base/EnvUtil.java | 3 ++- .../apache/hugegraph/ct/env/AbstractEnv.java | 8 ++++---- .../hugegraph/ct/node/PDNodeWrapper.java | 10 +++++----- .../SimpleClusterTest/BaseSimpleTest.java | 3 ++- 6 files changed, 28 insertions(+), 16 deletions(-) diff --git a/hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/pd-application.yml.template b/hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/pd-application.yml.template index 838be5e7a9..b76ae93618 100644 --- a/hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/pd-application.yml.template +++ b/hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/pd-application.yml.template @@ -30,7 +30,7 @@ management: include: "*" logging: - config: file:./conf/log4j2.xml + config: 'file:./conf/log4j2.xml' license: verify-path: ./conf/verify-license.json license-path: ./conf/hugegraph.license diff --git a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/base/ClusterConstant.java b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/base/ClusterConstant.java index fee0f8c76f..fa3da9df64 100644 --- a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/base/ClusterConstant.java +++ b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/base/ClusterConstant.java @@ -25,6 +25,7 @@ public class ClusterConstant { public static final String USER_DIR = "user.dir"; public static final String LOG = "logs"; + public static final String PROJECT_DIR = getProjectDir(); public static final String LIB_DIR = "lib"; public static final String EXT_DIR = "ext"; @@ -69,7 +70,7 @@ public class ClusterConstant { + (SystemUtils.IS_OS_WINDOWS ? "java.exe" : "java"); public static final String PD_DIST_PATH = - System.getProperty(USER_DIR) + PROJECT_DIR + File.separator + "hugegraph-pd" + File.separator; @@ -81,7 +82,7 @@ public class ClusterConstant { + File.separator; public static final String STORE_DIST_PATH = - System.getProperty(USER_DIR) + PROJECT_DIR + File.separator + "hugegraph-store" + File.separator; @@ -93,7 +94,7 @@ public class ClusterConstant { + File.separator; public static final String SERVER_DIST_PATH = - System.getProperty(USER_DIR) + PROJECT_DIR + File.separator + "hugegraph-server" + File.separator; @@ -103,7 +104,7 @@ public class ClusterConstant { + File.separator; public static final String CT_DIST_PATH = - System.getProperty(USER_DIR) + PROJECT_DIR + File.separator + "hugegraph-cluster-test" + File.separator; @@ -141,4 +142,13 @@ public static boolean isJava11OrHigher() { int versionNumber = Integer.parseInt(version); return versionNumber >= 11; } + + public static String getProjectDir() { + if (System.getProperty(USER_DIR).endsWith("hugegraph-cluster-test")) { + return System.getProperty(USER_DIR) + "/.."; + } else if (System.getProperty(USER_DIR).endsWith("hugegraph-clustertest-test")) { + return System.getProperty(USER_DIR) + "/../.."; + } + return System.getProperty(USER_DIR); + } } diff --git a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/base/EnvUtil.java b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/base/EnvUtil.java index 790c2b90d0..e3c3f20cc1 100644 --- a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/base/EnvUtil.java +++ b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/base/EnvUtil.java @@ -34,11 +34,12 @@ public static int getAvailablePort() { ServerSocket socket = new ServerSocket(0); int port = socket.getLocalPort(); while (ports.contains(port)) { + socket.close(); socket = new ServerSocket(0); port = socket.getLocalPort(); - socket.close(); } ports.add(port); + socket.close(); return port; } catch (IOException e) { LOG.error("fail to get available ports", e); diff --git a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/env/AbstractEnv.java b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/env/AbstractEnv.java index 16ea8374f7..2565c5d679 100644 --- a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/env/AbstractEnv.java +++ b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/env/AbstractEnv.java @@ -125,14 +125,14 @@ public void startCluster() { } public void clearCluster() { - for (PDNodeWrapper pdNodeWrapper : pdNodeWrappers) { - pdNodeWrapper.stop(); + for (ServerNodeWrapper serverNodeWrapper : serverNodeWrappers) { + serverNodeWrapper.stop(); } for (StoreNodeWrapper storeNodeWrapper : storeNodeWrappers) { storeNodeWrapper.stop(); } - for (ServerNodeWrapper serverNodeWrapper : serverNodeWrappers) { - serverNodeWrapper.stop(); + for (PDNodeWrapper pdNodeWrapper : pdNodeWrappers) { + pdNodeWrapper.stop(); } } diff --git a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/node/PDNodeWrapper.java b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/node/PDNodeWrapper.java index b014441792..89b78fa927 100644 --- a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/node/PDNodeWrapper.java +++ b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/node/PDNodeWrapper.java @@ -43,7 +43,7 @@ public PDNodeWrapper() { VERIFY_LICENSE_FILE) ); this.workPath = PD_LIB_PATH; - this.startLine = "o.a.h.p.s.PDService - PDService init"; + this.startLine = "Hugegraph-pd started."; createNodeDir(getNodePath() + CONF_DIR + File.separator); createLogDir(); } @@ -58,7 +58,7 @@ public PDNodeWrapper(int clusterIndex, int index) { VERIFY_LICENSE_FILE) ); this.workPath = PD_LIB_PATH; - this.startLine = "o.a.h.p.s.PDService - PDService init"; + this.startLine = "Hugegraph-pd started."; createNodeDir(getNodePath() + CONF_DIR + File.separator); createLogDir(); } @@ -84,9 +84,9 @@ public void start() { "-Xmx4g", "-XX:+HeapDumpOnOutOfMemoryError", "-XX:HeapDumpPath=" + configPath + "logs", - "-Dlog4j.configurationFile=" + configPath + File.separator + CONF_DIR + - File.separator + - "log4j2.xml", + "-Dlog4j.configurationFile=" + configPath + File.separator + + CONF_DIR + + File.separator + "log4j2.xml", "-Dspring.config.location=" + configPath + CONF_DIR + File.separator + "application.yml", "-jar", pdNodeJarPath)); diff --git a/hugegraph-cluster-test/hugegraph-clustertest-test/src/main/java/org/apache/hugegraph/SimpleClusterTest/BaseSimpleTest.java b/hugegraph-cluster-test/hugegraph-clustertest-test/src/main/java/org/apache/hugegraph/SimpleClusterTest/BaseSimpleTest.java index 1f54da529b..e42bd7711c 100644 --- a/hugegraph-cluster-test/hugegraph-clustertest-test/src/main/java/org/apache/hugegraph/SimpleClusterTest/BaseSimpleTest.java +++ b/hugegraph-cluster-test/hugegraph-clustertest-test/src/main/java/org/apache/hugegraph/SimpleClusterTest/BaseSimpleTest.java @@ -39,8 +39,9 @@ public static void initEnv() throws InterruptedException { } @AfterClass - public static void clearEnv() { + public static void clearEnv() throws InterruptedException { env.clearCluster(); + Thread.sleep(2000); } protected String execCurl(String[] cmds) throws IOException { From 956226ec399471fbfed67e19a5763a38459f2052 Mon Sep 17 00:00:00 2001 From: 145425491 <1245294786@qq.com> Date: Wed, 11 Sep 2024 22:01:50 +0800 Subject: [PATCH 22/40] fix(ct): update dependency file --- install-dist/scripts/dependency/known-dependencies.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/install-dist/scripts/dependency/known-dependencies.txt b/install-dist/scripts/dependency/known-dependencies.txt index 9caa8ecab8..91bfadd817 100644 --- a/install-dist/scripts/dependency/known-dependencies.txt +++ b/install-dist/scripts/dependency/known-dependencies.txt @@ -57,11 +57,13 @@ commons-collections4-4.4.jar commons-compress-1.21.jar commons-configuration-1.10.jar commons-configuration2-2.8.0.jar +commons-io-2.12.0.jar commons-io-2.7.jar commons-io-2.8.0.jar commons-lang-2.6.jar commons-lang3-3.11.jar commons-lang3-3.12.0.jar +commons-lang3-3.13.0.jar commons-logging-1.1.1.jar commons-logging-1.2.jar commons-math3-3.2.jar @@ -455,6 +457,7 @@ sjk-stacktrace-0.22.jar slf4j-api-1.7.21.jar slf4j-api-1.7.25.jar slf4j-api-1.7.32.jar +slf4j-api-2.0.9.jar snakeyaml-1.18.jar snakeyaml-1.26.jar snakeyaml-1.27.jar From 4fa78c207c7289c2a0b570d8a9bfee278de9c907 Mon Sep 17 00:00:00 2001 From: 145425491 <1245294786@qq.com> Date: Thu, 12 Sep 2024 22:33:52 +0800 Subject: [PATCH 23/40] fix(ct): add Multi cluster test --- .github/workflows/cluster-test-ci.yml | 6 +- .../ct/node/AbstractNodeWrapper.java | 7 ++ .../hugegraph/ct/node/PDNodeWrapper.java | 4 +- .../hugegraph/ct/node/ServerNodeWrapper.java | 4 +- .../hugegraph/ct/node/StoreNodeWrapper.java | 4 +- .../hugegraph-clustertest-test/pom.xml | 12 ++++ .../BaseMultiClusterTest.java | 60 ++++++++++++++++ .../MultiClusterDeployTest.java | 72 +++++++++++++++++++ .../MultiClusterFileTest.java | 47 ++++++++++++ .../MultiClusterSuiteTest.java | 33 +++++++++ hugegraph-cluster-test/pom.xml | 24 +++++++ 11 files changed, 263 insertions(+), 10 deletions(-) create mode 100644 hugegraph-cluster-test/hugegraph-clustertest-test/src/main/java/org/apache/hugegraph/MultiClusterTest/BaseMultiClusterTest.java create mode 100644 hugegraph-cluster-test/hugegraph-clustertest-test/src/main/java/org/apache/hugegraph/MultiClusterTest/MultiClusterDeployTest.java create mode 100644 hugegraph-cluster-test/hugegraph-clustertest-test/src/main/java/org/apache/hugegraph/MultiClusterTest/MultiClusterFileTest.java create mode 100644 hugegraph-cluster-test/hugegraph-clustertest-test/src/main/java/org/apache/hugegraph/MultiClusterTest/MultiClusterSuiteTest.java diff --git a/.github/workflows/cluster-test-ci.yml b/.github/workflows/cluster-test-ci.yml index 9db7be910f..7abebc7224 100644 --- a/.github/workflows/cluster-test-ci.yml +++ b/.github/workflows/cluster-test-ci.yml @@ -43,6 +43,10 @@ jobs: run: | mvn clean package -U -Dmaven.javadoc.skip=true -Dmaven.test.skip=true -ntp - - name: Run cluster test + - name: Run simple cluster test run: | mvn test -pl hugegraph-cluster-test/hugegraph-clustertest-test -am -P simple-cluster-test -DskipCommonsTests=true + + - name: Run multi cluster test + run: | + mvn test -pl hugegraph-cluster-test/hugegraph-clustertest-test -am -P multi-cluster-test -DskipCommonsTests=true diff --git a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/node/AbstractNodeWrapper.java b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/node/AbstractNodeWrapper.java index c6210b4fe9..e25e573cbf 100644 --- a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/node/AbstractNodeWrapper.java +++ b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/node/AbstractNodeWrapper.java @@ -62,6 +62,13 @@ public AbstractNodeWrapper() { this.configPath = getNodePath(); } + public AbstractNodeWrapper(int clusterIndex, int index) { + this.clusterIndex = clusterIndex; + this.index = index; + fileNames = new ArrayList<>(); + this.configPath = getNodePath(); + } + /** * Node Dir should be created before changing Config */ diff --git a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/node/PDNodeWrapper.java b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/node/PDNodeWrapper.java index 89b78fa927..55f8706712 100644 --- a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/node/PDNodeWrapper.java +++ b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/node/PDNodeWrapper.java @@ -49,9 +49,7 @@ public PDNodeWrapper() { } public PDNodeWrapper(int clusterIndex, int index) { - super(); - this.clusterIndex = clusterIndex; - this.index = index; + super(clusterIndex, index); this.fileNames = new ArrayList<>( Arrays.asList(LOG4J_FILE, LICENSE_FILE, diff --git a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/node/ServerNodeWrapper.java b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/node/ServerNodeWrapper.java index dc2ae33aae..64f7480067 100644 --- a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/node/ServerNodeWrapper.java +++ b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/node/ServerNodeWrapper.java @@ -43,9 +43,7 @@ public class ServerNodeWrapper extends AbstractNodeWrapper { public ServerNodeWrapper(int clusterIndex, int index) { - super(); - this.clusterIndex = clusterIndex; - this.index = index; + super(clusterIndex, index); this.fileNames = new ArrayList<>( List.of(LOG4J_FILE, HUGEGRAPH_SERVER_KEYSTORE, diff --git a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/node/StoreNodeWrapper.java b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/node/StoreNodeWrapper.java index a308420738..6f21eeea90 100644 --- a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/node/StoreNodeWrapper.java +++ b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/node/StoreNodeWrapper.java @@ -44,11 +44,9 @@ public StoreNodeWrapper() { } public StoreNodeWrapper(int clusterId, int index) { - super(); + super(clusterId, index); this.fileNames = new ArrayList<>( List.of(LOG4J_FILE)); - this.clusterIndex = clusterId; - this.index = index; this.workPath = STORE_LIB_PATH; this.startLine = "o.a.h.s.n.StoreNodeApplication - Starting StoreNodeApplication"; createNodeDir(getNodePath() + CONF_DIR + File.separator); diff --git a/hugegraph-cluster-test/hugegraph-clustertest-test/pom.xml b/hugegraph-cluster-test/hugegraph-clustertest-test/pom.xml index d94ed53249..0a5b77b698 100644 --- a/hugegraph-cluster-test/hugegraph-clustertest-test/pom.xml +++ b/hugegraph-cluster-test/hugegraph-clustertest-test/pom.xml @@ -61,6 +61,18 @@ + + multi-cluster-test + + ${basedir}/src/main/java/ + + ${basedir}/target/classes/ + + + **/MultiClusterSuiteTest.java + + + diff --git a/hugegraph-cluster-test/hugegraph-clustertest-test/src/main/java/org/apache/hugegraph/MultiClusterTest/BaseMultiClusterTest.java b/hugegraph-cluster-test/hugegraph-clustertest-test/src/main/java/org/apache/hugegraph/MultiClusterTest/BaseMultiClusterTest.java new file mode 100644 index 0000000000..11d19f0a02 --- /dev/null +++ b/hugegraph-cluster-test/hugegraph-clustertest-test/src/main/java/org/apache/hugegraph/MultiClusterTest/BaseMultiClusterTest.java @@ -0,0 +1,60 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.hugegraph.MultiClusterTest; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStreamReader; + +import org.apache.hugegraph.ct.env.BaseEnv; +import org.apache.hugegraph.ct.env.MultiNodeEnv; +import org.junit.AfterClass; +import org.junit.BeforeClass; + +public class BaseMultiClusterTest { + + protected static BaseEnv env; + + protected static Process p; + + @BeforeClass + public static void initEnv() throws InterruptedException { + env = new MultiNodeEnv(); + env.startCluster(); + } + + @AfterClass + public static void clearEnv() throws InterruptedException { + env.clearCluster(); + Thread.sleep(2000); + } + + protected String execCurl(String[] cmds) throws IOException { + ProcessBuilder process = new ProcessBuilder(cmds); + p = process.start(); + BufferedReader reader = new BufferedReader(new InputStreamReader(p.getInputStream())); + StringBuilder builder = new StringBuilder(); + String line; + while ((line = reader.readLine()) != null) { + builder.append(line); + builder.append(System.getProperty("line.separator")); + } + p.destroy(); + return builder.toString(); + } +} diff --git a/hugegraph-cluster-test/hugegraph-clustertest-test/src/main/java/org/apache/hugegraph/MultiClusterTest/MultiClusterDeployTest.java b/hugegraph-cluster-test/hugegraph-clustertest-test/src/main/java/org/apache/hugegraph/MultiClusterTest/MultiClusterDeployTest.java new file mode 100644 index 0000000000..1f576ec969 --- /dev/null +++ b/hugegraph-cluster-test/hugegraph-clustertest-test/src/main/java/org/apache/hugegraph/MultiClusterTest/MultiClusterDeployTest.java @@ -0,0 +1,72 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.hugegraph.MultiClusterTest; + +import java.io.IOException; +import java.util.List; + +import org.junit.Assert; +import org.junit.Test; + +public class MultiClusterDeployTest extends BaseMultiClusterTest { + + @Test + public void testPDNodesDeployment() throws IOException { + List addrs = env.getPDRestAddrs(); + for (String addr : addrs) { + String url = addr; + String[] cmds = {"curl", url}; + StringBuffer sb = new StringBuffer(); + for (int i = 0; i < cmds.length; i++) { + sb.append(cmds[i] + " "); + } + String responseMsg = execCurl(cmds); + Assert.assertEquals(responseMsg, ""); + } + } + + @Test + public void testStoreNodesDeployment() throws IOException, InterruptedException { + List addrs = env.getStoreRestAddrs(); + for (String addr : addrs) { + String url = addr; + String[] cmds = {"curl", url}; + StringBuffer sb = new StringBuffer(); + for (int i = 0; i < cmds.length; i++) { + sb.append(cmds[i] + " "); + } + String responseMsg = execCurl(cmds); + Assert.assertTrue(responseMsg.startsWith("{")); + } + } + + @Test + public void testServerNodesDeployment() throws IOException, InterruptedException { + List addrs = env.getServerRestAddrs(); + for (String addr : addrs) { + String url = addr; + String[] cmds = {"curl", url}; + StringBuffer sb = new StringBuffer(); + for (int i = 0; i < cmds.length; i++) { + sb.append(cmds[i] + " "); + } + String responseMsg = execCurl(cmds); + Assert.assertTrue(responseMsg.startsWith("{")); + } + } +} diff --git a/hugegraph-cluster-test/hugegraph-clustertest-test/src/main/java/org/apache/hugegraph/MultiClusterTest/MultiClusterFileTest.java b/hugegraph-cluster-test/hugegraph-clustertest-test/src/main/java/org/apache/hugegraph/MultiClusterTest/MultiClusterFileTest.java new file mode 100644 index 0000000000..d74155ad16 --- /dev/null +++ b/hugegraph-cluster-test/hugegraph-clustertest-test/src/main/java/org/apache/hugegraph/MultiClusterTest/MultiClusterFileTest.java @@ -0,0 +1,47 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.hugegraph.MultiClusterTest; + +import java.io.File; + +import org.junit.Assert; +import org.junit.Test; + +public class MultiClusterFileTest extends BaseMultiClusterTest { + + @Test + public void checkPDNodeDir() { + for (String nodeDir : env.getPDNodeDir()) { + Assert.assertTrue(new File(nodeDir).isDirectory()); + } + } + + @Test + public void checkStoreNodeDir() { + for (String nodeDir : env.getStoreNodeDir()) { + Assert.assertTrue(new File(nodeDir).isDirectory()); + } + } + + @Test + public void checkServerNodeDir() { + for (String nodeDir : env.getServerNodeDir()) { + Assert.assertTrue(new File(nodeDir).isDirectory()); + } + } +} diff --git a/hugegraph-cluster-test/hugegraph-clustertest-test/src/main/java/org/apache/hugegraph/MultiClusterTest/MultiClusterSuiteTest.java b/hugegraph-cluster-test/hugegraph-clustertest-test/src/main/java/org/apache/hugegraph/MultiClusterTest/MultiClusterSuiteTest.java new file mode 100644 index 0000000000..6e55cdd200 --- /dev/null +++ b/hugegraph-cluster-test/hugegraph-clustertest-test/src/main/java/org/apache/hugegraph/MultiClusterTest/MultiClusterSuiteTest.java @@ -0,0 +1,33 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.hugegraph.MultiClusterTest; + +import org.junit.runner.RunWith; +import org.junit.runners.Suite; + +import lombok.extern.slf4j.Slf4j; + +@RunWith(Suite.class) +@Suite.SuiteClasses({ + MultiClusterDeployTest.class, + MultiClusterFileTest.class, +}) +@Slf4j +public class MultiClusterSuiteTest { + +} diff --git a/hugegraph-cluster-test/pom.xml b/hugegraph-cluster-test/pom.xml index caf49da609..d81d95aa81 100644 --- a/hugegraph-cluster-test/pom.xml +++ b/hugegraph-cluster-test/pom.xml @@ -109,6 +109,30 @@ + + multi-cluster-test + + true + + + + + org.apache.maven.plugins + maven-surefire-plugin + 2.20 + + + multi-cluster-test + + test + + test + + + + + + From 48cfc6e5fcb01fca6d90d8ce62a29190ae5df866 Mon Sep 17 00:00:00 2001 From: 145425491 <1245294786@qq.com> Date: Mon, 23 Sep 2024 22:43:15 +0800 Subject: [PATCH 24/40] chore(ct): reformat code & update config files --- .../static/pd-application.yml.template | 4 +-- .../hugegraph/ct/config/AbstractConfig.java | 12 ++++---- .../hugegraph/ct/config/GraphConfig.java | 4 ++- .../apache/hugegraph/ct/config/PDConfig.java | 30 +++++-------------- .../hugegraph/ct/config/ServerConfig.java | 5 +++- .../hugegraph/ct/config/StoreConfig.java | 4 ++- .../apache/hugegraph/ct/env/AbstractEnv.java | 2 +- .../org/apache/hugegraph/ct/env/BaseEnv.java | 2 +- .../hugegraph-clustertest-test/pom.xml | 20 +++++++++++++ .../BaseMultiClusterTest.java | 5 ++-- .../MultiClusterDeployTest.java | 6 ++-- .../SimpleClusterTest/BaseSimpleTest.java | 6 ++-- .../SimpleClusterDeployTest.java | 26 ++++++++-------- 13 files changed, 67 insertions(+), 59 deletions(-) diff --git a/hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/pd-application.yml.template b/hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/pd-application.yml.template index b76ae93618..35ee68c8c8 100644 --- a/hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/pd-application.yml.template +++ b/hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/pd-application.yml.template @@ -36,14 +36,14 @@ license: license-path: ./conf/hugegraph.license grpc: port: $GRPC_PORT$ - host: $GRPC_HOST$ + host: 127.0.0.1 server: port : $REST_PORT$ pd: # 存储路径 - data-path: $PD_DATA_PATH$ + data-path: ./pd_data # 自动扩容的检查周期,定时检查每个 store 的分区数量,自动进行分区数量平衡 patrol-interval: 1800 # 初始 store 列表,在列表内的 store 自动激活 diff --git a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/config/AbstractConfig.java b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/config/AbstractConfig.java index 91510bf07e..7efae358c2 100644 --- a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/config/AbstractConfig.java +++ b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/config/AbstractConfig.java @@ -36,9 +36,9 @@ public abstract class AbstractConfig { protected Map properties = new HashMap<>(); protected String fileName; - protected void readTemplate(String filePath) { + protected void readTemplate(Path filePath) { try { - this.config = new String(Files.readAllBytes(Paths.get(filePath))); + this.config = new String(Files.readAllBytes(filePath)); } catch (IOException e) { LOG.error("failed to get file", e); } @@ -53,15 +53,15 @@ protected void updateConfigs() { public void writeConfig(String filePath) { updateConfigs(); - String destPath = filePath + File.separator + fileName; + Path destPath = Paths.get(filePath + File.separator + fileName); try { - if (Files.notExists(Path.of(destPath).getParent())) { - Files.createDirectories(Path.of(destPath).getParent()); + if (Files.notExists(destPath.getParent())) { + Files.createDirectories(destPath.getParent()); } } catch (IOException e) { e.printStackTrace(); } - try (FileWriter writer = new FileWriter(destPath)) { + try (FileWriter writer = new FileWriter(String.valueOf(destPath))) { writer.write(config); } catch (IOException e) { e.printStackTrace(); diff --git a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/config/GraphConfig.java b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/config/GraphConfig.java index 7c04f4b07c..b28e4e57f4 100644 --- a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/config/GraphConfig.java +++ b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/config/GraphConfig.java @@ -21,13 +21,15 @@ import static org.apache.hugegraph.ct.base.ClusterConstant.GRAPH_TEMPLATE_FILE; import static org.apache.hugegraph.ct.base.ClusterConstant.HUGEGRAPH_PROPERTIES; +import java.nio.file.Paths; import java.util.List; import java.util.stream.Collectors; public class GraphConfig extends AbstractConfig { public GraphConfig() { - readTemplate(CT_PACKAGE_PATH + GRAPH_TEMPLATE_FILE); + readTemplate( + Paths.get(CT_PACKAGE_PATH + GRAPH_TEMPLATE_FILE)); this.fileName = HUGEGRAPH_PROPERTIES; } diff --git a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/config/PDConfig.java b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/config/PDConfig.java index 83a774a3c8..dae0c1b7cf 100644 --- a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/config/PDConfig.java +++ b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/config/PDConfig.java @@ -22,6 +22,7 @@ import static org.apache.hugegraph.ct.base.ClusterConstant.PD_TEMPLATE_FILE; import static org.apache.hugegraph.ct.base.EnvUtil.getAvailablePort; +import java.nio.file.Paths; import java.util.List; import java.util.stream.Collectors; @@ -31,39 +32,22 @@ public class PDConfig extends AbstractConfig { @Getter private final int raftPort, grpcPort, restPort; - @Getter - private String grpcHost, dataPath, raftHost; public PDConfig() { - readTemplate(CT_PACKAGE_PATH + PD_TEMPLATE_FILE); + readTemplate( + Paths.get(CT_PACKAGE_PATH + PD_TEMPLATE_FILE)); this.fileName = APPLICATION_FILE; - this.grpcHost = "127.0.0.1"; - this.raftHost = "127.0.0.1"; - this.dataPath = "./pd_data"; this.raftPort = getAvailablePort(); this.grpcPort = getAvailablePort(); this.restPort = getAvailablePort(); - properties.put("GRPC_HOST", grpcHost); properties.put("GRPC_PORT", String.valueOf(grpcPort)); properties.put("REST_PORT", String.valueOf(restPort)); - properties.put("PD_DATA_PATH", dataPath); - properties.put("RAFT_ADDRESS", raftHost + ":" + properties.put("RAFT_ADDRESS", "127.0.0.1:" + raftPort); } - public void setGrpcHost(String grpcHost) { - this.grpcHost = grpcHost; - setProperty("GRPC_HOST", grpcHost); - } - - public void setDataPath(String dataPath) { - this.dataPath = dataPath; - setProperty("PD_DATA_PATH", dataPath); - } - public void setRaftHost(String raftHost) { - this.raftHost = raftHost; - setProperty("RAFT_ADDRESS", raftHost + ":" + raftPort); + setProperty("RAFT_ADDRESS", "127.0.0.1:" + raftPort); } public void setRaftPeerList(List raftPeerList) { @@ -83,10 +67,10 @@ public void setStoreGrpcList(List storeGrpcList) { } public String getRaftAddress() { - return raftHost + ":" + raftPort; + return "127.0.0.1:" + raftPort; } public String getGrpcAddress() { - return grpcHost + ":" + grpcPort; + return "127.0.0.1:" + grpcPort; } } diff --git a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/config/ServerConfig.java b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/config/ServerConfig.java index c166aa4e9c..8cb0b61c1b 100644 --- a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/config/ServerConfig.java +++ b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/config/ServerConfig.java @@ -22,6 +22,8 @@ import static org.apache.hugegraph.ct.base.ClusterConstant.SERVER_TEMPLATE_FILE; import static org.apache.hugegraph.ct.base.EnvUtil.getAvailablePort; +import java.nio.file.Paths; + import lombok.Getter; public class ServerConfig extends AbstractConfig { @@ -32,7 +34,8 @@ public class ServerConfig extends AbstractConfig { private String restHost, rpcHost; public ServerConfig() { - readTemplate(CT_PACKAGE_PATH + SERVER_TEMPLATE_FILE); + readTemplate( + Paths.get(CT_PACKAGE_PATH + SERVER_TEMPLATE_FILE)); this.fileName = SERVER_PROPERTIES; this.restHost = "127.0.0.1"; this.rpcHost = "127.0.0.1"; diff --git a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/config/StoreConfig.java b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/config/StoreConfig.java index 96132e9c39..6fd8908873 100644 --- a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/config/StoreConfig.java +++ b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/config/StoreConfig.java @@ -22,6 +22,7 @@ import static org.apache.hugegraph.ct.base.ClusterConstant.STORE_TEMPLATE_FILE; import static org.apache.hugegraph.ct.base.EnvUtil.getAvailablePort; +import java.nio.file.Paths; import java.util.List; import java.util.stream.Collectors; @@ -35,7 +36,8 @@ public class StoreConfig extends AbstractConfig { private String grpcHost, dataPath, raftHost; public StoreConfig() { - readTemplate(CT_PACKAGE_PATH + STORE_TEMPLATE_FILE); + readTemplate( + Paths.get(CT_PACKAGE_PATH + STORE_TEMPLATE_FILE)); this.fileName = APPLICATION_FILE; this.grpcHost = "127.0.0.1"; this.raftHost = "127.0.0.1"; diff --git a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/env/AbstractEnv.java b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/env/AbstractEnv.java index 2565c5d679..daa42a7c3d 100644 --- a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/env/AbstractEnv.java +++ b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/env/AbstractEnv.java @@ -124,7 +124,7 @@ public void startCluster() { } } - public void clearCluster() { + public void stopCluster() { for (ServerNodeWrapper serverNodeWrapper : serverNodeWrappers) { serverNodeWrapper.stop(); } diff --git a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/env/BaseEnv.java b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/env/BaseEnv.java index bdf41b1f0f..bfc5cee506 100644 --- a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/env/BaseEnv.java +++ b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/env/BaseEnv.java @@ -27,7 +27,7 @@ public interface BaseEnv { void startCluster(); /* clear the cluster env and all config*/ - void clearCluster(); + void stopCluster(); ClusterConf getConf(); diff --git a/hugegraph-cluster-test/hugegraph-clustertest-test/pom.xml b/hugegraph-cluster-test/hugegraph-clustertest-test/pom.xml index 0a5b77b698..1505edbb7a 100644 --- a/hugegraph-cluster-test/hugegraph-clustertest-test/pom.xml +++ b/hugegraph-cluster-test/hugegraph-clustertest-test/pom.xml @@ -40,6 +40,26 @@ ${revision} compile + + org.apache.hugegraph + hugegraph-common + 1.5.0 + + + org.apache.hugegraph + hugegraph-client + 1.3.0 + + + org.apache.hugegraph + hg-store-client + 1.5.0 + + + org.apache.hugegraph + hg-pd-client + 1.5.0 + diff --git a/hugegraph-cluster-test/hugegraph-clustertest-test/src/main/java/org/apache/hugegraph/MultiClusterTest/BaseMultiClusterTest.java b/hugegraph-cluster-test/hugegraph-clustertest-test/src/main/java/org/apache/hugegraph/MultiClusterTest/BaseMultiClusterTest.java index 11d19f0a02..378a162c3f 100644 --- a/hugegraph-cluster-test/hugegraph-clustertest-test/src/main/java/org/apache/hugegraph/MultiClusterTest/BaseMultiClusterTest.java +++ b/hugegraph-cluster-test/hugegraph-clustertest-test/src/main/java/org/apache/hugegraph/MultiClusterTest/BaseMultiClusterTest.java @@ -40,11 +40,10 @@ public static void initEnv() throws InterruptedException { @AfterClass public static void clearEnv() throws InterruptedException { - env.clearCluster(); - Thread.sleep(2000); + env.stopCluster(); } - protected String execCurl(String[] cmds) throws IOException { + protected String execCmd(String[] cmds) throws IOException { ProcessBuilder process = new ProcessBuilder(cmds); p = process.start(); BufferedReader reader = new BufferedReader(new InputStreamReader(p.getInputStream())); diff --git a/hugegraph-cluster-test/hugegraph-clustertest-test/src/main/java/org/apache/hugegraph/MultiClusterTest/MultiClusterDeployTest.java b/hugegraph-cluster-test/hugegraph-clustertest-test/src/main/java/org/apache/hugegraph/MultiClusterTest/MultiClusterDeployTest.java index 1f576ec969..71e0be31dc 100644 --- a/hugegraph-cluster-test/hugegraph-clustertest-test/src/main/java/org/apache/hugegraph/MultiClusterTest/MultiClusterDeployTest.java +++ b/hugegraph-cluster-test/hugegraph-clustertest-test/src/main/java/org/apache/hugegraph/MultiClusterTest/MultiClusterDeployTest.java @@ -35,7 +35,7 @@ public void testPDNodesDeployment() throws IOException { for (int i = 0; i < cmds.length; i++) { sb.append(cmds[i] + " "); } - String responseMsg = execCurl(cmds); + String responseMsg = execCmd(cmds); Assert.assertEquals(responseMsg, ""); } } @@ -50,7 +50,7 @@ public void testStoreNodesDeployment() throws IOException, InterruptedException for (int i = 0; i < cmds.length; i++) { sb.append(cmds[i] + " "); } - String responseMsg = execCurl(cmds); + String responseMsg = execCmd(cmds); Assert.assertTrue(responseMsg.startsWith("{")); } } @@ -65,7 +65,7 @@ public void testServerNodesDeployment() throws IOException, InterruptedException for (int i = 0; i < cmds.length; i++) { sb.append(cmds[i] + " "); } - String responseMsg = execCurl(cmds); + String responseMsg = execCmd(cmds); Assert.assertTrue(responseMsg.startsWith("{")); } } diff --git a/hugegraph-cluster-test/hugegraph-clustertest-test/src/main/java/org/apache/hugegraph/SimpleClusterTest/BaseSimpleTest.java b/hugegraph-cluster-test/hugegraph-clustertest-test/src/main/java/org/apache/hugegraph/SimpleClusterTest/BaseSimpleTest.java index e42bd7711c..eb6092ae84 100644 --- a/hugegraph-cluster-test/hugegraph-clustertest-test/src/main/java/org/apache/hugegraph/SimpleClusterTest/BaseSimpleTest.java +++ b/hugegraph-cluster-test/hugegraph-clustertest-test/src/main/java/org/apache/hugegraph/SimpleClusterTest/BaseSimpleTest.java @@ -29,7 +29,6 @@ public class BaseSimpleTest { protected static BaseEnv env; - protected static Process p; @BeforeClass @@ -40,11 +39,11 @@ public static void initEnv() throws InterruptedException { @AfterClass public static void clearEnv() throws InterruptedException { - env.clearCluster(); + env.stopCluster(); Thread.sleep(2000); } - protected String execCurl(String[] cmds) throws IOException { + protected String execCmd(String[] cmds) throws IOException { ProcessBuilder process = new ProcessBuilder(cmds); p = process.start(); BufferedReader reader = new BufferedReader(new InputStreamReader(p.getInputStream())); @@ -57,4 +56,5 @@ protected String execCurl(String[] cmds) throws IOException { p.destroy(); return builder.toString(); } + } diff --git a/hugegraph-cluster-test/hugegraph-clustertest-test/src/main/java/org/apache/hugegraph/SimpleClusterTest/SimpleClusterDeployTest.java b/hugegraph-cluster-test/hugegraph-clustertest-test/src/main/java/org/apache/hugegraph/SimpleClusterTest/SimpleClusterDeployTest.java index 9dee5ec306..c254fdbe3e 100644 --- a/hugegraph-cluster-test/hugegraph-clustertest-test/src/main/java/org/apache/hugegraph/SimpleClusterTest/SimpleClusterDeployTest.java +++ b/hugegraph-cluster-test/hugegraph-clustertest-test/src/main/java/org/apache/hugegraph/SimpleClusterTest/SimpleClusterDeployTest.java @@ -35,37 +35,35 @@ public void testPDNodesDeployment() throws IOException { for (int i = 0; i < cmds.length; i++) { sb.append(cmds[i] + " "); } - String responseMsg = execCurl(cmds); + String responseMsg = execCmd(cmds); Assert.assertEquals(responseMsg, ""); } } @Test - public void testStoreNodesDeployment() throws IOException, InterruptedException { + public void testStoreNodesDeployment() throws IOException { List addrs = env.getStoreRestAddrs(); for (String addr : addrs) { - String url = addr; - String[] cmds = {"curl", url}; - StringBuffer sb = new StringBuffer(); - for (int i = 0; i < cmds.length; i++) { - sb.append(cmds[i] + " "); + String[] cmds = {"curl", addr}; + StringBuilder sb = new StringBuilder(); + for (String cmd : cmds) { + sb.append(cmd).append(" "); } - String responseMsg = execCurl(cmds); + String responseMsg = execCmd(cmds); Assert.assertTrue(responseMsg.startsWith("{")); } } @Test - public void testServerNodesDeployment() throws IOException, InterruptedException { + public void testServerNodesDeployment() throws IOException { List addrs = env.getServerRestAddrs(); for (String addr : addrs) { - String url = addr; - String[] cmds = {"curl", url}; + String[] cmds = {"curl", addr}; StringBuffer sb = new StringBuffer(); - for (int i = 0; i < cmds.length; i++) { - sb.append(cmds[i] + " "); + for (String cmd : cmds) { + sb.append(cmd).append(" "); } - String responseMsg = execCurl(cmds); + String responseMsg = execCmd(cmds); Assert.assertTrue(responseMsg.startsWith("{")); } } From 80835a337e56243bfbcd98f3f0c73e9e236e8201 Mon Sep 17 00:00:00 2001 From: 145425491 <1245294786@qq.com> Date: Wed, 25 Sep 2024 14:55:14 +0800 Subject: [PATCH 25/40] chore(ct): reformat code style based on code review comment --- .../static/rest-server.properties.template | 2 +- .../static/store-application.yml.template | 6 +- .../org/apache/hugegraph/ct/base/EnvType.java | 5 +- .../org/apache/hugegraph/ct/base/EnvUtil.java | 37 +++- .../hugegraph/ct/config/AbstractConfig.java | 12 +- .../{ClusterConf.java => ClusterConfig.java} | 21 ++- .../hugegraph/ct/config/GraphConfig.java | 1 - .../apache/hugegraph/ct/config/PDConfig.java | 21 +-- .../hugegraph/ct/config/ServerConfig.java | 19 +- .../hugegraph/ct/config/StoreConfig.java | 35 +--- .../apache/hugegraph/ct/env/AbstractEnv.java | 32 ++-- .../org/apache/hugegraph/ct/env/BaseEnv.java | 6 +- .../apache/hugegraph/ct/env/EnvFactory.java | 2 +- .../ct/node/AbstractNodeWrapper.java | 33 ++-- .../hugegraph/ct/node/ServerNodeWrapper.java | 2 +- .../hugegraph-clustertest-test/pom.xml | 11 +- .../BaseMultiClusterTest.java | 3 +- .../MultiClusterDeployTest.java | 171 ++++++++++++++++-- .../SimpleClusterTest/BaseSimpleTest.java | 4 + .../SimpleClusterDeployTest.java | 162 +++++++++++++++-- 20 files changed, 426 insertions(+), 159 deletions(-) rename hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/config/{ClusterConf.java => ClusterConfig.java} (86%) diff --git a/hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/rest-server.properties.template b/hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/rest-server.properties.template index 62f8fe8a4d..8f4e9bf616 100644 --- a/hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/rest-server.properties.template +++ b/hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/rest-server.properties.template @@ -48,7 +48,7 @@ arthas.disabled_commands=jad #auth.user_tokens=[] # rpc server configs for multi graph-servers or raft-servers -rpc.server_host=$RPC_HOST$ +rpc.server_host=127.0.0.1 rpc.server_port=$RPC_PORT$ #rpc.server_timeout=30 diff --git a/hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/store-application.yml.template b/hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/store-application.yml.template index ddb664486a..871d328736 100644 --- a/hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/store-application.yml.template +++ b/hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/store-application.yml.template @@ -31,7 +31,7 @@ management: grpc: # grpc 的服务地址 - host: $GRPC_HOST$ + host: 127.0.0.1 port: $GRPC_PORT$ netty-server: max-inbound-message-size: 1000MB @@ -48,8 +48,8 @@ server: app: # 存储路径,支持多个路径,逗号分割 - data-path: $STORE_DATA_PATH$ - #raft-path: $STORE_DATA_PATH$ + data-path: ./storage + #raft-path: ./storage spring: application: diff --git a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/base/EnvType.java b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/base/EnvType.java index 67312e8111..56449a42b0 100644 --- a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/base/EnvType.java +++ b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/base/EnvType.java @@ -18,11 +18,12 @@ package org.apache.hugegraph.ct.base; public enum EnvType { - Simple, + + SingleNode, MultiNode; public static EnvType getSystemEnvType() { - String envType = System.getProperty("TestEnv", Simple.name()); + String envType = System.getProperty("test_env", SingleNode.toString()); return EnvType.valueOf(envType); } } diff --git a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/base/EnvUtil.java b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/base/EnvUtil.java index e3c3f20cc1..6cd9814816 100644 --- a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/base/EnvUtil.java +++ b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/base/EnvUtil.java @@ -19,32 +19,49 @@ import java.io.IOException; import java.net.ServerSocket; -import java.util.ArrayList; -import java.util.List; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.StandardCopyOption; +import java.util.HashSet; +import java.util.Set; import org.slf4j.Logger; public class EnvUtil { private static final Logger LOG = HGTestLogger.LOG; - private static final List ports = new ArrayList<>(); + private static final Set ports = new HashSet<>(); public static int getAvailablePort() { try { - ServerSocket socket = new ServerSocket(0); - int port = socket.getLocalPort(); - while (ports.contains(port)) { - socket.close(); - socket = new ServerSocket(0); + int port = -1; + while (port < 0 || ports.contains(port)) { + ServerSocket socket = new ServerSocket(0); port = socket.getLocalPort(); + socket.close(); } ports.add(port); - socket.close(); return port; } catch (IOException e) { - LOG.error("fail to get available ports", e); + LOG.error("Failed to get available ports", e); return -1; } } + public static void copyFileToDestination(Path source, Path destination) { + try { + ensureParentDirectoryExists(destination); + Files.copy(source, destination, StandardCopyOption.REPLACE_EXISTING); + } catch (IOException ioException) { + LOG.error("Failed to copy files to destination dir", ioException); + throw new RuntimeException(ioException); + } + } + + private static void ensureParentDirectoryExists(Path destination) throws IOException { + Path parentDir = destination.getParent(); + if (parentDir != null && Files.notExists(parentDir)) { + Files.createDirectories(parentDir); + } + } } diff --git a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/config/AbstractConfig.java b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/config/AbstractConfig.java index 7efae358c2..b765e8aee7 100644 --- a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/config/AbstractConfig.java +++ b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/config/AbstractConfig.java @@ -47,24 +47,24 @@ protected void readTemplate(Path filePath) { protected void updateConfigs() { for (Map.Entry entry : properties.entrySet()) { String placeholder = "$" + entry.getKey() + "$"; - config = config.replace(placeholder, entry.getValue()); + this.config = this.config.replace(placeholder, entry.getValue()); } } public void writeConfig(String filePath) { updateConfigs(); - Path destPath = Paths.get(filePath + File.separator + fileName); + Path destPath = Paths.get(filePath + File.separator + this.fileName); try { if (Files.notExists(destPath.getParent())) { Files.createDirectories(destPath.getParent()); } } catch (IOException e) { - e.printStackTrace(); + LOG.error("Failed to create dir", e); } try (FileWriter writer = new FileWriter(String.valueOf(destPath))) { - writer.write(config); + writer.write(this.config); } catch (IOException e) { - e.printStackTrace(); + LOG.error("Failed to write in file", e); } } @@ -80,5 +80,3 @@ protected void setProperty(String propertyName, String value) { } } } - - diff --git a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/config/ClusterConf.java b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/config/ClusterConfig.java similarity index 86% rename from hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/config/ClusterConf.java rename to hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/config/ClusterConfig.java index bbcbe5f092..9b1b7fd14d 100644 --- a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/config/ClusterConf.java +++ b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/config/ClusterConfig.java @@ -23,7 +23,7 @@ import org.apache.hugegraph.ct.base.HGTestLogger; import org.slf4j.Logger; -public class ClusterConf { +public class ClusterConfig { protected static final Logger LOG = HGTestLogger.LOG; protected List pdConfigs; @@ -33,7 +33,7 @@ public class ClusterConf { protected List pdGrpcList, pdRaftList, storeGrpcList; - public ClusterConf(int pdCnt, int storeCnt, int serverCnt) { + public ClusterConfig(int pdCnt, int storeCnt, int serverCnt) { pdConfigs = new ArrayList<>(); storeConfigs = new ArrayList<>(); serverConfigs = new ArrayList<>(); @@ -96,6 +96,14 @@ public List getPDRestAddrs() { return addrs; } + public List getPDGrpcAddrs() { + List addrs = new ArrayList<>(); + for (PDConfig pdConfig : pdConfigs) { + addrs.add(pdConfig.getGrpcAddress()); + } + return addrs; + } + public List getStoreRestAddrs() { List addrs = new ArrayList<>(); for (StoreConfig storeConfig : storeConfigs) { @@ -105,6 +113,15 @@ public List getStoreRestAddrs() { return addrs; } + public List getStoreGrpcAddrs() { + List addrs = new ArrayList<>(); + for (StoreConfig storeConfig : storeConfigs) { + addrs.add("127.0.0.1" + ":" + + storeConfig.getGrpcPort()); + } + return addrs; + } + public List getServerRestAddrs() { List addrs = new ArrayList<>(); for (ServerConfig serverConfig : serverConfigs) { diff --git a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/config/GraphConfig.java b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/config/GraphConfig.java index b28e4e57f4..f2950bbfbb 100644 --- a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/config/GraphConfig.java +++ b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/config/GraphConfig.java @@ -37,5 +37,4 @@ public void setPDPeersList(List pdPeersList) { String pdPeers = pdPeersList.stream().collect(Collectors.joining(",")); setProperty("PD_PEERS_LIST", pdPeers); } - } diff --git a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/config/PDConfig.java b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/config/PDConfig.java index dae0c1b7cf..52768c112a 100644 --- a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/config/PDConfig.java +++ b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/config/PDConfig.java @@ -31,7 +31,11 @@ public class PDConfig extends AbstractConfig { @Getter - private final int raftPort, grpcPort, restPort; + private final int raftPort; + @Getter + private final int grpcPort; + @Getter + private final int restPort; public PDConfig() { readTemplate( @@ -40,14 +44,9 @@ public PDConfig() { this.raftPort = getAvailablePort(); this.grpcPort = getAvailablePort(); this.restPort = getAvailablePort(); - properties.put("GRPC_PORT", String.valueOf(grpcPort)); - properties.put("REST_PORT", String.valueOf(restPort)); - properties.put("RAFT_ADDRESS", "127.0.0.1:" - + raftPort); - } - - public void setRaftHost(String raftHost) { - setProperty("RAFT_ADDRESS", "127.0.0.1:" + raftPort); + properties.put("GRPC_PORT", String.valueOf(this.grpcPort)); + properties.put("REST_PORT", String.valueOf(this.restPort)); + properties.put("RAFT_ADDRESS", "127.0.0.1:" + this.raftPort); } public void setRaftPeerList(List raftPeerList) { @@ -67,10 +66,10 @@ public void setStoreGrpcList(List storeGrpcList) { } public String getRaftAddress() { - return "127.0.0.1:" + raftPort; + return "127.0.0.1:" + this.raftPort; } public String getGrpcAddress() { - return "127.0.0.1:" + grpcPort; + return "127.0.0.1:" + this.grpcPort; } } diff --git a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/config/ServerConfig.java b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/config/ServerConfig.java index 8cb0b61c1b..7da6f08af1 100644 --- a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/config/ServerConfig.java +++ b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/config/ServerConfig.java @@ -29,26 +29,17 @@ public class ServerConfig extends AbstractConfig { @Getter - private int rpcPort, restPort; + private int rpcPort; @Getter - private String restHost, rpcHost; + private int restPort; public ServerConfig() { - readTemplate( - Paths.get(CT_PACKAGE_PATH + SERVER_TEMPLATE_FILE)); + readTemplate(Paths.get(CT_PACKAGE_PATH + SERVER_TEMPLATE_FILE)); this.fileName = SERVER_PROPERTIES; - this.restHost = "127.0.0.1"; - this.rpcHost = "127.0.0.1"; this.rpcPort = getAvailablePort(); this.restPort = getAvailablePort(); - properties.put("REST_SERVER_ADDRESS", restHost + ":" + restPort); - properties.put("RPC_PORT", String.valueOf(rpcPort)); - properties.put("RPC_HOST", rpcHost); - } - - public void setRestHost(String restHost) { - this.restHost = restHost; - setProperty("REST_SERVER_ADDRESS", restHost + ":" + restPort); + properties.put("REST_SERVER_ADDRESS", "127.0.0.1:" + this.restPort); + properties.put("RPC_PORT", String.valueOf(this.rpcPort)); } public void setServerID(String serverID) { diff --git a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/config/StoreConfig.java b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/config/StoreConfig.java index 6fd8908873..5e24c457c5 100644 --- a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/config/StoreConfig.java +++ b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/config/StoreConfig.java @@ -31,41 +31,22 @@ public class StoreConfig extends AbstractConfig { @Getter - private int raftPort, grpcPort, restPort; + private int raftPort; @Getter - private String grpcHost, dataPath, raftHost; + private int grpcPort; + @Getter + private int restPort; public StoreConfig() { readTemplate( Paths.get(CT_PACKAGE_PATH + STORE_TEMPLATE_FILE)); this.fileName = APPLICATION_FILE; - this.grpcHost = "127.0.0.1"; - this.raftHost = "127.0.0.1"; - this.dataPath = "./storage"; this.raftPort = getAvailablePort(); this.grpcPort = getAvailablePort(); this.restPort = getAvailablePort(); - properties.put("GRPC_HOST", grpcHost); - properties.put("GRPC_PORT", String.valueOf(grpcPort)); - properties.put("REST_PORT", String.valueOf(restPort)); - properties.put("STORE_DATA_PATH", dataPath); - properties.put("RAFT_ADDRESS", raftHost + ":" - + raftPort); - } - - public void setGrpcHost(String grpcHost) { - this.grpcHost = grpcHost; - setProperty("GRPC_HOST", grpcHost); - } - - public void setDataPath(String dataPath) { - this.dataPath = dataPath; - setProperty("PD_DATA_PATH", dataPath); - } - - public void setRaftHost(String raftHost) { - this.raftHost = raftHost; - setProperty("RAFT_ADDRESS", raftHost + ":" + raftPort); + properties.put("GRPC_PORT", String.valueOf(this.grpcPort)); + properties.put("REST_PORT", String.valueOf(this.restPort)); + properties.put("RAFT_ADDRESS", "127.0.0.1:" + this.raftPort); } public void setPDServerList(List pdServerList) { @@ -75,6 +56,6 @@ public void setPDServerList(List pdServerList) { } public String getGrpcAddress() { - return grpcHost + ":" + grpcPort; + return "127.0.0.1:" + this.grpcPort; } } diff --git a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/env/AbstractEnv.java b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/env/AbstractEnv.java index daa42a7c3d..eb0fc62a26 100644 --- a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/env/AbstractEnv.java +++ b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/env/AbstractEnv.java @@ -23,7 +23,7 @@ import java.util.List; import org.apache.hugegraph.ct.base.HGTestLogger; -import org.apache.hugegraph.ct.config.ClusterConf; +import org.apache.hugegraph.ct.config.ClusterConfig; import org.apache.hugegraph.ct.config.GraphConfig; import org.apache.hugegraph.ct.config.PDConfig; import org.apache.hugegraph.ct.config.ServerConfig; @@ -40,7 +40,7 @@ public abstract class AbstractEnv implements BaseEnv { private static final Logger LOG = HGTestLogger.LOG; - protected ClusterConf clusterConf; + protected ClusterConfig clusterConfig; protected List pdNodeWrappers; protected List serverNodeWrappers; protected List storeNodeWrappers; @@ -54,10 +54,10 @@ protected AbstractEnv() { } protected void init(int pdCnt, int storeCnt, int serverCnt) { - this.clusterConf = new ClusterConf(pdCnt, storeCnt, serverCnt); + this.clusterConfig = new ClusterConfig(pdCnt, storeCnt, serverCnt); for (int i = 0; i < pdCnt; i++) { PDNodeWrapper pdNodeWrapper = new PDNodeWrapper(cluster_id, i); - PDConfig pdConfig = clusterConf.getPDConfig(i); + PDConfig pdConfig = clusterConfig.getPDConfig(i); pdNodeWrappers.add(pdNodeWrapper); pdConfig.writeConfig(pdNodeWrapper.getNodePath() + CONF_DIR); @@ -65,7 +65,7 @@ protected void init(int pdCnt, int storeCnt, int serverCnt) { for (int i = 0; i < storeCnt; i++) { StoreNodeWrapper storeNodeWrapper = new StoreNodeWrapper(cluster_id, i); - StoreConfig storeConfig = clusterConf.getStoreConfig(i); + StoreConfig storeConfig = clusterConfig.getStoreConfig(i); storeNodeWrappers.add(storeNodeWrapper); storeConfig.writeConfig(storeNodeWrapper.getNodePath() + CONF_DIR); @@ -74,9 +74,9 @@ protected void init(int pdCnt, int storeCnt, int serverCnt) { for (int i = 0; i < serverCnt; i++) { ServerNodeWrapper serverNodeWrapper = new ServerNodeWrapper(cluster_id, i); serverNodeWrappers.add(serverNodeWrapper); - ServerConfig serverConfig = clusterConf.getServerConfig(i); + ServerConfig serverConfig = clusterConfig.getServerConfig(i); serverConfig.setServerID(serverNodeWrapper.getID()); - GraphConfig graphConfig = clusterConf.getGraphConfig(i); + GraphConfig graphConfig = clusterConfig.getGraphConfig(i); if (i == 0) { serverConfig.setRole("master"); } else { @@ -136,20 +136,28 @@ public void stopCluster() { } } - public ClusterConf getConf() { - return this.clusterConf; + public ClusterConfig getConf() { + return this.clusterConfig; } public List getPDRestAddrs() { - return clusterConf.getPDRestAddrs(); + return clusterConfig.getPDRestAddrs(); + } + + public List getPDGrpcAddrs() { + return clusterConfig.getPDGrpcAddrs(); } public List getStoreRestAddrs() { - return clusterConf.getStoreRestAddrs(); + return clusterConfig.getStoreRestAddrs(); + } + + public List getStoreGrpcAddrs() { + return clusterConfig.getStoreGrpcAddrs(); } public List getServerRestAddrs() { - return clusterConf.getServerRestAddrs(); + return clusterConfig.getServerRestAddrs(); } public List getPDNodeDir() { diff --git a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/env/BaseEnv.java b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/env/BaseEnv.java index bfc5cee506..f6c4ba5fb6 100644 --- a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/env/BaseEnv.java +++ b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/env/BaseEnv.java @@ -19,7 +19,7 @@ import java.util.List; -import org.apache.hugegraph.ct.config.ClusterConf; +import org.apache.hugegraph.ct.config.ClusterConfig; public interface BaseEnv { @@ -29,12 +29,14 @@ public interface BaseEnv { /* clear the cluster env and all config*/ void stopCluster(); - ClusterConf getConf(); + ClusterConfig getConf(); void init(); List getPDRestAddrs(); + List getPDGrpcAddrs(); + List getStoreRestAddrs(); List getServerRestAddrs(); diff --git a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/env/EnvFactory.java b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/env/EnvFactory.java index 2747a03d3c..37507381a0 100644 --- a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/env/EnvFactory.java +++ b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/env/EnvFactory.java @@ -30,7 +30,7 @@ public static BaseEnv getEnv() { if (env == null) { EnvType envType = EnvType.getSystemEnvType(); switch (envType) { - case Simple: + case SingleNode: env = new SimpleEnv(); break; case MultiNode: diff --git a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/node/AbstractNodeWrapper.java b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/node/AbstractNodeWrapper.java index e25e573cbf..533d8b2693 100644 --- a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/node/AbstractNodeWrapper.java +++ b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/node/AbstractNodeWrapper.java @@ -28,7 +28,6 @@ import java.nio.file.NoSuchFileException; import java.nio.file.Path; import java.nio.file.Paths; -import java.nio.file.StandardCopyOption; import java.util.ArrayList; import java.util.List; import java.util.Scanner; @@ -38,6 +37,7 @@ import org.apache.commons.io.FileUtils; import org.apache.commons.io.file.PathUtils; import org.apache.hugegraph.ct.base.ClusterConstant; +import org.apache.hugegraph.ct.base.EnvUtil; import org.apache.hugegraph.ct.base.HGTestLogger; import org.slf4j.Logger; @@ -45,7 +45,7 @@ public abstract class AbstractNodeWrapper implements BaseNodeWrapper { - protected static final Logger LOG = HGTestLogger.LOG; + protected final Logger LOG = HGTestLogger.LOG; protected int clusterIndex; @Getter protected String workPath; @@ -79,30 +79,18 @@ public void createNodeDir(String destDir) { FileUtils.createParentDirectories(new File(destDir)); } } catch (NoSuchFileException fileException) { + //Ignored } Path sourcePath = Paths.get(CT_PACKAGE_PATH); // To avoid following symbolic links try (Stream stream = Files.walk(sourcePath)) { - stream.forEach( - source -> { - Path relativePath = sourcePath.relativize(source); - Path destination = - Paths.get(destDir).resolve(relativePath); - if (fileNames.contains(relativePath.toString())) { - try { - if (Files.notExists(destination.getParent())) { - Files.createDirectories(destination.getParent()); - } - Files.copy(source, - destination, - StandardCopyOption.REPLACE_EXISTING); - } catch (IOException ioException) { - LOG.error("Fail to copy files to destination dir", ioException); - throw new RuntimeException(ioException); - } - } - } - ); + stream.forEach(source -> { + Path relativePath = sourcePath.relativize(source); + Path destination = Paths.get(destDir).resolve(relativePath); + if (fileNames.contains(relativePath.toString())) { + EnvUtil.copyFileToDestination(source, destination); + } + }); } } catch (IOException ioException) { LOG.error("Got error copying files to node destination dir", ioException); @@ -199,4 +187,5 @@ protected ProcessBuilder runCmd(List startCmd, File stdoutFile) throws I processBuilder.directory(new File(configPath)); return processBuilder; } + } diff --git a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/node/ServerNodeWrapper.java b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/node/ServerNodeWrapper.java index 64f7480067..a9368aac81 100644 --- a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/node/ServerNodeWrapper.java +++ b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/node/ServerNodeWrapper.java @@ -102,7 +102,7 @@ public void start() { ProcessBuilder processBuilder = runCmd(startCmd, stdoutFile); this.instance = processBuilder.start(); } catch (IOException ex) { - throw new AssertionError("Start node failed. " + ex); + throw new AssertionError("Started server node failed. " + ex); } } diff --git a/hugegraph-cluster-test/hugegraph-clustertest-test/pom.xml b/hugegraph-cluster-test/hugegraph-clustertest-test/pom.xml index 1505edbb7a..bd24aec139 100644 --- a/hugegraph-cluster-test/hugegraph-clustertest-test/pom.xml +++ b/hugegraph-cluster-test/hugegraph-clustertest-test/pom.xml @@ -40,11 +40,6 @@ ${revision} compile - - org.apache.hugegraph - hugegraph-common - 1.5.0 - org.apache.hugegraph hugegraph-client @@ -60,6 +55,12 @@ hg-pd-client 1.5.0 + + org.apache.hugegraph + hg-store-test + 1.5.0.1 + compile + diff --git a/hugegraph-cluster-test/hugegraph-clustertest-test/src/main/java/org/apache/hugegraph/MultiClusterTest/BaseMultiClusterTest.java b/hugegraph-cluster-test/hugegraph-clustertest-test/src/main/java/org/apache/hugegraph/MultiClusterTest/BaseMultiClusterTest.java index 378a162c3f..76632df4c6 100644 --- a/hugegraph-cluster-test/hugegraph-clustertest-test/src/main/java/org/apache/hugegraph/MultiClusterTest/BaseMultiClusterTest.java +++ b/hugegraph-cluster-test/hugegraph-clustertest-test/src/main/java/org/apache/hugegraph/MultiClusterTest/BaseMultiClusterTest.java @@ -29,7 +29,6 @@ public class BaseMultiClusterTest { protected static BaseEnv env; - protected static Process p; @BeforeClass @@ -51,7 +50,7 @@ protected String execCmd(String[] cmds) throws IOException { String line; while ((line = reader.readLine()) != null) { builder.append(line); - builder.append(System.getProperty("line.separator")); + builder.append(System.lineSeparator()); } p.destroy(); return builder.toString(); diff --git a/hugegraph-cluster-test/hugegraph-clustertest-test/src/main/java/org/apache/hugegraph/MultiClusterTest/MultiClusterDeployTest.java b/hugegraph-cluster-test/hugegraph-clustertest-test/src/main/java/org/apache/hugegraph/MultiClusterTest/MultiClusterDeployTest.java index 71e0be31dc..9121088d40 100644 --- a/hugegraph-cluster-test/hugegraph-clustertest-test/src/main/java/org/apache/hugegraph/MultiClusterTest/MultiClusterDeployTest.java +++ b/hugegraph-cluster-test/hugegraph-clustertest-test/src/main/java/org/apache/hugegraph/MultiClusterTest/MultiClusterDeployTest.java @@ -18,30 +18,44 @@ package org.apache.hugegraph.MultiClusterTest; import java.io.IOException; +import java.util.Iterator; import java.util.List; +import org.apache.hugegraph.driver.GraphManager; +import org.apache.hugegraph.driver.GremlinManager; +import org.apache.hugegraph.driver.HugeClient; +import org.apache.hugegraph.driver.SchemaManager; +import org.apache.hugegraph.pd.client.PDClient; +import org.apache.hugegraph.pd.client.PDConfig; +import org.apache.hugegraph.pd.common.PDException; +import org.apache.hugegraph.structure.constant.T; +import org.apache.hugegraph.structure.graph.Edge; +import org.apache.hugegraph.structure.graph.Path; +import org.apache.hugegraph.structure.graph.Vertex; +import org.apache.hugegraph.structure.gremlin.Result; +import org.apache.hugegraph.structure.gremlin.ResultSet; import org.junit.Assert; import org.junit.Test; public class MultiClusterDeployTest extends BaseMultiClusterTest { @Test - public void testPDNodesDeployment() throws IOException { - List addrs = env.getPDRestAddrs(); - for (String addr : addrs) { - String url = addr; - String[] cmds = {"curl", url}; - StringBuffer sb = new StringBuffer(); - for (int i = 0; i < cmds.length; i++) { - sb.append(cmds[i] + " "); + public void testPDNodesDeployment() { + try { + List addrs = env.getPDGrpcAddrs(); + for (String addr : addrs) { + PDConfig pdConfig = PDConfig.of(addr); + PDClient pdClient = PDClient.create(pdConfig); + pdClient.dbCompaction(); } - String responseMsg = execCmd(cmds); - Assert.assertEquals(responseMsg, ""); + assert true; + } catch (PDException e) { + assert false; } } @Test - public void testStoreNodesDeployment() throws IOException, InterruptedException { + public void testStoreNodesDeployment() throws IOException { List addrs = env.getStoreRestAddrs(); for (String addr : addrs) { String url = addr; @@ -56,17 +70,134 @@ public void testStoreNodesDeployment() throws IOException, InterruptedException } @Test - public void testServerNodesDeployment() throws IOException, InterruptedException { + public void testServerNodesDeployment() { List addrs = env.getServerRestAddrs(); for (String addr : addrs) { - String url = addr; - String[] cmds = {"curl", url}; - StringBuffer sb = new StringBuffer(); - for (int i = 0; i < cmds.length; i++) { - sb.append(cmds[i] + " "); - } - String responseMsg = execCmd(cmds); - Assert.assertTrue(responseMsg.startsWith("{")); + HugeClient hugeClient = HugeClient.builder("http://" + addr, "hugegraph") + .build(); + SchemaManager schema = hugeClient.schema(); + + schema.propertyKey("name").asText().ifNotExist().create(); + schema.propertyKey("age").asInt().ifNotExist().create(); + schema.propertyKey("city").asText().ifNotExist().create(); + schema.propertyKey("weight").asDouble().ifNotExist().create(); + schema.propertyKey("lang").asText().ifNotExist().create(); + schema.propertyKey("date").asDate().ifNotExist().create(); + schema.propertyKey("price").asInt().ifNotExist().create(); + + schema.vertexLabel("person") + .properties("name", "age", "city") + .primaryKeys("name") + .ifNotExist() + .create(); + + schema.vertexLabel("software") + .properties("name", "lang", "price") + .primaryKeys("name") + .ifNotExist() + .create(); + + schema.indexLabel("personByCity") + .onV("person") + .by("city") + .secondary() + .ifNotExist() + .create(); + + schema.indexLabel("personByAgeAndCity") + .onV("person") + .by("age", "city") + .secondary() + .ifNotExist() + .create(); + + schema.indexLabel("softwareByPrice") + .onV("software") + .by("price") + .range() + .ifNotExist() + .create(); + + schema.edgeLabel("knows") + .sourceLabel("person") + .targetLabel("person") + .properties("date", "weight") + .ifNotExist() + .create(); + + schema.edgeLabel("created") + .sourceLabel("person").targetLabel("software") + .properties("date", "weight") + .ifNotExist() + .create(); + + schema.indexLabel("createdByDate") + .onE("created") + .by("date") + .secondary() + .ifNotExist() + .create(); + + schema.indexLabel("createdByWeight") + .onE("created") + .by("weight") + .range() + .ifNotExist() + .create(); + + schema.indexLabel("knowsByWeight") + .onE("knows") + .by("weight") + .range() + .ifNotExist() + .create(); + + GraphManager graph = hugeClient.graph(); + Vertex marko = graph.addVertex(T.LABEL, "person", "name", "marko", + "age", 29, "city", "Beijing"); + Vertex vadas = graph.addVertex(T.LABEL, "person", "name", "vadas", + "age", 27, "city", "Hongkong"); + Vertex lop = graph.addVertex(T.LABEL, "software", "name", "lop", + "lang", "java", "price", 328); + Vertex josh = graph.addVertex(T.LABEL, "person", "name", "josh", + "age", 32, "city", "Beijing"); + Vertex ripple = graph.addVertex(T.LABEL, "software", "name", "ripple", + "lang", "java", "price", 199); + Vertex peter = graph.addVertex(T.LABEL, "person", "name", "peter", + "age", 35, "city", "Shanghai"); + + marko.addEdge("knows", vadas, "date", "2016-01-10", "weight", 0.5); + marko.addEdge("knows", josh, "date", "2013-02-20", "weight", 1.0); + marko.addEdge("created", lop, "date", "2017-12-10", "weight", 0.4); + josh.addEdge("created", lop, "date", "2009-11-11", "weight", 0.4); + josh.addEdge("created", ripple, "date", "2017-12-10", "weight", 1.0); + peter.addEdge("created", lop, "date", "2017-03-24", "weight", 0.2); + + GremlinManager gremlin = hugeClient.gremlin(); + System.out.println("==== Path ===="); + ResultSet resultSet = gremlin.gremlin("g.V().outE().path()").execute(); + Iterator results = resultSet.iterator(); + results.forEachRemaining(result -> { + System.out.println(result.getObject().getClass()); + Object object = result.getObject(); + if (object instanceof Vertex) { + System.out.println(((Vertex) object).id()); + } else if (object instanceof Edge) { + System.out.println(((Edge) object).id()); + } else if (object instanceof Path) { + List elements = ((Path) object).objects(); + elements.forEach(element -> { + System.out.println(element.getClass()); + System.out.println(element); + }); + } else { + System.out.println(object); + } + }); + + hugeClient.close(); + assert true; + break; } } } diff --git a/hugegraph-cluster-test/hugegraph-clustertest-test/src/main/java/org/apache/hugegraph/SimpleClusterTest/BaseSimpleTest.java b/hugegraph-cluster-test/hugegraph-clustertest-test/src/main/java/org/apache/hugegraph/SimpleClusterTest/BaseSimpleTest.java index eb6092ae84..1e507db483 100644 --- a/hugegraph-cluster-test/hugegraph-clustertest-test/src/main/java/org/apache/hugegraph/SimpleClusterTest/BaseSimpleTest.java +++ b/hugegraph-cluster-test/hugegraph-clustertest-test/src/main/java/org/apache/hugegraph/SimpleClusterTest/BaseSimpleTest.java @@ -23,6 +23,8 @@ import org.apache.hugegraph.ct.env.BaseEnv; import org.apache.hugegraph.ct.env.SimpleEnv; +import org.apache.hugegraph.driver.HugeClient; +import org.apache.hugegraph.pd.client.PDClient; import org.junit.AfterClass; import org.junit.BeforeClass; @@ -30,6 +32,8 @@ public class BaseSimpleTest { protected static BaseEnv env; protected static Process p; + protected static PDClient pdClient; + protected static HugeClient hugeClient; @BeforeClass public static void initEnv() throws InterruptedException { diff --git a/hugegraph-cluster-test/hugegraph-clustertest-test/src/main/java/org/apache/hugegraph/SimpleClusterTest/SimpleClusterDeployTest.java b/hugegraph-cluster-test/hugegraph-clustertest-test/src/main/java/org/apache/hugegraph/SimpleClusterTest/SimpleClusterDeployTest.java index c254fdbe3e..0c2385f4e2 100644 --- a/hugegraph-cluster-test/hugegraph-clustertest-test/src/main/java/org/apache/hugegraph/SimpleClusterTest/SimpleClusterDeployTest.java +++ b/hugegraph-cluster-test/hugegraph-clustertest-test/src/main/java/org/apache/hugegraph/SimpleClusterTest/SimpleClusterDeployTest.java @@ -18,8 +18,22 @@ package org.apache.hugegraph.SimpleClusterTest; import java.io.IOException; +import java.util.Iterator; import java.util.List; +import org.apache.hugegraph.driver.GraphManager; +import org.apache.hugegraph.driver.GremlinManager; +import org.apache.hugegraph.driver.HugeClient; +import org.apache.hugegraph.driver.SchemaManager; +import org.apache.hugegraph.pd.client.PDClient; +import org.apache.hugegraph.pd.client.PDConfig; +import org.apache.hugegraph.pd.common.PDException; +import org.apache.hugegraph.structure.constant.T; +import org.apache.hugegraph.structure.graph.Vertex; +import org.apache.hugegraph.structure.gremlin.ResultSet; +import org.apache.hugegraph.structure.gremlin.Result; +import org.apache.hugegraph.structure.graph.Path; +import org.apache.hugegraph.structure.graph.Edge; import org.junit.Assert; import org.junit.Test; @@ -27,16 +41,16 @@ public class SimpleClusterDeployTest extends BaseSimpleTest { @Test public void testPDNodesDeployment() throws IOException { - List addrs = env.getPDRestAddrs(); - for (String addr : addrs) { - String url = addr; - String[] cmds = {"curl", url}; - StringBuffer sb = new StringBuffer(); - for (int i = 0; i < cmds.length; i++) { - sb.append(cmds[i] + " "); + try{ + List addrs = env.getPDGrpcAddrs(); + for (String addr : addrs) { + PDConfig pdConfig = PDConfig.of(addr); + pdClient = PDClient.create(pdConfig); + pdClient.dbCompaction(); } - String responseMsg = execCmd(cmds); - Assert.assertEquals(responseMsg, ""); + assert true; + }catch (PDException pdException){ + assert false; } } @@ -58,13 +72,129 @@ public void testStoreNodesDeployment() throws IOException { public void testServerNodesDeployment() throws IOException { List addrs = env.getServerRestAddrs(); for (String addr : addrs) { - String[] cmds = {"curl", addr}; - StringBuffer sb = new StringBuffer(); - for (String cmd : cmds) { - sb.append(cmd).append(" "); - } - String responseMsg = execCmd(cmds); - Assert.assertTrue(responseMsg.startsWith("{")); + hugeClient = HugeClient.builder("http://" + addr, "hugegraph") + .build(); + SchemaManager schema = hugeClient.schema(); + + schema.propertyKey("name").asText().ifNotExist().create(); + schema.propertyKey("age").asInt().ifNotExist().create(); + schema.propertyKey("city").asText().ifNotExist().create(); + schema.propertyKey("weight").asDouble().ifNotExist().create(); + schema.propertyKey("lang").asText().ifNotExist().create(); + schema.propertyKey("date").asDate().ifNotExist().create(); + schema.propertyKey("price").asInt().ifNotExist().create(); + + schema.vertexLabel("person") + .properties("name", "age", "city") + .primaryKeys("name") + .ifNotExist() + .create(); + + schema.vertexLabel("software") + .properties("name", "lang", "price") + .primaryKeys("name") + .ifNotExist() + .create(); + + schema.indexLabel("personByCity") + .onV("person") + .by("city") + .secondary() + .ifNotExist() + .create(); + + schema.indexLabel("personByAgeAndCity") + .onV("person") + .by("age", "city") + .secondary() + .ifNotExist() + .create(); + + schema.indexLabel("softwareByPrice") + .onV("software") + .by("price") + .range() + .ifNotExist() + .create(); + + schema.edgeLabel("knows") + .sourceLabel("person") + .targetLabel("person") + .properties("date", "weight") + .ifNotExist() + .create(); + + schema.edgeLabel("created") + .sourceLabel("person").targetLabel("software") + .properties("date", "weight") + .ifNotExist() + .create(); + + schema.indexLabel("createdByDate") + .onE("created") + .by("date") + .secondary() + .ifNotExist() + .create(); + + schema.indexLabel("createdByWeight") + .onE("created") + .by("weight") + .range() + .ifNotExist() + .create(); + + schema.indexLabel("knowsByWeight") + .onE("knows") + .by("weight") + .range() + .ifNotExist() + .create(); + + GraphManager graph = hugeClient.graph(); + Vertex marko = graph.addVertex(T.LABEL, "person", "name", "marko", + "age", 29, "city", "Beijing"); + Vertex vadas = graph.addVertex(T.LABEL, "person", "name", "vadas", + "age", 27, "city", "Hongkong"); + Vertex lop = graph.addVertex(T.LABEL, "software", "name", "lop", + "lang", "java", "price", 328); + Vertex josh = graph.addVertex(T.LABEL, "person", "name", "josh", + "age", 32, "city", "Beijing"); + Vertex ripple = graph.addVertex(T.LABEL, "software", "name", "ripple", + "lang", "java", "price", 199); + Vertex peter = graph.addVertex(T.LABEL, "person", "name", "peter", + "age", 35, "city", "Shanghai"); + + marko.addEdge("knows", vadas, "date", "2016-01-10", "weight", 0.5); + marko.addEdge("knows", josh, "date", "2013-02-20", "weight", 1.0); + marko.addEdge("created", lop, "date", "2017-12-10", "weight", 0.4); + josh.addEdge("created", lop, "date", "2009-11-11", "weight", 0.4); + josh.addEdge("created", ripple, "date", "2017-12-10", "weight", 1.0); + peter.addEdge("created", lop, "date", "2017-03-24", "weight", 0.2); + + GremlinManager gremlin = hugeClient.gremlin(); + System.out.println("==== Path ===="); + ResultSet resultSet = gremlin.gremlin("g.V().outE().path()").execute(); + Iterator results = resultSet.iterator(); + results.forEachRemaining(result -> { + System.out.println(result.getObject().getClass()); + Object object = result.getObject(); + if (object instanceof Vertex) { + System.out.println(((Vertex) object).id()); + } else if (object instanceof Edge) { + System.out.println(((Edge) object).id()); + } else if (object instanceof Path) { + List elements = ((Path) object).objects(); + elements.forEach(element -> { + System.out.println(element.getClass()); + System.out.println(element); + }); + } else { + System.out.println(object); + } + }); + + hugeClient.close(); } } } From 1f593d8af6de15d44bfc8c1b537b7490306f455c Mon Sep 17 00:00:00 2001 From: 145425491 <1245294786@qq.com> Date: Wed, 25 Sep 2024 15:47:56 +0800 Subject: [PATCH 26/40] fix(ct): resolve dependency problems & add exegesis in BaseTest class --- .../org/apache/hugegraph/ct/env/MultiNodeEnv.java | 1 + .../hugegraph-clustertest-test/pom.xml | 11 ----------- .../MultiClusterTest/BaseMultiClusterTest.java | 6 ++++++ .../hugegraph/SimpleClusterTest/BaseSimpleTest.java | 5 +++++ .../scripts/dependency/known-dependencies.txt | 1 + 5 files changed, 13 insertions(+), 11 deletions(-) diff --git a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/env/MultiNodeEnv.java b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/env/MultiNodeEnv.java index 2cd38bdbc4..83a540f26a 100644 --- a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/env/MultiNodeEnv.java +++ b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/env/MultiNodeEnv.java @@ -25,6 +25,7 @@ public MultiNodeEnv() { } public MultiNodeEnv(int pdNum, int storeNum, int serverNum) { + super(); super.init(pdNum, storeNum, serverNum); } diff --git a/hugegraph-cluster-test/hugegraph-clustertest-test/pom.xml b/hugegraph-cluster-test/hugegraph-clustertest-test/pom.xml index bd24aec139..7d44f326ba 100644 --- a/hugegraph-cluster-test/hugegraph-clustertest-test/pom.xml +++ b/hugegraph-cluster-test/hugegraph-clustertest-test/pom.xml @@ -45,22 +45,11 @@ hugegraph-client 1.3.0 - - org.apache.hugegraph - hg-store-client - 1.5.0 - org.apache.hugegraph hg-pd-client 1.5.0 - - org.apache.hugegraph - hg-store-test - 1.5.0.1 - compile - diff --git a/hugegraph-cluster-test/hugegraph-clustertest-test/src/main/java/org/apache/hugegraph/MultiClusterTest/BaseMultiClusterTest.java b/hugegraph-cluster-test/hugegraph-clustertest-test/src/main/java/org/apache/hugegraph/MultiClusterTest/BaseMultiClusterTest.java index 76632df4c6..0d77aa93e3 100644 --- a/hugegraph-cluster-test/hugegraph-clustertest-test/src/main/java/org/apache/hugegraph/MultiClusterTest/BaseMultiClusterTest.java +++ b/hugegraph-cluster-test/hugegraph-clustertest-test/src/main/java/org/apache/hugegraph/MultiClusterTest/BaseMultiClusterTest.java @@ -26,6 +26,12 @@ import org.junit.AfterClass; import org.junit.BeforeClass; +/** + * MultiNode Test generate the cluster env with 3 pd node + 3 store node + 3 server node. + * Or you can set different num of nodes by using env = new MultiNodeEnv(pdNum, storeNum, serverNum) + * All nodes are deployed in ports generated randomly, the application of nodes are stored + * in /apache-hugegraph-ct-incubating-1.5.0, you can visit each node with rest api. + */ public class BaseMultiClusterTest { protected static BaseEnv env; diff --git a/hugegraph-cluster-test/hugegraph-clustertest-test/src/main/java/org/apache/hugegraph/SimpleClusterTest/BaseSimpleTest.java b/hugegraph-cluster-test/hugegraph-clustertest-test/src/main/java/org/apache/hugegraph/SimpleClusterTest/BaseSimpleTest.java index 1e507db483..f0bcb52c59 100644 --- a/hugegraph-cluster-test/hugegraph-clustertest-test/src/main/java/org/apache/hugegraph/SimpleClusterTest/BaseSimpleTest.java +++ b/hugegraph-cluster-test/hugegraph-clustertest-test/src/main/java/org/apache/hugegraph/SimpleClusterTest/BaseSimpleTest.java @@ -28,6 +28,11 @@ import org.junit.AfterClass; import org.junit.BeforeClass; +/** + * Simple Test generate the cluster env with 1 pd node + 1 store node + 1 server node. + * All nodes are deployed in ports generated randomly, the application of nodes are stored + * in /apache-hugegraph-ct-incubating-1.5.0, you can visit each node with rest api. + */ public class BaseSimpleTest { protected static BaseEnv env; diff --git a/install-dist/scripts/dependency/known-dependencies.txt b/install-dist/scripts/dependency/known-dependencies.txt index 91bfadd817..6c37b4bfdc 100644 --- a/install-dist/scripts/dependency/known-dependencies.txt +++ b/install-dist/scripts/dependency/known-dependencies.txt @@ -342,6 +342,7 @@ lucene-core-8.11.2.jar lucene-queries-4.7.2.jar lucene-queryparser-4.7.2.jar lucene-sandbox-4.7.2.jar +lz4-java-1.4.0.jar lz4-java-1.8.0.jar metrics-annotation-4.2.4.jar metrics-core-3.0.2.jar From dd0bbd6f04c581cb44f6afcae12896eadbee1852 Mon Sep 17 00:00:00 2001 From: 145425491 <1245294786@qq.com> Date: Sun, 6 Oct 2024 17:03:24 +0800 Subject: [PATCH 27/40] fix(ct): use different Logger to record log --- .../src/main/java/org/apache/hugegraph/ct/base/EnvUtil.java | 2 +- .../main/java/org/apache/hugegraph/ct/base/HGTestLogger.java | 5 ++++- .../java/org/apache/hugegraph/ct/config/AbstractConfig.java | 2 +- .../java/org/apache/hugegraph/ct/config/ClusterConfig.java | 2 +- .../main/java/org/apache/hugegraph/ct/env/AbstractEnv.java | 2 +- .../main/java/org/apache/hugegraph/ct/env/EnvFactory.java | 2 +- .../org/apache/hugegraph/ct/node/AbstractNodeWrapper.java | 2 +- 7 files changed, 10 insertions(+), 7 deletions(-) diff --git a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/base/EnvUtil.java b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/base/EnvUtil.java index 6cd9814816..cc3318f6dc 100644 --- a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/base/EnvUtil.java +++ b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/base/EnvUtil.java @@ -29,7 +29,7 @@ public class EnvUtil { - private static final Logger LOG = HGTestLogger.LOG; + private static final Logger LOG = HGTestLogger.UtilLOG; private static final Set ports = new HashSet<>(); public static int getAvailablePort() { diff --git a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/base/HGTestLogger.java b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/base/HGTestLogger.java index 4a83785369..8e05614b50 100644 --- a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/base/HGTestLogger.java +++ b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/base/HGTestLogger.java @@ -25,5 +25,8 @@ @Slf4j public class HGTestLogger { - public static Logger LOG = LoggerFactory.getLogger(HGTestLogger.class); + public static Logger UtilLOG = LoggerFactory.getLogger(HGTestLogger.class); + public static Logger EnvLOG = LoggerFactory.getLogger(HGTestLogger.class); + public static Logger ConfigLOG = LoggerFactory.getLogger(HGTestLogger.class); + public static Logger NodeLOG = LoggerFactory.getLogger(HGTestLogger.class); } diff --git a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/config/AbstractConfig.java b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/config/AbstractConfig.java index b765e8aee7..58c33ce4ac 100644 --- a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/config/AbstractConfig.java +++ b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/config/AbstractConfig.java @@ -31,7 +31,7 @@ public abstract class AbstractConfig { - protected static final Logger LOG = HGTestLogger.LOG; + protected static final Logger LOG = HGTestLogger.ConfigLOG; protected String config; protected Map properties = new HashMap<>(); protected String fileName; diff --git a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/config/ClusterConfig.java b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/config/ClusterConfig.java index 9b1b7fd14d..5b408af5f1 100644 --- a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/config/ClusterConfig.java +++ b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/config/ClusterConfig.java @@ -25,7 +25,7 @@ public class ClusterConfig { - protected static final Logger LOG = HGTestLogger.LOG; + protected static final Logger LOG = HGTestLogger.ConfigLOG; protected List pdConfigs; protected List storeConfigs; protected List serverConfigs; diff --git a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/env/AbstractEnv.java b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/env/AbstractEnv.java index eb0fc62a26..ba9a53328b 100644 --- a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/env/AbstractEnv.java +++ b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/env/AbstractEnv.java @@ -39,7 +39,7 @@ @Slf4j public abstract class AbstractEnv implements BaseEnv { - private static final Logger LOG = HGTestLogger.LOG; + private static final Logger LOG = HGTestLogger.EnvLOG; protected ClusterConfig clusterConfig; protected List pdNodeWrappers; protected List serverNodeWrappers; diff --git a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/env/EnvFactory.java b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/env/EnvFactory.java index 37507381a0..0881194a34 100644 --- a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/env/EnvFactory.java +++ b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/env/EnvFactory.java @@ -23,7 +23,7 @@ public class EnvFactory { - private static final Logger LOG = HGTestLogger.LOG; + private static final Logger LOG = HGTestLogger.EnvLOG; private static BaseEnv env; public static BaseEnv getEnv() { diff --git a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/node/AbstractNodeWrapper.java b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/node/AbstractNodeWrapper.java index 533d8b2693..e0393216e6 100644 --- a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/node/AbstractNodeWrapper.java +++ b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/node/AbstractNodeWrapper.java @@ -45,7 +45,7 @@ public abstract class AbstractNodeWrapper implements BaseNodeWrapper { - protected final Logger LOG = HGTestLogger.LOG; + protected final Logger LOG = HGTestLogger.NodeLOG; protected int clusterIndex; @Getter protected String workPath; From 57d39add1e9a4c62c31486f9a18d2a710b9e1e2f Mon Sep 17 00:00:00 2001 From: 145425491 <1245294786@qq.com> Date: Sun, 6 Oct 2024 19:00:42 +0800 Subject: [PATCH 28/40] fix(ct): sync new commit --- .../scripts/dependency/known-dependencies.txt | 29 ++++++++++--------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/install-dist/scripts/dependency/known-dependencies.txt b/install-dist/scripts/dependency/known-dependencies.txt index d8c3239eb8..02b5dda11a 100644 --- a/install-dist/scripts/dependency/known-dependencies.txt +++ b/install-dist/scripts/dependency/known-dependencies.txt @@ -1,7 +1,3 @@ -HdrHistogram-2.1.12.jar -HdrHistogram-2.1.9.jar -LatencyUtils-2.0.3.jar -ST4-4.0.8.jar accessors-smart-1.2.jar airline-0.8.jar android-json-0.0.20131108.vaadin1.jar @@ -146,6 +142,8 @@ hamcrest-2.2.jar hamcrest-core-1.3.jar hanlp-portable-1.8.3.jar hbase-shaded-endpoint-2.0.6.jar +HdrHistogram-2.1.12.jar +HdrHistogram-2.1.9.jar hessian-3.3.6.jar hessian-3.3.7.jar hg-pd-client-1.5.0.jar @@ -216,12 +214,12 @@ javassist-3.21.0-GA.jar javassist-3.24.0-GA.jar javassist-3.28.0-GA.jar javatuples-1.2.jar -javax-websocket-client-impl-9.4.46.v20220331.jar -javax-websocket-server-impl-9.4.46.v20220331.jar javax.activation-api-1.2.0.jar javax.annotation-api-1.3.2.jar javax.inject-1.jar javax.json-1.0.jar +javax-websocket-client-impl-9.4.46.v20220331.jar +javax-websocket-server-impl-9.4.46.v20220331.jar jaxb-api-2.3.1.jar jaxb-core-3.0.2.jar jaxb-impl-3.0.2.jar @@ -264,8 +262,8 @@ jetty-util-9.4.46.v20220331.jar jetty-util-ajax-9.4.46.v20220331.jar jetty-webapp-9.4.46.v20220331.jar jetty-xml-9.4.46.v20220331.jar -jffi-1.2.16-native.jar jffi-1.2.16.jar +jffi-1.2.16-native.jar jflex-1.8.2.jar jieba-analysis-1.0.2.jar jjwt-api-0.11.5.jar @@ -282,10 +280,10 @@ jraft-core-1.3.11.jar jraft-core-1.3.13.jar jraft-core-1.3.9.jar json-20210307.jar +jsonassert-1.5.0.jar json-path-2.5.0.jar json-simple-1.1.jar json-smart-2.3.jar -jsonassert-1.5.0.jar jsr305-3.0.1.jar jsr305-3.0.2.jar jul-to-slf4j-1.7.36.jar @@ -316,6 +314,7 @@ kotlin-stdlib-1.6.20.jar kotlin-stdlib-common-1.5.31.jar kotlin-stdlib-jdk7-1.6.10.jar kotlin-stdlib-jdk8-1.6.10.jar +LatencyUtils-2.0.3.jar listenablefuture-9999.0-empty-to-avoid-conflict-with-guava.jar log4j-api-2.15.0.jar log4j-api-2.17.0.jar @@ -333,6 +332,7 @@ log4j-slf4j-impl-2.17.0.jar log4j-slf4j-impl-2.17.1.jar log4j-slf4j-impl-2.18.0.jar logging-interceptor-4.10.0.jar +lombok-1.18.24.jar lookout-api-1.4.1.jar lucene-analyzers-common-8.11.2.jar lucene-analyzers-smartcn-8.11.2.jar @@ -364,10 +364,10 @@ netty-buffer-4.1.52.Final.jar netty-buffer-4.1.72.Final.jar netty-codec-4.1.52.Final.jar netty-codec-4.1.72.Final.jar -netty-codec-http-4.1.52.Final.jar -netty-codec-http-4.1.72.Final.jar netty-codec-http2-4.1.52.Final.jar netty-codec-http2-4.1.72.Final.jar +netty-codec-http-4.1.52.Final.jar +netty-codec-http-4.1.72.Final.jar netty-codec-socks-4.1.52.Final.jar netty-codec-socks-4.1.72.Final.jar netty-common-4.1.52.Final.jar @@ -415,20 +415,20 @@ powermock-module-junit4-2.0.0-RC.3.jar powermock-module-junit4-common-2.0.0-RC.3.jar powermock-module-junit4-rule-2.0.0-RC.3.jar powermock-reflect-2.0.0-RC.3.jar -proto-google-common-protos-1.17.0.jar -proto-google-common-protos-2.0.1.jar protobuf-java-3.11.0.jar protobuf-java-3.17.2.jar protobuf-java-3.21.7.jar protobuf-java-3.5.1.jar protobuf-java-util-3.17.2.jar +proto-google-common-protos-1.17.0.jar +proto-google-common-protos-2.0.1.jar protostuff-api-1.6.0.jar protostuff-collectionschema-1.6.0.jar protostuff-core-1.6.0.jar protostuff-runtime-1.6.0.jar psjava-0.1.19.jar -reporter-config-base-3.0.3.jar reporter-config3-3.0.3.jar +reporter-config-base-3.0.3.jar rewriting-9.0-9.0.20190305.jar rocksdbjni-6.29.5.jar rocksdbjni-7.2.2.jar @@ -445,9 +445,9 @@ sjk-cli-0.22.jar sjk-core-0.14.jar sjk-core-0.22.jar sjk-hflame-0.22.jar -sjk-jfr-standalone-0.7.jar sjk-jfr5-0.5.jar sjk-jfr6-0.7.jar +sjk-jfr-standalone-0.7.jar sjk-json-0.14.jar sjk-json-0.22.jar sjk-nps-0.9.jar @@ -491,6 +491,7 @@ spring-expression-5.3.20.jar spring-jcl-5.3.20.jar spring-web-5.3.20.jar spring-webmvc-5.3.20.jar +ST4-4.0.8.jar stream-2.5.2.jar swagger-annotations-1.5.18.jar swagger-annotations-jakarta-2.2.18.jar From 7ca4c8a0cc9f6f26b2c5d976ca5856dc9ab3e39e Mon Sep 17 00:00:00 2001 From: HaoJin Yang <1454yhj@gmail.com> Date: Tue, 8 Oct 2024 23:20:55 +0800 Subject: [PATCH 29/40] Apply suggestions from code review Co-authored-by: imbajin --- .../main/java/org/apache/hugegraph/ct/env/AbstractEnv.java | 6 ++---- .../java/org/apache/hugegraph/ct/node/PDNodeWrapper.java | 1 + .../org/apache/hugegraph/ct/node/ServerNodeWrapper.java | 3 +-- .../java/org/apache/hugegraph/ct/node/StoreNodeWrapper.java | 1 + hugegraph-cluster-test/hugegraph-clustertest-test/pom.xml | 2 +- hugegraph-cluster-test/pom.xml | 1 + 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/env/AbstractEnv.java b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/env/AbstractEnv.java index ba9a53328b..0d8e8e9165 100644 --- a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/env/AbstractEnv.java +++ b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/env/AbstractEnv.java @@ -59,16 +59,14 @@ protected void init(int pdCnt, int storeCnt, int serverCnt) { PDNodeWrapper pdNodeWrapper = new PDNodeWrapper(cluster_id, i); PDConfig pdConfig = clusterConfig.getPDConfig(i); pdNodeWrappers.add(pdNodeWrapper); - pdConfig.writeConfig(pdNodeWrapper.getNodePath() - + CONF_DIR); + pdConfig.writeConfig(pdNodeWrapper.getNodePath() + CONF_DIR); } for (int i = 0; i < storeCnt; i++) { StoreNodeWrapper storeNodeWrapper = new StoreNodeWrapper(cluster_id, i); StoreConfig storeConfig = clusterConfig.getStoreConfig(i); storeNodeWrappers.add(storeNodeWrapper); - storeConfig.writeConfig(storeNodeWrapper.getNodePath() - + CONF_DIR); + storeConfig.writeConfig(storeNodeWrapper.getNodePath() + CONF_DIR); } for (int i = 0; i < serverCnt; i++) { diff --git a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/node/PDNodeWrapper.java b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/node/PDNodeWrapper.java index 55f8706712..8daaa3cd90 100644 --- a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/node/PDNodeWrapper.java +++ b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/node/PDNodeWrapper.java @@ -74,6 +74,7 @@ public void start() { LOG.error("Please make sure that the JDK is installed and the version >= 11"); return; } + String pdNodeJarPath = getFileInDir(workPath, PD_JAR_PREFIX); startCmd.addAll( Arrays.asList( diff --git a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/node/ServerNodeWrapper.java b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/node/ServerNodeWrapper.java index a9368aac81..8d0a4a7247 100644 --- a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/node/ServerNodeWrapper.java +++ b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/node/ServerNodeWrapper.java @@ -89,8 +89,7 @@ public void start() { addJarsToClasspath(new File(workPath + LIB_DIR), classpath); addJarsToClasspath(new File(workPath + EXT_DIR), classpath); addJarsToClasspath(new File(workPath + PLUGINS_DIR), classpath); - String storeClassPath = - String.join(":", classpath); + String storeClassPath = String.join(":", classpath); startCmd.addAll( Arrays.asList( "-Dname=HugeGraphServer" + this.index, diff --git a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/node/StoreNodeWrapper.java b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/node/StoreNodeWrapper.java index 6f21eeea90..667fd53175 100644 --- a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/node/StoreNodeWrapper.java +++ b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/node/StoreNodeWrapper.java @@ -63,6 +63,7 @@ public void start() { LOG.error("Please make sure that the JDK is installed and the version >= 11"); return; } + String storeNodeJarPath = getFileInDir(workPath, STORE_JAR_PREFIX); startCmd.addAll( Arrays.asList( diff --git a/hugegraph-cluster-test/hugegraph-clustertest-test/pom.xml b/hugegraph-cluster-test/hugegraph-clustertest-test/pom.xml index 7d44f326ba..9748faa4ec 100644 --- a/hugegraph-cluster-test/hugegraph-clustertest-test/pom.xml +++ b/hugegraph-cluster-test/hugegraph-clustertest-test/pom.xml @@ -48,7 +48,7 @@ org.apache.hugegraph hg-pd-client - 1.5.0 + ${revision} diff --git a/hugegraph-cluster-test/pom.xml b/hugegraph-cluster-test/pom.xml index d81d95aa81..fcc409d6ad 100644 --- a/hugegraph-cluster-test/pom.xml +++ b/hugegraph-cluster-test/pom.xml @@ -54,6 +54,7 @@ junit junit + 4.13.2 From 69b76239c970b3ebb47b3d5abb29666c0a8a9453 Mon Sep 17 00:00:00 2001 From: 145425491 <1245294786@qq.com> Date: Tue, 8 Oct 2024 23:47:20 +0800 Subject: [PATCH 30/40] fix(ct): update code based on comments --- .github/workflows/cluster-test-ci.yml | 2 +- .../src/assembly/static/verify-license.json | 6 ------ .../org/apache/hugegraph/ct/config/PDConfig.java | 3 +-- .../org/apache/hugegraph/ct/env/AbstractEnv.java | 6 ++---- .../hugegraph/ct/node/AbstractNodeWrapper.java | 2 +- .../org/apache/hugegraph/ct/node/PDNodeWrapper.java | 13 ++----------- .../apache/hugegraph/ct/node/ServerNodeWrapper.java | 5 +---- .../apache/hugegraph/ct/node/StoreNodeWrapper.java | 6 ++---- .../hugegraph-clustertest-test/pom.xml | 5 ----- pom.xml | 6 ++++++ 10 files changed, 16 insertions(+), 38 deletions(-) delete mode 100644 hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/verify-license.json diff --git a/.github/workflows/cluster-test-ci.yml b/.github/workflows/cluster-test-ci.yml index 7abebc7224..ec1c11a659 100644 --- a/.github/workflows/cluster-test-ci.yml +++ b/.github/workflows/cluster-test-ci.yml @@ -12,7 +12,7 @@ jobs: cluster-test: runs-on: ubuntu-latest env: - USE_STAGE: 'true' # Whether to include the stage repository. + USE_STAGE: 'false' # Whether to include the stage repository. steps: - name: Install JDK 11 diff --git a/hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/verify-license.json b/hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/verify-license.json deleted file mode 100644 index 868ccbebbb..0000000000 --- a/hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/verify-license.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "subject": "hugegraph-license", - "public_alias": "publiccert", - "store_ticket": "803b6cc3-d144-47e8-948f-ec8b39c8881e", - "publickey_path": "/public-certs.store" -} diff --git a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/config/PDConfig.java b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/config/PDConfig.java index 52768c112a..25012345e1 100644 --- a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/config/PDConfig.java +++ b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/config/PDConfig.java @@ -38,8 +38,7 @@ public class PDConfig extends AbstractConfig { private final int restPort; public PDConfig() { - readTemplate( - Paths.get(CT_PACKAGE_PATH + PD_TEMPLATE_FILE)); + readTemplate(Paths.get(CT_PACKAGE_PATH + PD_TEMPLATE_FILE)); this.fileName = APPLICATION_FILE; this.raftPort = getAvailablePort(); this.grpcPort = getAvailablePort(); diff --git a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/env/AbstractEnv.java b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/env/AbstractEnv.java index 0d8e8e9165..b4bb746331 100644 --- a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/env/AbstractEnv.java +++ b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/env/AbstractEnv.java @@ -80,10 +80,8 @@ protected void init(int pdCnt, int storeCnt, int serverCnt) { } else { serverConfig.setRole("worker"); } - serverConfig.writeConfig(serverNodeWrapper.getNodePath() - + CONF_DIR); - graphConfig.writeConfig(serverNodeWrapper.getNodePath() - + CONF_DIR); + serverConfig.writeConfig(serverNodeWrapper.getNodePath() + CONF_DIR); + graphConfig.writeConfig(serverNodeWrapper.getNodePath() + CONF_DIR); } } diff --git a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/node/AbstractNodeWrapper.java b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/node/AbstractNodeWrapper.java index e0393216e6..626136f9c8 100644 --- a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/node/AbstractNodeWrapper.java +++ b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/node/AbstractNodeWrapper.java @@ -148,7 +148,7 @@ public void updateConfigPath(String ConfigPath) { @Override public boolean isStarted() { try (Scanner sc = new Scanner(new FileReader(getLogPath()))) { - while (sc.hasNextLine()) { //按行读取字符串 + while (sc.hasNextLine()) { String line = sc.nextLine(); if (line.contains(startLine)) return true; } diff --git a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/node/PDNodeWrapper.java b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/node/PDNodeWrapper.java index 8daaa3cd90..e4e0294d79 100644 --- a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/node/PDNodeWrapper.java +++ b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/node/PDNodeWrapper.java @@ -23,7 +23,6 @@ import static org.apache.hugegraph.ct.base.ClusterConstant.LOG4J_FILE; import static org.apache.hugegraph.ct.base.ClusterConstant.PD_JAR_PREFIX; import static org.apache.hugegraph.ct.base.ClusterConstant.PD_LIB_PATH; -import static org.apache.hugegraph.ct.base.ClusterConstant.VERIFY_LICENSE_FILE; import static org.apache.hugegraph.ct.base.ClusterConstant.getFileInDir; import static org.apache.hugegraph.ct.base.ClusterConstant.isJava11OrHigher; @@ -37,11 +36,7 @@ public class PDNodeWrapper extends AbstractNodeWrapper { public PDNodeWrapper() { super(); - fileNames = new ArrayList( - Arrays.asList(LOG4J_FILE, - LICENSE_FILE, - VERIFY_LICENSE_FILE) - ); + fileNames = new ArrayList<>(Arrays.asList(LOG4J_FILE, LICENSE_FILE)); this.workPath = PD_LIB_PATH; this.startLine = "Hugegraph-pd started."; createNodeDir(getNodePath() + CONF_DIR + File.separator); @@ -50,11 +45,7 @@ public PDNodeWrapper() { public PDNodeWrapper(int clusterIndex, int index) { super(clusterIndex, index); - this.fileNames = new ArrayList<>( - Arrays.asList(LOG4J_FILE, - LICENSE_FILE, - VERIFY_LICENSE_FILE) - ); + this.fileNames = new ArrayList<>(Arrays.asList(LOG4J_FILE, LICENSE_FILE)); this.workPath = PD_LIB_PATH; this.startLine = "Hugegraph-pd started."; createNodeDir(getNodePath() + CONF_DIR + File.separator); diff --git a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/node/ServerNodeWrapper.java b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/node/ServerNodeWrapper.java index 8d0a4a7247..ba65ea14fa 100644 --- a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/node/ServerNodeWrapper.java +++ b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/node/ServerNodeWrapper.java @@ -54,10 +54,7 @@ public ServerNodeWrapper(int clusterIndex, int index) { REMOTE_OBJECTS_SETTING_FILE)); this.workPath = SERVER_LIB_PATH; createNodeDir(getNodePath() + CONF_DIR + File.separator); - this.fileNames = new ArrayList<>( - List.of(EMPTY_SAMPLE_GROOVY_FILE, - EXAMPLE_GROOVY_FILE) - ); + this.fileNames = new ArrayList<>(List.of(EMPTY_SAMPLE_GROOVY_FILE, EXAMPLE_GROOVY_FILE)); this.startLine = "INFO: [HttpServer] Started."; createNodeDir(getNodePath()); createLogDir(); diff --git a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/node/StoreNodeWrapper.java b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/node/StoreNodeWrapper.java index 667fd53175..6f9afcf1ef 100644 --- a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/node/StoreNodeWrapper.java +++ b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/node/StoreNodeWrapper.java @@ -35,8 +35,7 @@ public class StoreNodeWrapper extends AbstractNodeWrapper { public StoreNodeWrapper() { super(); - this.fileNames = new ArrayList<>( - List.of(LOG4J_FILE)); + this.fileNames = new ArrayList<>(List.of(LOG4J_FILE)); this.workPath = STORE_LIB_PATH; this.startLine = "o.a.h.s.n.StoreNodeApplication - Starting StoreNodeApplication"; createNodeDir(getNodePath() + CONF_DIR + File.separator); @@ -45,8 +44,7 @@ public StoreNodeWrapper() { public StoreNodeWrapper(int clusterId, int index) { super(clusterId, index); - this.fileNames = new ArrayList<>( - List.of(LOG4J_FILE)); + this.fileNames = new ArrayList<>(List.of(LOG4J_FILE)); this.workPath = STORE_LIB_PATH; this.startLine = "o.a.h.s.n.StoreNodeApplication - Starting StoreNodeApplication"; createNodeDir(getNodePath() + CONF_DIR + File.separator); diff --git a/hugegraph-cluster-test/hugegraph-clustertest-test/pom.xml b/hugegraph-cluster-test/hugegraph-clustertest-test/pom.xml index 9748faa4ec..061e001fe1 100644 --- a/hugegraph-cluster-test/hugegraph-clustertest-test/pom.xml +++ b/hugegraph-cluster-test/hugegraph-clustertest-test/pom.xml @@ -40,11 +40,6 @@ ${revision} compile - - org.apache.hugegraph - hugegraph-client - 1.3.0 - org.apache.hugegraph hg-pd-client diff --git a/pom.xml b/pom.xml index ebaaa10804..08b90402c1 100644 --- a/pom.xml +++ b/pom.xml @@ -94,6 +94,7 @@ 11 UTF-8 bash + 1.3.0 @@ -114,6 +115,11 @@ provided true + + org.apache.hugegraph + hugegraph-client + ${toolchain.vision} + From 359b832b43141cec55642869c616af0e69d9350d Mon Sep 17 00:00:00 2001 From: 145425491 <1245294786@qq.com> Date: Wed, 9 Oct 2024 12:44:30 +0800 Subject: [PATCH 31/40] fix(ct): fix pom file problem --- hugegraph-cluster-test/hugegraph-clustertest-test/pom.xml | 5 +++++ pom.xml | 5 ----- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/hugegraph-cluster-test/hugegraph-clustertest-test/pom.xml b/hugegraph-cluster-test/hugegraph-clustertest-test/pom.xml index 061e001fe1..b04ff52f85 100644 --- a/hugegraph-cluster-test/hugegraph-clustertest-test/pom.xml +++ b/hugegraph-cluster-test/hugegraph-clustertest-test/pom.xml @@ -40,6 +40,11 @@ ${revision} compile + + org.apache.hugegraph + hugegraph-client + ${toolchain.vision} + org.apache.hugegraph hg-pd-client diff --git a/pom.xml b/pom.xml index 08b90402c1..250f76c2a4 100644 --- a/pom.xml +++ b/pom.xml @@ -115,11 +115,6 @@ provided true - - org.apache.hugegraph - hugegraph-client - ${toolchain.vision} - From 82d3dd31bac2711a4ba29ead5bbcbd9707069edc Mon Sep 17 00:00:00 2001 From: 145425491 <1245294786@qq.com> Date: Wed, 9 Oct 2024 15:30:37 +0800 Subject: [PATCH 32/40] fix(ct): update pom.xml --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 250f76c2a4..f24b611ae2 100644 --- a/pom.xml +++ b/pom.xml @@ -15,7 +15,7 @@ See the License for the specific language governing permissions and limitations under the License. --> - 4.0.0 org.apache.hugegraph From 981d5721ac0b733922f2f86a359aba9cd6919339 Mon Sep 17 00:00:00 2001 From: imbajin Date: Wed, 9 Oct 2024 16:07:05 +0800 Subject: [PATCH 33/40] fix code --- .../hugegraph/ct/base/ClusterConstant.java | 81 +++++++------------ .../hugegraph/ct/config/ClusterConfig.java | 9 +-- .../hugegraph/ct/config/GraphConfig.java | 6 +- .../apache/hugegraph/ct/config/PDConfig.java | 11 +-- .../hugegraph/ct/config/ServerConfig.java | 7 +- .../hugegraph/ct/config/StoreConfig.java | 14 ++-- .../apache/hugegraph/ct/env/AbstractEnv.java | 7 +- .../ct/node/AbstractNodeWrapper.java | 14 ++-- .../hugegraph/ct/node/PDNodeWrapper.java | 25 +++--- .../hugegraph/ct/node/ServerNodeWrapper.java | 28 +++---- .../hugegraph/ct/node/StoreNodeWrapper.java | 31 ++++--- .../BaseMultiClusterTest.java | 4 +- .../MultiClusterDeployTest.java | 10 +-- .../SimpleClusterTest/BaseSimpleTest.java | 6 +- .../SimpleClusterDeployTest.java | 5 +- 15 files changed, 108 insertions(+), 150 deletions(-) diff --git a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/base/ClusterConstant.java b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/base/ClusterConstant.java index fa3da9df64..d467beb182 100644 --- a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/base/ClusterConstant.java +++ b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/base/ClusterConstant.java @@ -18,6 +18,7 @@ package org.apache.hugegraph.ct.base; import java.io.File; +import java.util.Objects; import org.apache.commons.lang3.SystemUtils; @@ -62,56 +63,34 @@ public class ClusterConstant { public static final String EMPTY_SAMPLE_GROOVY_FILE = "scripts/empty-sample.groovy"; public static final String EXAMPLE_GROOVY_FILE = "scripts/example.groovy"; - public static final String JAVA_CMD = - System.getProperty("java.home") - + File.separator - + BIN_DIR - + File.separator - + (SystemUtils.IS_OS_WINDOWS ? "java.exe" : "java"); - - public static final String PD_DIST_PATH = - PROJECT_DIR - + File.separator - + "hugegraph-pd" - + File.separator; - - public static final String PD_LIB_PATH = - getFileInDir(PD_DIST_PATH, PD_PACKAGE_PREFIX) - + File.separator - + LIB_DIR - + File.separator; - - public static final String STORE_DIST_PATH = - PROJECT_DIR - + File.separator - + "hugegraph-store" - + File.separator; - - public static final String STORE_LIB_PATH = - getFileInDir(STORE_DIST_PATH, STORE_PACKAGE_PREFIX) - + File.separator - + LIB_DIR - + File.separator; - - public static final String SERVER_DIST_PATH = - PROJECT_DIR - + File.separator - + "hugegraph-server" - + File.separator; - - public static final String SERVER_LIB_PATH = - getFileInDir(SERVER_DIST_PATH, SERVER_PACKAGE_PREFIX) - + File.separator; - - public static final String CT_DIST_PATH = - PROJECT_DIR - + File.separator - + "hugegraph-cluster-test" - + File.separator; - - public static final String CT_PACKAGE_PATH = - getFileInDir(CT_DIST_PATH, CT_PACKAGE_PREFIX) - + File.separator; + public static final String JAVA_CMD = System.getProperty("java.home") + + File.separator + BIN_DIR + File.separator + + (SystemUtils.IS_OS_WINDOWS ? "java.exe" : "java"); + + public static final String PD_DIST_PATH = PROJECT_DIR + File.separator + + "hugegraph-pd" + File.separator; + + public static final String PD_LIB_PATH = getFileInDir(PD_DIST_PATH, PD_PACKAGE_PREFIX) + + File.separator + LIB_DIR + File.separator; + + public static final String STORE_DIST_PATH = PROJECT_DIR + File.separator + "hugegraph-store" + + File.separator; + + public static final String STORE_LIB_PATH = getFileInDir(STORE_DIST_PATH, STORE_PACKAGE_PREFIX) + + File.separator + LIB_DIR + File.separator; + + public static final String SERVER_DIST_PATH = PROJECT_DIR + File.separator + + "hugegraph-server" + File.separator; + + public static final String SERVER_LIB_PATH = getFileInDir(SERVER_DIST_PATH, + SERVER_PACKAGE_PREFIX) + + File.separator; + + public static final String CT_DIST_PATH = PROJECT_DIR + File.separator + + "hugegraph-cluster-test" + File.separator; + + public static final String CT_PACKAGE_PATH = getFileInDir(CT_DIST_PATH, CT_PACKAGE_PREFIX) + + File.separator; private ClusterConstant() { throw new IllegalStateException("Utility class"); @@ -120,7 +99,7 @@ private ClusterConstant() { public static String getFileInDir(String path, String fileName) { File dir = new File(path); if (dir.exists() && dir.isDirectory()) { - for (File file : dir.listFiles()) { + for (File file : Objects.requireNonNull(dir.listFiles())) { if (file.getName().startsWith(fileName) && !file.getName().endsWith(".gz")) { return path + file.getName(); } diff --git a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/config/ClusterConfig.java b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/config/ClusterConfig.java index 5b408af5f1..22de4e4124 100644 --- a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/config/ClusterConfig.java +++ b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/config/ClusterConfig.java @@ -107,8 +107,7 @@ public List getPDGrpcAddrs() { public List getStoreRestAddrs() { List addrs = new ArrayList<>(); for (StoreConfig storeConfig : storeConfigs) { - addrs.add("127.0.0.1" + ":" + - storeConfig.getRestPort()); + addrs.add("127.0.0.1" + ":" + storeConfig.getRestPort()); } return addrs; } @@ -116,8 +115,7 @@ public List getStoreRestAddrs() { public List getStoreGrpcAddrs() { List addrs = new ArrayList<>(); for (StoreConfig storeConfig : storeConfigs) { - addrs.add("127.0.0.1" + ":" + - storeConfig.getGrpcPort()); + addrs.add("127.0.0.1" + ":" + storeConfig.getGrpcPort()); } return addrs; } @@ -125,8 +123,7 @@ public List getStoreGrpcAddrs() { public List getServerRestAddrs() { List addrs = new ArrayList<>(); for (ServerConfig serverConfig : serverConfigs) { - addrs.add("127.0.0.1" + ":" + - serverConfig.getRestPort()); + addrs.add("127.0.0.1" + ":" + serverConfig.getRestPort()); } return addrs; } diff --git a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/config/GraphConfig.java b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/config/GraphConfig.java index f2950bbfbb..97739fba8f 100644 --- a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/config/GraphConfig.java +++ b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/config/GraphConfig.java @@ -23,18 +23,16 @@ import java.nio.file.Paths; import java.util.List; -import java.util.stream.Collectors; public class GraphConfig extends AbstractConfig { public GraphConfig() { - readTemplate( - Paths.get(CT_PACKAGE_PATH + GRAPH_TEMPLATE_FILE)); + readTemplate(Paths.get(CT_PACKAGE_PATH + GRAPH_TEMPLATE_FILE)); this.fileName = HUGEGRAPH_PROPERTIES; } public void setPDPeersList(List pdPeersList) { - String pdPeers = pdPeersList.stream().collect(Collectors.joining(",")); + String pdPeers = String.join(",", pdPeersList); setProperty("PD_PEERS_LIST", pdPeers); } } diff --git a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/config/PDConfig.java b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/config/PDConfig.java index 25012345e1..e8ce378343 100644 --- a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/config/PDConfig.java +++ b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/config/PDConfig.java @@ -24,17 +24,14 @@ import java.nio.file.Paths; import java.util.List; -import java.util.stream.Collectors; import lombok.Getter; +@Getter public class PDConfig extends AbstractConfig { - @Getter private final int raftPort; - @Getter private final int grpcPort; - @Getter private final int restPort; public PDConfig() { @@ -49,8 +46,7 @@ public PDConfig() { } public void setRaftPeerList(List raftPeerList) { - String raftPeers = raftPeerList.stream() - .collect(Collectors.joining(",")); + String raftPeers = String.join(",", raftPeerList); setProperty("RAFT_PEERS_LIST", raftPeers); } @@ -59,8 +55,7 @@ public void setStoreCount(int storeCount) { } public void setStoreGrpcList(List storeGrpcList) { - String storeGrpcLists = storeGrpcList.stream() - .collect(Collectors.joining(",")); + String storeGrpcLists = String.join(",", storeGrpcList); setProperty("STORE_GRPC_LIST", storeGrpcLists); } diff --git a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/config/ServerConfig.java b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/config/ServerConfig.java index 7da6f08af1..dac97329c4 100644 --- a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/config/ServerConfig.java +++ b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/config/ServerConfig.java @@ -26,12 +26,11 @@ import lombok.Getter; +@Getter public class ServerConfig extends AbstractConfig { - @Getter - private int rpcPort; - @Getter - private int restPort; + private final int rpcPort; + private final int restPort; public ServerConfig() { readTemplate(Paths.get(CT_PACKAGE_PATH + SERVER_TEMPLATE_FILE)); diff --git a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/config/StoreConfig.java b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/config/StoreConfig.java index 5e24c457c5..0ecb3f7a38 100644 --- a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/config/StoreConfig.java +++ b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/config/StoreConfig.java @@ -24,18 +24,15 @@ import java.nio.file.Paths; import java.util.List; -import java.util.stream.Collectors; import lombok.Getter; +@Getter public class StoreConfig extends AbstractConfig { - @Getter - private int raftPort; - @Getter - private int grpcPort; - @Getter - private int restPort; + private final int raftPort; + private final int grpcPort; + private final int restPort; public StoreConfig() { readTemplate( @@ -50,8 +47,7 @@ public StoreConfig() { } public void setPDServerList(List pdServerList) { - String pdServers = pdServerList.stream() - .collect(Collectors.joining(",")); + String pdServers = String.join(",", pdServerList); setProperty("PD_SERVER_ADDRESS", pdServers); } diff --git a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/env/AbstractEnv.java b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/env/AbstractEnv.java index b4bb746331..5c1da21d3d 100644 --- a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/env/AbstractEnv.java +++ b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/env/AbstractEnv.java @@ -40,6 +40,7 @@ public abstract class AbstractEnv implements BaseEnv { private static final Logger LOG = HGTestLogger.EnvLOG; + protected ClusterConfig clusterConfig; protected List pdNodeWrappers; protected List serverNodeWrappers; @@ -86,8 +87,7 @@ protected void init(int pdCnt, int storeCnt, int serverCnt) { } public void startCluster() { - for (int i = 0; i < pdNodeWrappers.size(); i++) { - PDNodeWrapper pdNodeWrapper = pdNodeWrappers.get(i); + for (PDNodeWrapper pdNodeWrapper : pdNodeWrappers) { pdNodeWrapper.start(); while (!pdNodeWrapper.isStarted()) { try { @@ -97,8 +97,7 @@ public void startCluster() { } } } - for (int i = 0; i < storeNodeWrappers.size(); i++) { - StoreNodeWrapper storeNodeWrapper = storeNodeWrappers.get(i); + for (StoreNodeWrapper storeNodeWrapper : storeNodeWrappers) { storeNodeWrapper.start(); while (!storeNodeWrapper.isStarted()) { try { diff --git a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/node/AbstractNodeWrapper.java b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/node/AbstractNodeWrapper.java index 626136f9c8..5acf42f926 100644 --- a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/node/AbstractNodeWrapper.java +++ b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/node/AbstractNodeWrapper.java @@ -46,6 +46,7 @@ public abstract class AbstractNodeWrapper implements BaseNodeWrapper { protected final Logger LOG = HGTestLogger.NodeLOG; + protected int clusterIndex; @Getter protected String workPath; @@ -152,7 +153,7 @@ public boolean isStarted() { String line = sc.nextLine(); if (line.contains(startLine)) return true; } - } catch (FileNotFoundException e) { + } catch (FileNotFoundException ignored) { } return false; } @@ -178,12 +179,11 @@ public boolean isAlive() { } protected ProcessBuilder runCmd(List startCmd, File stdoutFile) throws IOException { - FileUtils.write( - stdoutFile, String.join(" ", startCmd) + "\n\n", StandardCharsets.UTF_8, true); - ProcessBuilder processBuilder = - new ProcessBuilder(startCmd) - .redirectOutput(ProcessBuilder.Redirect.appendTo(stdoutFile)) - .redirectError(ProcessBuilder.Redirect.appendTo(stdoutFile)); + FileUtils.write(stdoutFile, + String.join(" ", startCmd) + "\n\n", StandardCharsets.UTF_8, true); + ProcessBuilder processBuilder = new ProcessBuilder(startCmd) + .redirectOutput(ProcessBuilder.Redirect.appendTo(stdoutFile)) + .redirectError(ProcessBuilder.Redirect.appendTo(stdoutFile)); processBuilder.directory(new File(configPath)); return processBuilder; } diff --git a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/node/PDNodeWrapper.java b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/node/PDNodeWrapper.java index e4e0294d79..27386827d3 100644 --- a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/node/PDNodeWrapper.java +++ b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/node/PDNodeWrapper.java @@ -67,19 +67,18 @@ public void start() { } String pdNodeJarPath = getFileInDir(workPath, PD_JAR_PREFIX); - startCmd.addAll( - Arrays.asList( - "-Dname=HugeGraphPD" + this.index, - "-Xms512m", - "-Xmx4g", - "-XX:+HeapDumpOnOutOfMemoryError", - "-XX:HeapDumpPath=" + configPath + "logs", - "-Dlog4j.configurationFile=" + configPath + File.separator + - CONF_DIR + - File.separator + "log4j2.xml", - "-Dspring.config.location=" + configPath + CONF_DIR + File.separator + - "application.yml", - "-jar", pdNodeJarPath)); + startCmd.addAll(Arrays.asList( + "-Dname=HugeGraphPD" + this.index, + "-Xms512m", + "-Xmx4g", + "-XX:+HeapDumpOnOutOfMemoryError", + "-XX:HeapDumpPath=" + configPath + "logs", + "-Dlog4j.configurationFile=" + configPath + File.separator + + CONF_DIR + + File.separator + "log4j2.xml", + "-Dspring.config.location=" + configPath + CONF_DIR + File.separator + + "application.yml", + "-jar", pdNodeJarPath)); ProcessBuilder processBuilder = runCmd(startCmd, stdoutFile); this.instance = processBuilder.start(); } catch (IOException ex) { diff --git a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/node/ServerNodeWrapper.java b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/node/ServerNodeWrapper.java index ba65ea14fa..994bd734d8 100644 --- a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/node/ServerNodeWrapper.java +++ b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/node/ServerNodeWrapper.java @@ -44,14 +44,10 @@ public class ServerNodeWrapper extends AbstractNodeWrapper { public ServerNodeWrapper(int clusterIndex, int index) { super(clusterIndex, index); - this.fileNames = new ArrayList<>( - List.of(LOG4J_FILE, - HUGEGRAPH_SERVER_KEYSTORE, - COMPUTER_SETTING_FILE, - GREMLIN_SERVER_FILE, - GREMLIN_DRIVER_SETTING_FILE, - REMOTE_SETTING_FILE, - REMOTE_OBJECTS_SETTING_FILE)); + this.fileNames = new ArrayList<>(List.of(LOG4J_FILE, HUGEGRAPH_SERVER_KEYSTORE, + COMPUTER_SETTING_FILE, GREMLIN_SERVER_FILE, + GREMLIN_DRIVER_SETTING_FILE, REMOTE_SETTING_FILE, + REMOTE_OBJECTS_SETTING_FILE)); this.workPath = SERVER_LIB_PATH; createNodeDir(getNodePath() + CONF_DIR + File.separator); this.fileNames = new ArrayList<>(List.of(EMPTY_SAMPLE_GROOVY_FILE, EXAMPLE_GROOVY_FILE)); @@ -87,14 +83,14 @@ public void start() { addJarsToClasspath(new File(workPath + EXT_DIR), classpath); addJarsToClasspath(new File(workPath + PLUGINS_DIR), classpath); String storeClassPath = String.join(":", classpath); - startCmd.addAll( - Arrays.asList( - "-Dname=HugeGraphServer" + this.index, - "--add-exports=java.base/jdk.internal.reflect=ALL-UNNAMED", - "-cp", storeClassPath, - "org.apache.hugegraph.dist.HugeGraphServer", - "./conf/gremlin-server.yaml", - "./conf/rest-server.properties")); + + startCmd.addAll(Arrays.asList( + "-Dname=HugeGraphServer" + this.index, + "--add-exports=java.base/jdk.internal.reflect=ALL-UNNAMED", + "-cp", storeClassPath, + "org.apache.hugegraph.dist.HugeGraphServer", + "./conf/gremlin-server.yaml", + "./conf/rest-server.properties")); ProcessBuilder processBuilder = runCmd(startCmd, stdoutFile); this.instance = processBuilder.start(); } catch (IOException ex) { diff --git a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/node/StoreNodeWrapper.java b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/node/StoreNodeWrapper.java index 6f9afcf1ef..a83bfa5aa8 100644 --- a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/node/StoreNodeWrapper.java +++ b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/node/StoreNodeWrapper.java @@ -63,22 +63,21 @@ public void start() { } String storeNodeJarPath = getFileInDir(workPath, STORE_JAR_PREFIX); - startCmd.addAll( - Arrays.asList( - "-Dname=HugeGraphStore" + this.index, - "-Dlog4j.configurationFile=" + configPath + CONF_DIR - + File.separator + "log4j2.xml", - "-Dfastjson.parser.safeMode=true", - "-Xms512m", - "-Xmx2048m", - "-XX:MetaspaceSize=256M", - "-XX:+UseG1GC", - "-XX:+ParallelRefProcEnabled", - "-XX:+HeapDumpOnOutOfMemoryError", - "-XX:HeapDumpPath=" + configPath + "logs", - "-Dspring.config.location=" + configPath + CONF_DIR - + File.separator + "application.yml", - "-jar", storeNodeJarPath)); + startCmd.addAll(Arrays.asList( + "-Dname=HugeGraphStore" + this.index, + "-Dlog4j.configurationFile=" + configPath + CONF_DIR + + File.separator + "log4j2.xml", + "-Dfastjson.parser.safeMode=true", + "-Xms512m", + "-Xmx2048m", + "-XX:MetaspaceSize=256M", + "-XX:+UseG1GC", + "-XX:+ParallelRefProcEnabled", + "-XX:+HeapDumpOnOutOfMemoryError", + "-XX:HeapDumpPath=" + configPath + "logs", + "-Dspring.config.location=" + configPath + CONF_DIR + + File.separator + "application.yml", + "-jar", storeNodeJarPath)); ProcessBuilder processBuilder = runCmd(startCmd, stdoutFile); this.instance = processBuilder.start(); } catch (IOException ex) { diff --git a/hugegraph-cluster-test/hugegraph-clustertest-test/src/main/java/org/apache/hugegraph/MultiClusterTest/BaseMultiClusterTest.java b/hugegraph-cluster-test/hugegraph-clustertest-test/src/main/java/org/apache/hugegraph/MultiClusterTest/BaseMultiClusterTest.java index 0d77aa93e3..59394101c2 100644 --- a/hugegraph-cluster-test/hugegraph-clustertest-test/src/main/java/org/apache/hugegraph/MultiClusterTest/BaseMultiClusterTest.java +++ b/hugegraph-cluster-test/hugegraph-clustertest-test/src/main/java/org/apache/hugegraph/MultiClusterTest/BaseMultiClusterTest.java @@ -38,13 +38,13 @@ public class BaseMultiClusterTest { protected static Process p; @BeforeClass - public static void initEnv() throws InterruptedException { + public static void initEnv() { env = new MultiNodeEnv(); env.startCluster(); } @AfterClass - public static void clearEnv() throws InterruptedException { + public static void clearEnv() { env.stopCluster(); } diff --git a/hugegraph-cluster-test/hugegraph-clustertest-test/src/main/java/org/apache/hugegraph/MultiClusterTest/MultiClusterDeployTest.java b/hugegraph-cluster-test/hugegraph-clustertest-test/src/main/java/org/apache/hugegraph/MultiClusterTest/MultiClusterDeployTest.java index 9121088d40..0318df1ad0 100644 --- a/hugegraph-cluster-test/hugegraph-clustertest-test/src/main/java/org/apache/hugegraph/MultiClusterTest/MultiClusterDeployTest.java +++ b/hugegraph-cluster-test/hugegraph-clustertest-test/src/main/java/org/apache/hugegraph/MultiClusterTest/MultiClusterDeployTest.java @@ -58,11 +58,11 @@ public void testPDNodesDeployment() { public void testStoreNodesDeployment() throws IOException { List addrs = env.getStoreRestAddrs(); for (String addr : addrs) { - String url = addr; - String[] cmds = {"curl", url}; - StringBuffer sb = new StringBuffer(); - for (int i = 0; i < cmds.length; i++) { - sb.append(cmds[i] + " "); + String[] cmds = {"curl", addr}; + // TODO: why not use the sb param? + StringBuilder sb = new StringBuilder(); + for (String cmd : cmds) { + sb.append(cmd).append(" "); } String responseMsg = execCmd(cmds); Assert.assertTrue(responseMsg.startsWith("{")); diff --git a/hugegraph-cluster-test/hugegraph-clustertest-test/src/main/java/org/apache/hugegraph/SimpleClusterTest/BaseSimpleTest.java b/hugegraph-cluster-test/hugegraph-clustertest-test/src/main/java/org/apache/hugegraph/SimpleClusterTest/BaseSimpleTest.java index f0bcb52c59..61954de811 100644 --- a/hugegraph-cluster-test/hugegraph-clustertest-test/src/main/java/org/apache/hugegraph/SimpleClusterTest/BaseSimpleTest.java +++ b/hugegraph-cluster-test/hugegraph-clustertest-test/src/main/java/org/apache/hugegraph/SimpleClusterTest/BaseSimpleTest.java @@ -30,7 +30,7 @@ /** * Simple Test generate the cluster env with 1 pd node + 1 store node + 1 server node. - * All nodes are deployed in ports generated randomly, the application of nodes are stored + * All nodes are deployed in ports generated randomly; The application of nodes is stored * in /apache-hugegraph-ct-incubating-1.5.0, you can visit each node with rest api. */ public class BaseSimpleTest { @@ -41,7 +41,7 @@ public class BaseSimpleTest { protected static HugeClient hugeClient; @BeforeClass - public static void initEnv() throws InterruptedException { + public static void initEnv() { env = new SimpleEnv(); env.startCluster(); } @@ -60,7 +60,7 @@ protected String execCmd(String[] cmds) throws IOException { String line; while ((line = reader.readLine()) != null) { builder.append(line); - builder.append(System.getProperty("line.separator")); + builder.append(System.lineSeparator()); } p.destroy(); return builder.toString(); diff --git a/hugegraph-cluster-test/hugegraph-clustertest-test/src/main/java/org/apache/hugegraph/SimpleClusterTest/SimpleClusterDeployTest.java b/hugegraph-cluster-test/hugegraph-clustertest-test/src/main/java/org/apache/hugegraph/SimpleClusterTest/SimpleClusterDeployTest.java index 0c2385f4e2..61ef9d6ce4 100644 --- a/hugegraph-cluster-test/hugegraph-clustertest-test/src/main/java/org/apache/hugegraph/SimpleClusterTest/SimpleClusterDeployTest.java +++ b/hugegraph-cluster-test/hugegraph-clustertest-test/src/main/java/org/apache/hugegraph/SimpleClusterTest/SimpleClusterDeployTest.java @@ -40,7 +40,7 @@ public class SimpleClusterDeployTest extends BaseSimpleTest { @Test - public void testPDNodesDeployment() throws IOException { + public void testPDNodesDeployment() { try{ List addrs = env.getPDGrpcAddrs(); for (String addr : addrs) { @@ -59,6 +59,7 @@ public void testStoreNodesDeployment() throws IOException { List addrs = env.getStoreRestAddrs(); for (String addr : addrs) { String[] cmds = {"curl", addr}; + // TODO: what's the purpose of this? StringBuilder sb = new StringBuilder(); for (String cmd : cmds) { sb.append(cmd).append(" "); @@ -69,7 +70,7 @@ public void testStoreNodesDeployment() throws IOException { } @Test - public void testServerNodesDeployment() throws IOException { + public void testServerNodesDeployment() { List addrs = env.getServerRestAddrs(); for (String addr : addrs) { hugeClient = HugeClient.builder("http://" + addr, "hugegraph") From ab3d76c7c3930c36daf542ee80774ff1f4dcc0e1 Mon Sep 17 00:00:00 2001 From: HaoJin Yang <1454yhj@gmail.com> Date: Thu, 10 Oct 2024 18:06:31 +0800 Subject: [PATCH 34/40] Apply suggestions from code review Co-authored-by: V_Galaxy --- .../src/main/java/org/apache/hugegraph/ct/env/EnvFactory.java | 2 +- .../java/org/apache/hugegraph/ct/node/AbstractNodeWrapper.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/env/EnvFactory.java b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/env/EnvFactory.java index 0881194a34..8f816c20f6 100644 --- a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/env/EnvFactory.java +++ b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/env/EnvFactory.java @@ -37,7 +37,7 @@ public static BaseEnv getEnv() { env = new MultiNodeEnv(); break; default: - LOG.error("No such env type :{}", envType); + LOG.error("No such env type: {}", envType); } } return env; diff --git a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/node/AbstractNodeWrapper.java b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/node/AbstractNodeWrapper.java index 5acf42f926..6671572db1 100644 --- a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/node/AbstractNodeWrapper.java +++ b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/node/AbstractNodeWrapper.java @@ -80,7 +80,7 @@ public void createNodeDir(String destDir) { FileUtils.createParentDirectories(new File(destDir)); } } catch (NoSuchFileException fileException) { - //Ignored + // Ignored } Path sourcePath = Paths.get(CT_PACKAGE_PATH); // To avoid following symbolic links From 436c2ac45dad46b2c7f7a0b4d017fbeb3221c1cd Mon Sep 17 00:00:00 2001 From: 145425491 <1245294786@qq.com> Date: Thu, 10 Oct 2024 19:39:54 +0800 Subject: [PATCH 35/40] fix(ct): fix code style problems --- .../src/assembly/static/hugegraph.license | Bin 1499 -> 0 bytes .../src/assembly/static/{ => pd}/log4j2.xml | 0 .../{ => pd}/pd-application.yml.template | 25 +-- .../static/{ => server}/computer.yaml | 0 .../{ => server}/gremlin-driver-settings.yaml | 0 .../static/{ => server}/gremlin-server.yaml | 0 .../{ => server}/hugegraph-server.keystore | Bin .../hugegraph.properties.template | 0 .../src/assembly/static/server/log4j2.xml | 144 ++++++++++++++++++ .../static/{ => server}/remote-objects.yaml | 0 .../assembly/static/{ => server}/remote.yaml | 0 .../rest-server.properties.template | 0 .../{ => server}/scripts/empty-sample.groovy | 0 .../{ => server}/scripts/example.groovy | 0 .../src/assembly/static/store/log4j2.xml | 137 +++++++++++++++++ .../store-application.yml.template | 12 +- .../hugegraph/ct/base/ClusterConstant.java | 30 +++- .../org/apache/hugegraph/ct/base/EnvUtil.java | 2 +- .../hugegraph/ct/base/HGTestLogger.java | 8 +- .../hugegraph/ct/config/AbstractConfig.java | 2 +- .../hugegraph/ct/config/ClusterConfig.java | 2 +- .../hugegraph/ct/config/GraphConfig.java | 3 +- .../apache/hugegraph/ct/config/PDConfig.java | 10 +- .../hugegraph/ct/config/ServerConfig.java | 6 +- .../hugegraph/ct/config/StoreConfig.java | 8 +- .../apache/hugegraph/ct/env/AbstractEnv.java | 2 +- .../apache/hugegraph/ct/env/EnvFactory.java | 2 +- .../ct/node/AbstractNodeWrapper.java | 8 +- .../hugegraph/ct/node/PDNodeWrapper.java | 13 +- .../hugegraph/ct/node/ServerNodeWrapper.java | 6 +- .../hugegraph/ct/node/StoreNodeWrapper.java | 6 +- .../hugegraph-clustertest-test/pom.xml | 6 + 32 files changed, 375 insertions(+), 57 deletions(-) delete mode 100644 hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/hugegraph.license rename hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/{ => pd}/log4j2.xml (100%) rename hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/{ => pd}/pd-application.yml.template (58%) rename hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/{ => server}/computer.yaml (100%) rename hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/{ => server}/gremlin-driver-settings.yaml (100%) rename hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/{ => server}/gremlin-server.yaml (100%) rename hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/{ => server}/hugegraph-server.keystore (100%) rename hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/{ => server}/hugegraph.properties.template (100%) create mode 100644 hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/server/log4j2.xml rename hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/{ => server}/remote-objects.yaml (100%) rename hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/{ => server}/remote.yaml (100%) rename hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/{ => server}/rest-server.properties.template (100%) rename hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/{ => server}/scripts/empty-sample.groovy (100%) rename hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/{ => server}/scripts/example.groovy (100%) create mode 100644 hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/store/log4j2.xml rename hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/{ => store}/store-application.yml.template (85%) diff --git a/hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/hugegraph.license b/hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/hugegraph.license deleted file mode 100644 index 437a8ebe33666ac5b1fd10e0a598b10cc49fd5a6..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1499 zcmZ8hNl#Nz6fO;xF}4gc*+QAhBuF8QN(C*2GFoJYQjjnRmAQesHX=qZ!7-s0S|~*k|%esUl~7cr%1O1#E?o zwggFT!`!@Gw94DymN*DE;$6(lgjvsCvXeUXjB>)K}`n{Y^y( z*1J=$OD@_R1D|Sy^fmr?S_L0s0;HrtY7U-r0sn&+e0ic(co>5CPFy|V<#uNs?;#Ec7u1Gt<;g$0Vr=7xlELCD zQhEU68MD^B=5GJGFLmc|ut#0(mx?G?1C(&8c;dkP>CP-HgAM()#q(e3AG7Bi?b$gc zoF$i4b<#JDY=Gm=@nYNCxKo~u8#E-^iuiz-Q3!ClD;}!eP-L#}AE801hwv_yj#g-- zH^7d>x$~emz`hM5RL6C4WG|q!Pzv4a774s!jzm)mmjx`USDj~)y9D7-WECWzJma)+ zL!(FUq2a0}2I<0w8Ym2(%~cQ;TSkOJH!u{IxIxR9^ao=kJFPD)$>u>{I=^? zi*`m&>S{TkfbH|^D77bKUEocSeQup*cLC0P@Y2$%(ZU(-41u(OPVV*KjdvbKYFI|Z lX$Ioxu@X + + + + + logs + hugegraph-server + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/remote-objects.yaml b/hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/server/remote-objects.yaml similarity index 100% rename from hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/remote-objects.yaml rename to hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/server/remote-objects.yaml diff --git a/hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/remote.yaml b/hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/server/remote.yaml similarity index 100% rename from hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/remote.yaml rename to hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/server/remote.yaml diff --git a/hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/rest-server.properties.template b/hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/server/rest-server.properties.template similarity index 100% rename from hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/rest-server.properties.template rename to hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/server/rest-server.properties.template diff --git a/hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/scripts/empty-sample.groovy b/hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/server/scripts/empty-sample.groovy similarity index 100% rename from hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/scripts/empty-sample.groovy rename to hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/server/scripts/empty-sample.groovy diff --git a/hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/scripts/example.groovy b/hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/server/scripts/example.groovy similarity index 100% rename from hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/scripts/example.groovy rename to hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/server/scripts/example.groovy diff --git a/hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/store/log4j2.xml b/hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/store/log4j2.xml new file mode 100644 index 0000000000..388d09e2fd --- /dev/null +++ b/hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/store/log4j2.xml @@ -0,0 +1,137 @@ + + + + + + + + logs + hugegraph-store + raft-hugegraph-store + audit-hugegraph-store + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/store-application.yml.template b/hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/store/store-application.yml.template similarity index 85% rename from hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/store-application.yml.template rename to hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/store/store-application.yml.template index 871d328736..93ceb76386 100644 --- a/hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/store-application.yml.template +++ b/hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/store/store-application.yml.template @@ -16,7 +16,7 @@ # pdserver: - # pd 服务地址,多个 pd 地址用逗号分割 + # PD service address, multiple PD addresses separated by commas address: $PD_SERVER_ADDRESS$ management: @@ -30,24 +30,24 @@ management: include: "*" grpc: - # grpc 的服务地址 + # grpc service address host: 127.0.0.1 port: $GRPC_PORT$ netty-server: max-inbound-message-size: 1000MB raft: - # raft 缓存队列大小 + # raft cache queue size disruptorBufferSize: 1024 address: $RAFT_ADDRESS$ max-log-file-size: 600000000000 - # 快照生成时间间隔,单位秒 + # Snapshot generation interval, in seconds snapshotInterval: 1800 server: - # rest 服务地址 + # rest service address port: $REST_PORT$ app: - # 存储路径,支持多个路径,逗号分割 + # Storage path, support multiple paths, separated by commas data-path: ./storage #raft-path: ./storage diff --git a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/base/ClusterConstant.java b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/base/ClusterConstant.java index d467beb182..891247aadf 100644 --- a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/base/ClusterConstant.java +++ b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/base/ClusterConstant.java @@ -18,15 +18,19 @@ package org.apache.hugegraph.ct.base; import java.io.File; +import java.nio.file.Path; +import java.nio.file.Paths; import java.util.Objects; import org.apache.commons.lang3.SystemUtils; public class ClusterConstant { - public static final String USER_DIR = "user.dir"; public static final String LOG = "logs"; public static final String PROJECT_DIR = getProjectDir(); + public static final String PD = "pd"; + public static final String STORE = "store"; + public static final String SERVER = "server"; public static final String LIB_DIR = "lib"; public static final String EXT_DIR = "ext"; @@ -46,12 +50,10 @@ public class ClusterConstant { public static final String HUGEGRAPH_PROPERTIES = "graphs/hugegraph.properties"; public static final String LOG4J_FILE = "log4j2.xml"; - public static final String VERIFY_LICENSE_FILE = "verify-license.json"; public static final String LICENSE_FILE = "hugegraph.license"; public static final String PD_TEMPLATE_FILE = "pd-application.yml.template"; public static final String STORE_TEMPLATE_FILE = "store-application.yml.template"; - public static final String SERVER_TEMPLATE_FILE = "rest-server.properties.template"; public static final String GRAPH_TEMPLATE_FILE = "hugegraph.properties.template"; public static final String GREMLIN_DRIVER_SETTING_FILE = "gremlin-driver-settings.yaml"; @@ -63,6 +65,8 @@ public class ClusterConstant { public static final String EMPTY_SAMPLE_GROOVY_FILE = "scripts/empty-sample.groovy"; public static final String EXAMPLE_GROOVY_FILE = "scripts/example.groovy"; + public static final String LOCALHOST = "127.0.0.1"; + public static final String JAVA_CMD = System.getProperty("java.home") + File.separator + BIN_DIR + File.separator + (SystemUtils.IS_OS_WINDOWS ? "java.exe" : "java"); @@ -92,6 +96,12 @@ public class ClusterConstant { public static final String CT_PACKAGE_PATH = getFileInDir(CT_DIST_PATH, CT_PACKAGE_PREFIX) + File.separator; + public static final String PD_TEMPLATE_PATH = CT_PACKAGE_PATH + PD + File.separator; + + public static final String STORE_TEMPLATE_PATH = CT_PACKAGE_PATH + STORE + File.separator; + + public static final String SERVER_TEMPLATE_PATH = CT_PACKAGE_PATH + SERVER + File.separator; + private ClusterConstant() { throw new IllegalStateException("Utility class"); } @@ -123,11 +133,15 @@ public static boolean isJava11OrHigher() { } public static String getProjectDir() { - if (System.getProperty(USER_DIR).endsWith("hugegraph-cluster-test")) { - return System.getProperty(USER_DIR) + "/.."; - } else if (System.getProperty(USER_DIR).endsWith("hugegraph-clustertest-test")) { - return System.getProperty(USER_DIR) + "/../.."; + String userDir = System.getProperty("user.dir"); // 获取当前工作目录 + Path path = Paths.get(userDir); // 将路径字符串转换为 Path 对象 + + if (userDir.endsWith("hugegraph-cluster-test")) { + return path.getParent().toString(); // 返回上一级目录 + } else if (userDir.endsWith("hugegraph-clustertest-test")) { + return path.getParent().getParent().toString(); // 返回上两级目录 } - return System.getProperty(USER_DIR); + + return userDir; // 如果不匹配则返回当前目录 } } diff --git a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/base/EnvUtil.java b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/base/EnvUtil.java index cc3318f6dc..4d4bab3831 100644 --- a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/base/EnvUtil.java +++ b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/base/EnvUtil.java @@ -29,7 +29,7 @@ public class EnvUtil { - private static final Logger LOG = HGTestLogger.UtilLOG; + private static final Logger LOG = HGTestLogger.UTIL_LOG; private static final Set ports = new HashSet<>(); public static int getAvailablePort() { diff --git a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/base/HGTestLogger.java b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/base/HGTestLogger.java index 8e05614b50..ceef1e40b3 100644 --- a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/base/HGTestLogger.java +++ b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/base/HGTestLogger.java @@ -25,8 +25,8 @@ @Slf4j public class HGTestLogger { - public static Logger UtilLOG = LoggerFactory.getLogger(HGTestLogger.class); - public static Logger EnvLOG = LoggerFactory.getLogger(HGTestLogger.class); - public static Logger ConfigLOG = LoggerFactory.getLogger(HGTestLogger.class); - public static Logger NodeLOG = LoggerFactory.getLogger(HGTestLogger.class); + public static Logger UTIL_LOG = LoggerFactory.getLogger(HGTestLogger.class); + public static Logger ENV_LOG = LoggerFactory.getLogger(HGTestLogger.class); + public static Logger CONFIG_LOG = LoggerFactory.getLogger(HGTestLogger.class); + public static Logger NODE_LOG = LoggerFactory.getLogger(HGTestLogger.class); } diff --git a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/config/AbstractConfig.java b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/config/AbstractConfig.java index 58c33ce4ac..36a7240d2f 100644 --- a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/config/AbstractConfig.java +++ b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/config/AbstractConfig.java @@ -31,7 +31,7 @@ public abstract class AbstractConfig { - protected static final Logger LOG = HGTestLogger.ConfigLOG; + protected static final Logger LOG = HGTestLogger.CONFIG_LOG; protected String config; protected Map properties = new HashMap<>(); protected String fileName; diff --git a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/config/ClusterConfig.java b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/config/ClusterConfig.java index 22de4e4124..c71e4b07e1 100644 --- a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/config/ClusterConfig.java +++ b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/config/ClusterConfig.java @@ -25,7 +25,7 @@ public class ClusterConfig { - protected static final Logger LOG = HGTestLogger.ConfigLOG; + protected static final Logger LOG = HGTestLogger.CONFIG_LOG; protected List pdConfigs; protected List storeConfigs; protected List serverConfigs; diff --git a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/config/GraphConfig.java b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/config/GraphConfig.java index 97739fba8f..2666ec2b59 100644 --- a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/config/GraphConfig.java +++ b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/config/GraphConfig.java @@ -20,6 +20,7 @@ import static org.apache.hugegraph.ct.base.ClusterConstant.CT_PACKAGE_PATH; import static org.apache.hugegraph.ct.base.ClusterConstant.GRAPH_TEMPLATE_FILE; import static org.apache.hugegraph.ct.base.ClusterConstant.HUGEGRAPH_PROPERTIES; +import static org.apache.hugegraph.ct.base.ClusterConstant.SERVER_TEMPLATE_PATH; import java.nio.file.Paths; import java.util.List; @@ -27,7 +28,7 @@ public class GraphConfig extends AbstractConfig { public GraphConfig() { - readTemplate(Paths.get(CT_PACKAGE_PATH + GRAPH_TEMPLATE_FILE)); + readTemplate(Paths.get(SERVER_TEMPLATE_PATH + GRAPH_TEMPLATE_FILE)); this.fileName = HUGEGRAPH_PROPERTIES; } diff --git a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/config/PDConfig.java b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/config/PDConfig.java index e8ce378343..b9b4495511 100644 --- a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/config/PDConfig.java +++ b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/config/PDConfig.java @@ -19,7 +19,9 @@ import static org.apache.hugegraph.ct.base.ClusterConstant.APPLICATION_FILE; import static org.apache.hugegraph.ct.base.ClusterConstant.CT_PACKAGE_PATH; +import static org.apache.hugegraph.ct.base.ClusterConstant.LOCALHOST; import static org.apache.hugegraph.ct.base.ClusterConstant.PD_TEMPLATE_FILE; +import static org.apache.hugegraph.ct.base.ClusterConstant.PD_TEMPLATE_PATH; import static org.apache.hugegraph.ct.base.EnvUtil.getAvailablePort; import java.nio.file.Paths; @@ -35,14 +37,14 @@ public class PDConfig extends AbstractConfig { private final int restPort; public PDConfig() { - readTemplate(Paths.get(CT_PACKAGE_PATH + PD_TEMPLATE_FILE)); + readTemplate(Paths.get(PD_TEMPLATE_PATH + PD_TEMPLATE_FILE)); this.fileName = APPLICATION_FILE; this.raftPort = getAvailablePort(); this.grpcPort = getAvailablePort(); this.restPort = getAvailablePort(); properties.put("GRPC_PORT", String.valueOf(this.grpcPort)); properties.put("REST_PORT", String.valueOf(this.restPort)); - properties.put("RAFT_ADDRESS", "127.0.0.1:" + this.raftPort); + properties.put("RAFT_ADDRESS", LOCALHOST + ":" + this.raftPort); } public void setRaftPeerList(List raftPeerList) { @@ -60,10 +62,10 @@ public void setStoreGrpcList(List storeGrpcList) { } public String getRaftAddress() { - return "127.0.0.1:" + this.raftPort; + return LOCALHOST + ":" + this.raftPort; } public String getGrpcAddress() { - return "127.0.0.1:" + this.grpcPort; + return LOCALHOST + ":" + this.grpcPort; } } diff --git a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/config/ServerConfig.java b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/config/ServerConfig.java index dac97329c4..8edb79ea76 100644 --- a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/config/ServerConfig.java +++ b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/config/ServerConfig.java @@ -18,8 +18,10 @@ package org.apache.hugegraph.ct.config; import static org.apache.hugegraph.ct.base.ClusterConstant.CT_PACKAGE_PATH; +import static org.apache.hugegraph.ct.base.ClusterConstant.LOCALHOST; import static org.apache.hugegraph.ct.base.ClusterConstant.SERVER_PROPERTIES; import static org.apache.hugegraph.ct.base.ClusterConstant.SERVER_TEMPLATE_FILE; +import static org.apache.hugegraph.ct.base.ClusterConstant.SERVER_TEMPLATE_PATH; import static org.apache.hugegraph.ct.base.EnvUtil.getAvailablePort; import java.nio.file.Paths; @@ -33,11 +35,11 @@ public class ServerConfig extends AbstractConfig { private final int restPort; public ServerConfig() { - readTemplate(Paths.get(CT_PACKAGE_PATH + SERVER_TEMPLATE_FILE)); + readTemplate(Paths.get(SERVER_TEMPLATE_PATH + SERVER_TEMPLATE_FILE)); this.fileName = SERVER_PROPERTIES; this.rpcPort = getAvailablePort(); this.restPort = getAvailablePort(); - properties.put("REST_SERVER_ADDRESS", "127.0.0.1:" + this.restPort); + properties.put("REST_SERVER_ADDRESS", LOCALHOST + ":" + this.restPort); properties.put("RPC_PORT", String.valueOf(this.rpcPort)); } diff --git a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/config/StoreConfig.java b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/config/StoreConfig.java index 0ecb3f7a38..58ff98a01f 100644 --- a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/config/StoreConfig.java +++ b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/config/StoreConfig.java @@ -19,7 +19,9 @@ import static org.apache.hugegraph.ct.base.ClusterConstant.APPLICATION_FILE; import static org.apache.hugegraph.ct.base.ClusterConstant.CT_PACKAGE_PATH; +import static org.apache.hugegraph.ct.base.ClusterConstant.LOCALHOST; import static org.apache.hugegraph.ct.base.ClusterConstant.STORE_TEMPLATE_FILE; +import static org.apache.hugegraph.ct.base.ClusterConstant.STORE_TEMPLATE_PATH; import static org.apache.hugegraph.ct.base.EnvUtil.getAvailablePort; import java.nio.file.Paths; @@ -36,14 +38,14 @@ public class StoreConfig extends AbstractConfig { public StoreConfig() { readTemplate( - Paths.get(CT_PACKAGE_PATH + STORE_TEMPLATE_FILE)); + Paths.get(STORE_TEMPLATE_PATH + STORE_TEMPLATE_FILE)); this.fileName = APPLICATION_FILE; this.raftPort = getAvailablePort(); this.grpcPort = getAvailablePort(); this.restPort = getAvailablePort(); properties.put("GRPC_PORT", String.valueOf(this.grpcPort)); properties.put("REST_PORT", String.valueOf(this.restPort)); - properties.put("RAFT_ADDRESS", "127.0.0.1:" + this.raftPort); + properties.put("RAFT_ADDRESS", LOCALHOST + ":" + this.raftPort); } public void setPDServerList(List pdServerList) { @@ -52,6 +54,6 @@ public void setPDServerList(List pdServerList) { } public String getGrpcAddress() { - return "127.0.0.1:" + this.grpcPort; + return LOCALHOST + ":" + this.grpcPort; } } diff --git a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/env/AbstractEnv.java b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/env/AbstractEnv.java index 5c1da21d3d..0c24860929 100644 --- a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/env/AbstractEnv.java +++ b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/env/AbstractEnv.java @@ -39,7 +39,7 @@ @Slf4j public abstract class AbstractEnv implements BaseEnv { - private static final Logger LOG = HGTestLogger.EnvLOG; + private static final Logger LOG = HGTestLogger.ENV_LOG; protected ClusterConfig clusterConfig; protected List pdNodeWrappers; diff --git a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/env/EnvFactory.java b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/env/EnvFactory.java index 8f816c20f6..a716697c5a 100644 --- a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/env/EnvFactory.java +++ b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/env/EnvFactory.java @@ -23,7 +23,7 @@ public class EnvFactory { - private static final Logger LOG = HGTestLogger.EnvLOG; + private static final Logger LOG = HGTestLogger.ENV_LOG; private static BaseEnv env; public static BaseEnv getEnv() { diff --git a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/node/AbstractNodeWrapper.java b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/node/AbstractNodeWrapper.java index 6671572db1..8236bb1392 100644 --- a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/node/AbstractNodeWrapper.java +++ b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/node/AbstractNodeWrapper.java @@ -45,7 +45,7 @@ public abstract class AbstractNodeWrapper implements BaseNodeWrapper { - protected final Logger LOG = HGTestLogger.NodeLOG; + protected final Logger LOG = HGTestLogger.NODE_LOG; protected int clusterIndex; @Getter @@ -73,7 +73,7 @@ public AbstractNodeWrapper(int clusterIndex, int index) { /** * Node Dir should be created before changing Config */ - public void createNodeDir(String destDir) { + public void createNodeDir(Path sourcePath, String destDir) { try { try { if (!new File(destDir).exists()) { @@ -82,7 +82,6 @@ public void createNodeDir(String destDir) { } catch (NoSuchFileException fileException) { // Ignored } - Path sourcePath = Paths.get(CT_PACKAGE_PATH); // To avoid following symbolic links try (Stream stream = Files.walk(sourcePath)) { stream.forEach(source -> { @@ -180,7 +179,8 @@ public boolean isAlive() { protected ProcessBuilder runCmd(List startCmd, File stdoutFile) throws IOException { FileUtils.write(stdoutFile, - String.join(" ", startCmd) + "\n\n", StandardCharsets.UTF_8, true); + String.join(" ", startCmd) + System.lineSeparator() + System.lineSeparator(), + StandardCharsets.UTF_8, true); ProcessBuilder processBuilder = new ProcessBuilder(startCmd) .redirectOutput(ProcessBuilder.Redirect.appendTo(stdoutFile)) .redirectError(ProcessBuilder.Redirect.appendTo(stdoutFile)); diff --git a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/node/PDNodeWrapper.java b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/node/PDNodeWrapper.java index 27386827d3..b6cfca6096 100644 --- a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/node/PDNodeWrapper.java +++ b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/node/PDNodeWrapper.java @@ -23,11 +23,13 @@ import static org.apache.hugegraph.ct.base.ClusterConstant.LOG4J_FILE; import static org.apache.hugegraph.ct.base.ClusterConstant.PD_JAR_PREFIX; import static org.apache.hugegraph.ct.base.ClusterConstant.PD_LIB_PATH; +import static org.apache.hugegraph.ct.base.ClusterConstant.PD_TEMPLATE_PATH; import static org.apache.hugegraph.ct.base.ClusterConstant.getFileInDir; import static org.apache.hugegraph.ct.base.ClusterConstant.isJava11OrHigher; import java.io.File; import java.io.IOException; +import java.nio.file.Paths; import java.util.ArrayList; import java.util.Arrays; import java.util.List; @@ -36,19 +38,19 @@ public class PDNodeWrapper extends AbstractNodeWrapper { public PDNodeWrapper() { super(); - fileNames = new ArrayList<>(Arrays.asList(LOG4J_FILE, LICENSE_FILE)); + fileNames = new ArrayList<>(Arrays.asList(LOG4J_FILE)); this.workPath = PD_LIB_PATH; this.startLine = "Hugegraph-pd started."; - createNodeDir(getNodePath() + CONF_DIR + File.separator); + createNodeDir(Paths.get(PD_TEMPLATE_PATH), getNodePath() + CONF_DIR + File.separator); createLogDir(); } public PDNodeWrapper(int clusterIndex, int index) { super(clusterIndex, index); - this.fileNames = new ArrayList<>(Arrays.asList(LOG4J_FILE, LICENSE_FILE)); + this.fileNames = new ArrayList<>(Arrays.asList(LOG4J_FILE)); this.workPath = PD_LIB_PATH; this.startLine = "Hugegraph-pd started."; - createNodeDir(getNodePath() + CONF_DIR + File.separator); + createNodeDir(Paths.get(PD_TEMPLATE_PATH), getNodePath() + CONF_DIR + File.separator); createLogDir(); } @@ -74,8 +76,7 @@ public void start() { "-XX:+HeapDumpOnOutOfMemoryError", "-XX:HeapDumpPath=" + configPath + "logs", "-Dlog4j.configurationFile=" + configPath + File.separator + - CONF_DIR + - File.separator + "log4j2.xml", + CONF_DIR + File.separator + "log4j2.xml", "-Dspring.config.location=" + configPath + CONF_DIR + File.separator + "application.yml", "-jar", pdNodeJarPath)); diff --git a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/node/ServerNodeWrapper.java b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/node/ServerNodeWrapper.java index 994bd734d8..16eff633fb 100644 --- a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/node/ServerNodeWrapper.java +++ b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/node/ServerNodeWrapper.java @@ -32,10 +32,12 @@ import static org.apache.hugegraph.ct.base.ClusterConstant.REMOTE_OBJECTS_SETTING_FILE; import static org.apache.hugegraph.ct.base.ClusterConstant.REMOTE_SETTING_FILE; import static org.apache.hugegraph.ct.base.ClusterConstant.SERVER_LIB_PATH; +import static org.apache.hugegraph.ct.base.ClusterConstant.SERVER_TEMPLATE_PATH; import static org.apache.hugegraph.ct.base.ClusterConstant.isJava11OrHigher; import java.io.File; import java.io.IOException; +import java.nio.file.Paths; import java.util.ArrayList; import java.util.Arrays; import java.util.List; @@ -49,10 +51,10 @@ public ServerNodeWrapper(int clusterIndex, int index) { GREMLIN_DRIVER_SETTING_FILE, REMOTE_SETTING_FILE, REMOTE_OBJECTS_SETTING_FILE)); this.workPath = SERVER_LIB_PATH; - createNodeDir(getNodePath() + CONF_DIR + File.separator); + createNodeDir(Paths.get(SERVER_TEMPLATE_PATH), getNodePath() + CONF_DIR + File.separator); this.fileNames = new ArrayList<>(List.of(EMPTY_SAMPLE_GROOVY_FILE, EXAMPLE_GROOVY_FILE)); this.startLine = "INFO: [HttpServer] Started."; - createNodeDir(getNodePath()); + createNodeDir(Paths.get(SERVER_TEMPLATE_PATH), getNodePath()); createLogDir(); } diff --git a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/node/StoreNodeWrapper.java b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/node/StoreNodeWrapper.java index a83bfa5aa8..1cb0f67eae 100644 --- a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/node/StoreNodeWrapper.java +++ b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/node/StoreNodeWrapper.java @@ -22,11 +22,13 @@ import static org.apache.hugegraph.ct.base.ClusterConstant.LOG4J_FILE; import static org.apache.hugegraph.ct.base.ClusterConstant.STORE_JAR_PREFIX; import static org.apache.hugegraph.ct.base.ClusterConstant.STORE_LIB_PATH; +import static org.apache.hugegraph.ct.base.ClusterConstant.STORE_TEMPLATE_PATH; import static org.apache.hugegraph.ct.base.ClusterConstant.getFileInDir; import static org.apache.hugegraph.ct.base.ClusterConstant.isJava11OrHigher; import java.io.File; import java.io.IOException; +import java.nio.file.Paths; import java.util.ArrayList; import java.util.Arrays; import java.util.List; @@ -38,7 +40,7 @@ public StoreNodeWrapper() { this.fileNames = new ArrayList<>(List.of(LOG4J_FILE)); this.workPath = STORE_LIB_PATH; this.startLine = "o.a.h.s.n.StoreNodeApplication - Starting StoreNodeApplication"; - createNodeDir(getNodePath() + CONF_DIR + File.separator); + createNodeDir(Paths.get(STORE_TEMPLATE_PATH), getNodePath() + CONF_DIR + File.separator); createLogDir(); } @@ -47,7 +49,7 @@ public StoreNodeWrapper(int clusterId, int index) { this.fileNames = new ArrayList<>(List.of(LOG4J_FILE)); this.workPath = STORE_LIB_PATH; this.startLine = "o.a.h.s.n.StoreNodeApplication - Starting StoreNodeApplication"; - createNodeDir(getNodePath() + CONF_DIR + File.separator); + createNodeDir(Paths.get(STORE_TEMPLATE_PATH), getNodePath() + CONF_DIR + File.separator); createLogDir(); } diff --git a/hugegraph-cluster-test/hugegraph-clustertest-test/pom.xml b/hugegraph-cluster-test/hugegraph-clustertest-test/pom.xml index b04ff52f85..e5e679ba62 100644 --- a/hugegraph-cluster-test/hugegraph-clustertest-test/pom.xml +++ b/hugegraph-cluster-test/hugegraph-clustertest-test/pom.xml @@ -50,6 +50,12 @@ hg-pd-client ${revision} + + junit + junit + 4.13.2 + compile + From 2896c07115a761602f1740fd1870a488dba27da9 Mon Sep 17 00:00:00 2001 From: 145425491 <1245294786@qq.com> Date: Sun, 13 Oct 2024 20:13:30 +0800 Subject: [PATCH 36/40] fix(ct): update hg-client version --- .github/workflows/cluster-test-ci.yml | 2 +- hugegraph-cluster-test/hugegraph-clustertest-test/pom.xml | 1 + pom.xml | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cluster-test-ci.yml b/.github/workflows/cluster-test-ci.yml index ec1c11a659..7abebc7224 100644 --- a/.github/workflows/cluster-test-ci.yml +++ b/.github/workflows/cluster-test-ci.yml @@ -12,7 +12,7 @@ jobs: cluster-test: runs-on: ubuntu-latest env: - USE_STAGE: 'false' # Whether to include the stage repository. + USE_STAGE: 'true' # Whether to include the stage repository. steps: - name: Install JDK 11 diff --git a/hugegraph-cluster-test/hugegraph-clustertest-test/pom.xml b/hugegraph-cluster-test/hugegraph-clustertest-test/pom.xml index e5e679ba62..c888404545 100644 --- a/hugegraph-cluster-test/hugegraph-clustertest-test/pom.xml +++ b/hugegraph-cluster-test/hugegraph-clustertest-test/pom.xml @@ -40,6 +40,7 @@ ${revision} compile + org.apache.hugegraph hugegraph-client diff --git a/pom.xml b/pom.xml index f24b611ae2..1fa07660ee 100644 --- a/pom.xml +++ b/pom.xml @@ -94,7 +94,7 @@ 11 UTF-8 bash - 1.3.0 + 1.5.0 From 584c79b35408fd2ca19c31256fe19e5922d5c0d4 Mon Sep 17 00:00:00 2001 From: 145425491 <1245294786@qq.com> Date: Mon, 14 Oct 2024 18:19:08 +0800 Subject: [PATCH 37/40] fix(ct): simplify the dist --- .../src/assembly/static/server/computer.yaml | 39 -------- .../static/server/hugegraph-server.keystore | Bin 1733 -> 0 bytes .../static/server/scripts/empty-sample.groovy | 33 ------- .../static/server/scripts/example.groovy | 67 -------------- .../hugegraph/ct/base/ClusterConstant.java | 84 ++++++++---------- .../hugegraph/ct/config/GraphConfig.java | 5 +- .../apache/hugegraph/ct/config/PDConfig.java | 5 +- .../hugegraph/ct/config/ServerConfig.java | 5 +- .../hugegraph/ct/config/StoreConfig.java | 6 +- .../hugegraph/ct/node/PDNodeWrapper.java | 1 - .../hugegraph/ct/node/ServerNodeWrapper.java | 7 +- hugegraph-pd/hg-pd-common/pom.xml | 6 ++ 12 files changed, 53 insertions(+), 205 deletions(-) delete mode 100644 hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/server/computer.yaml delete mode 100644 hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/server/hugegraph-server.keystore delete mode 100644 hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/server/scripts/empty-sample.groovy delete mode 100644 hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/server/scripts/example.groovy diff --git a/hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/server/computer.yaml b/hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/server/computer.yaml deleted file mode 100644 index 1c69388bb0..0000000000 --- a/hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/server/computer.yaml +++ /dev/null @@ -1,39 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# common parameters -common: { - worker_heap: 10000, - vertex_input_dir: /data, - workers: 51, - zookeeper_list: "127.0.0.1:2181", - max_edges_per_segment: 10485760, - edges_immutable: true, - partitions: 255, - compute_threads: 5, - input_threads: 5, - message_async: false, - message_queue_size: 1000, - message_send_threads: 10, - messages_per_segment: 104857600, - hugegraph_url: "http://127.0.0.1:8080", - hugegraph_name: hugegraph, - hugegraph_timeout: 60 -} - -env: { - computer_home: /home/computer -} diff --git a/hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/server/hugegraph-server.keystore b/hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/server/hugegraph-server.keystore deleted file mode 100644 index e60c6b4c4ca066e165da3d5d880d1d780fb976fa..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1733 zcmY+Ddpy$%AIG=fE(|Ga?rAuU*g9>lOK50Vh`IC}mng;DNp@z;ZSGOxoCwvnE-uGq zDvFJhdlwG}L!yr6l3Oi0E~QnE=XpKPdCvLc^ZLGCpU?OE`Rn_}v*8^87=mZR6W|EL zEXSD}sBL@KwiMv<|GiR>0|Q((a39YG_;>@j z-2d$Da!n}8dwGrI^Jeazr<}U>@X`FvaOUzL00DKmLD@j6-U}=!sw|0~-#YB(_U&lC z;2bWbKk3MH1SjB*xD{hl9zVztK2i@k`6_a{AsjrB_*RV-5p=s7em>x9dHui`?TStC zew}Gp>C>!?6P|Te@;$LGQQ@!!h8+yzSu0*0XVnWI?$fJP2^-eKF0Cx!V*U^-{v7&A zZA)dtgq1S4RU$X4xG}fPdshqkuFQ-5jQQqNzPxSM^!`N$P^S0`-_ zX(=iHHj(PsxSFVEf0maY!V~9bRul*qF&EgQVYVAJ2g33ytqjMa`v#g3W)e>XCt&8$ z9If&8^~q8hYo?*IcbyxxCP?xwDcKHGKu(6Dd-o;A^ri$)$$tD$r(Ao8=wH@58K(W_ z@_}~?6j58xVHV?g_CpdfR*5+Z$=PkI3-MhCL^TIVk3N15Er{zpuTJWsGzsHJ%Fru! z{o15CkKJtFt}OfYy)IMcnF?&wDVLp&W7H<-_kf#+s5fv6V^)xZ{ZCw1m}vp)HD)J$SzCL@+;WnBb& zyw0C5jzAGmdy$|J5FJDV1#K%9bQ%-`3i<1bG64ledWJ>@X%o!wrg)+m{*VdL%zT>% zlRtZ8;9NEYvu)`BV9@r^_b3!Eq#=y}Xp}6cncLNk)#myqh|?Uf zu#q_2Km9KKA=C@ZP+&<}b1Iu^JHhUU?UR|!$f-I^6W-~x5qUwla8u_tX*$ZoHT<&b3|1oa%&cIWheq1!vp7}vo&|KS@csHK&>Ce4GlhAG-Q1r zmnF8Bp{++bw3liV*ab;^waVWNQ;cbFZ9VA1Y)=RD7Lm^7r6NZm?O5cBk_7eT9(@ z#V+49ncJ&NBfmTO%vM3)>L&@ogFTk>U}`zLNH-nz>fD=Q|AZrYr&Ek8yxr5%1lJq$ zuMC8=D>7uEsuqvT5>#cyV1BMNg~w2vHB1buzv1(+;CD=JxXaDf`~hox#GZLq(_uo9 zrPofrOMz?k<-#fe_p&8jfMHP2SZt({*B$Grc^_|u%?x?dy@TIK@fTrtVsZ%qKVGz? zJ(&Vd#8Db?$uzt1l<{UG^LdhGlfFhen!o3hw%YK(kA|3QKO|X^MHcRGJK?XP)O(z- z^uo_Ssjc@571 diff --git a/hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/server/scripts/empty-sample.groovy b/hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/server/scripts/empty-sample.groovy deleted file mode 100644 index 85e3669dc6..0000000000 --- a/hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/server/scripts/empty-sample.groovy +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import org.apache.tinkerpop.gremlin.server.util.LifeCycleHook - -// an init script that returns a Map allows explicit setting of global bindings. -def globals = [:] - -// defines a sample LifeCycleHook that prints some output to the Gremlin Server console. -// note that the name of the key in the "global" map is unimportant. -globals << [hook: [ - onStartUp : { ctx -> - ctx.logger.info("Executed once at startup of Gremlin Server.") - }, - onShutDown: { ctx -> - ctx.logger.info("Executed once at shutdown of Gremlin Server.") - } -] as LifeCycleHook] - -// define the default TraversalSource to bind queries to - this one will be named "g". diff --git a/hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/server/scripts/example.groovy b/hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/server/scripts/example.groovy deleted file mode 100644 index 266206845b..0000000000 --- a/hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/server/scripts/example.groovy +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import org.apache.hugegraph.HugeFactory -import org.apache.hugegraph.dist.RegisterUtil -import org.apache.hugegraph.masterelection.GlobalMasterInfo -import org.apache.tinkerpop.gremlin.structure.T - -RegisterUtil.registerBackends() - -conf = "conf/graphs/hugegraph.properties" -graph = HugeFactory.open(conf) -graph.serverStarted(GlobalMasterInfo.master("server-tinkerpop")) -schema = graph.schema() - -schema.propertyKey("name").asText().ifNotExist().create() -schema.propertyKey("age").asInt().ifNotExist().create() -schema.propertyKey("city").asText().ifNotExist().create() -schema.propertyKey("weight").asDouble().ifNotExist().create() -schema.propertyKey("lang").asText().ifNotExist().create() -schema.propertyKey("date").asText().ifNotExist().create() -schema.propertyKey("price").asInt().ifNotExist().create() - -schema.vertexLabel("person").properties("name", "age", "city").primaryKeys("name").ifNotExist().create() -schema.vertexLabel("software").properties("name", "lang", "price").primaryKeys("name").ifNotExist().create() -schema.indexLabel("personByCity").onV("person").by("city").secondary().ifNotExist().create() -schema.indexLabel("personByAgeAndCity").onV("person").by("age", "city").secondary().ifNotExist().create() -schema.indexLabel("softwareByPrice").onV("software").by("price").range().ifNotExist().create() -schema.edgeLabel("knows").sourceLabel("person").targetLabel("person").properties("date", "weight").ifNotExist().create() -schema.edgeLabel("created").sourceLabel("person").targetLabel("software").properties("date", "weight").ifNotExist().create() -schema.indexLabel("createdByDate").onE("created").by("date").secondary().ifNotExist().create() -schema.indexLabel("createdByWeight").onE("created").by("weight").range().ifNotExist().create() -schema.indexLabel("knowsByWeight").onE("knows").by("weight").range().ifNotExist().create() - -marko = graph.addVertex(T.label, "person", "name", "marko", "age", 29, "city", "Beijing") -vadas = graph.addVertex(T.label, "person", "name", "vadas", "age", 27, "city", "Hongkong") -lop = graph.addVertex(T.label, "software", "name", "lop", "lang", "java", "price", 328) -josh = graph.addVertex(T.label, "person", "name", "josh", "age", 32, "city", "Beijing") -ripple = graph.addVertex(T.label, "software", "name", "ripple", "lang", "java", "price", 199) -peter = graph.addVertex(T.label, "person", "name", "peter", "age", 35, "city", "Shanghai") - -marko.addEdge("knows", vadas, "date", "20160110", "weight", 0.5) -marko.addEdge("knows", josh, "date", "20130220", "weight", 1.0) -marko.addEdge("created", lop, "date", "20171210", "weight", 0.4) -josh.addEdge("created", lop, "date", "20091111", "weight", 0.4) -josh.addEdge("created", ripple, "date", "20171210", "weight", 1.0) -peter.addEdge("created", lop, "date", "20170324", "weight", 0.2) - -graph.tx().commit() - -g = graph.traversal() - -System.out.println(">>>> query all vertices: size=" + g.V().toList().size()) -System.out.println(">>>> query all edges: size=" + g.E().toList().size()) diff --git a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/base/ClusterConstant.java b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/base/ClusterConstant.java index 891247aadf..2caa5a6a2a 100644 --- a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/base/ClusterConstant.java +++ b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/base/ClusterConstant.java @@ -31,76 +31,66 @@ public class ClusterConstant { public static final String PD = "pd"; public static final String STORE = "store"; public static final String SERVER = "server"; - public static final String LIB_DIR = "lib"; public static final String EXT_DIR = "ext"; public static final String PLUGINS_DIR = "plugins"; public static final String BIN_DIR = "bin"; public static final String CONF_DIR = "conf"; - public static final String PD_PACKAGE_PREFIX = "apache-hugegraph-pd-incubating"; public static final String PD_JAR_PREFIX = "hg-pd-service"; public static final String STORE_PACKAGE_PREFIX = "apache-hugegraph-store-incubating"; public static final String STORE_JAR_PREFIX = "hg-store-node"; public static final String SERVER_PACKAGE_PREFIX = "apache-hugegraph-server-incubating"; public static final String CT_PACKAGE_PREFIX = "apache-hugegraph-ct-incubating"; - public static final String APPLICATION_FILE = "application.yml"; public static final String SERVER_PROPERTIES = "rest-server.properties"; public static final String HUGEGRAPH_PROPERTIES = "graphs/hugegraph.properties"; - public static final String LOG4J_FILE = "log4j2.xml"; - public static final String LICENSE_FILE = "hugegraph.license"; public static final String PD_TEMPLATE_FILE = "pd-application.yml.template"; - public static final String STORE_TEMPLATE_FILE = "store-application.yml.template"; public static final String SERVER_TEMPLATE_FILE = "rest-server.properties.template"; public static final String GRAPH_TEMPLATE_FILE = "hugegraph.properties.template"; public static final String GREMLIN_DRIVER_SETTING_FILE = "gremlin-driver-settings.yaml"; public static final String GREMLIN_SERVER_FILE = "gremlin-server.yaml"; public static final String COMPUTER_SETTING_FILE = "computer.yaml"; - public static final String HUGEGRAPH_SERVER_KEYSTORE = "hugegraph-server.keystore"; public static final String REMOTE_SETTING_FILE = "remote.yaml"; public static final String REMOTE_OBJECTS_SETTING_FILE = "remote-objects.yaml"; public static final String EMPTY_SAMPLE_GROOVY_FILE = "scripts/empty-sample.groovy"; public static final String EXAMPLE_GROOVY_FILE = "scripts/example.groovy"; - public static final String LOCALHOST = "127.0.0.1"; - public static final String JAVA_CMD = System.getProperty("java.home") + - File.separator + BIN_DIR + File.separator + - (SystemUtils.IS_OS_WINDOWS ? "java.exe" : "java"); - - public static final String PD_DIST_PATH = PROJECT_DIR + File.separator + - "hugegraph-pd" + File.separator; - - public static final String PD_LIB_PATH = getFileInDir(PD_DIST_PATH, PD_PACKAGE_PREFIX) + - File.separator + LIB_DIR + File.separator; - - public static final String STORE_DIST_PATH = PROJECT_DIR + File.separator + "hugegraph-store" + - File.separator; - - public static final String STORE_LIB_PATH = getFileInDir(STORE_DIST_PATH, STORE_PACKAGE_PREFIX) - + File.separator + LIB_DIR + File.separator; - - public static final String SERVER_DIST_PATH = PROJECT_DIR + File.separator + - "hugegraph-server" + File.separator; - - public static final String SERVER_LIB_PATH = getFileInDir(SERVER_DIST_PATH, - SERVER_PACKAGE_PREFIX) + - File.separator; - - public static final String CT_DIST_PATH = PROJECT_DIR + File.separator + - "hugegraph-cluster-test" + File.separator; - - public static final String CT_PACKAGE_PATH = getFileInDir(CT_DIST_PATH, CT_PACKAGE_PREFIX) + - File.separator; - - public static final String PD_TEMPLATE_PATH = CT_PACKAGE_PATH + PD + File.separator; - - public static final String STORE_TEMPLATE_PATH = CT_PACKAGE_PATH + STORE + File.separator; - - public static final String SERVER_TEMPLATE_PATH = CT_PACKAGE_PATH + SERVER + File.separator; + public static final String JAVA_CMD = + System.getProperty("java.home") + File.separator + BIN_DIR + File.separator + + (SystemUtils.IS_OS_WINDOWS ? "java.exe" : "java"); + public static final String PD_DIST_PATH = + PROJECT_DIR + File.separator + "hugegraph-pd" + File.separator; + public static final String PD_LIB_PATH = + getFileInDir(PD_DIST_PATH, PD_PACKAGE_PREFIX) + File.separator + LIB_DIR + + File.separator; + public static final String PD_TEMPLATE_PATH = + getFileInDir(PD_DIST_PATH, PD_PACKAGE_PREFIX) + File.separator + CONF_DIR + + File.separator; + public static final String STORE_DIST_PATH = + PROJECT_DIR + File.separator + "hugegraph-store" + File.separator; + public static final String STORE_LIB_PATH = + getFileInDir(STORE_DIST_PATH, STORE_PACKAGE_PREFIX) + File.separator + LIB_DIR + + File.separator; + public static final String STORE_TEMPLATE_PATH = + getFileInDir(STORE_DIST_PATH, STORE_PACKAGE_PREFIX) + File.separator + CONF_DIR + + File.separator; + public static final String SERVER_DIST_PATH = + PROJECT_DIR + File.separator + "hugegraph-server" + File.separator; + public static final String SERVER_LIB_PATH = + getFileInDir(SERVER_DIST_PATH, SERVER_PACKAGE_PREFIX) + + File.separator; + public static final String SERVER_TEMPLATE_PATH = + getFileInDir(SERVER_DIST_PATH, SERVER_PACKAGE_PREFIX) + + File.separator + CONF_DIR + File.separator; + public static final String CT_DIST_PATH = + PROJECT_DIR + File.separator + "hugegraph-cluster-test" + File.separator; + public static final String CT_PACKAGE_PATH = + getFileInDir(CT_DIST_PATH, CT_PACKAGE_PREFIX) + File.separator; + public static final String CONFIG_FILE_PATH = CT_PACKAGE_PATH + CONF_DIR + File.separator; private ClusterConstant() { throw new IllegalStateException("Utility class"); @@ -133,15 +123,15 @@ public static boolean isJava11OrHigher() { } public static String getProjectDir() { - String userDir = System.getProperty("user.dir"); // 获取当前工作目录 - Path path = Paths.get(userDir); // 将路径字符串转换为 Path 对象 + String userDir = System.getProperty("user.dir"); // get current dir + Path path = Paths.get(userDir); if (userDir.endsWith("hugegraph-cluster-test")) { - return path.getParent().toString(); // 返回上一级目录 + return path.getParent().toString(); } else if (userDir.endsWith("hugegraph-clustertest-test")) { - return path.getParent().getParent().toString(); // 返回上两级目录 + return path.getParent().getParent().toString(); } - return userDir; // 如果不匹配则返回当前目录 + return userDir; // Return current dir if not matched } } diff --git a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/config/GraphConfig.java b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/config/GraphConfig.java index 2666ec2b59..a6b425d51f 100644 --- a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/config/GraphConfig.java +++ b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/config/GraphConfig.java @@ -17,10 +17,9 @@ package org.apache.hugegraph.ct.config; -import static org.apache.hugegraph.ct.base.ClusterConstant.CT_PACKAGE_PATH; +import static org.apache.hugegraph.ct.base.ClusterConstant.CONFIG_FILE_PATH; import static org.apache.hugegraph.ct.base.ClusterConstant.GRAPH_TEMPLATE_FILE; import static org.apache.hugegraph.ct.base.ClusterConstant.HUGEGRAPH_PROPERTIES; -import static org.apache.hugegraph.ct.base.ClusterConstant.SERVER_TEMPLATE_PATH; import java.nio.file.Paths; import java.util.List; @@ -28,7 +27,7 @@ public class GraphConfig extends AbstractConfig { public GraphConfig() { - readTemplate(Paths.get(SERVER_TEMPLATE_PATH + GRAPH_TEMPLATE_FILE)); + readTemplate(Paths.get(CONFIG_FILE_PATH + GRAPH_TEMPLATE_FILE)); this.fileName = HUGEGRAPH_PROPERTIES; } diff --git a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/config/PDConfig.java b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/config/PDConfig.java index b9b4495511..d53e45d575 100644 --- a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/config/PDConfig.java +++ b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/config/PDConfig.java @@ -18,10 +18,9 @@ package org.apache.hugegraph.ct.config; import static org.apache.hugegraph.ct.base.ClusterConstant.APPLICATION_FILE; -import static org.apache.hugegraph.ct.base.ClusterConstant.CT_PACKAGE_PATH; +import static org.apache.hugegraph.ct.base.ClusterConstant.CONFIG_FILE_PATH; import static org.apache.hugegraph.ct.base.ClusterConstant.LOCALHOST; import static org.apache.hugegraph.ct.base.ClusterConstant.PD_TEMPLATE_FILE; -import static org.apache.hugegraph.ct.base.ClusterConstant.PD_TEMPLATE_PATH; import static org.apache.hugegraph.ct.base.EnvUtil.getAvailablePort; import java.nio.file.Paths; @@ -37,7 +36,7 @@ public class PDConfig extends AbstractConfig { private final int restPort; public PDConfig() { - readTemplate(Paths.get(PD_TEMPLATE_PATH + PD_TEMPLATE_FILE)); + readTemplate(Paths.get(CONFIG_FILE_PATH + PD_TEMPLATE_FILE)); this.fileName = APPLICATION_FILE; this.raftPort = getAvailablePort(); this.grpcPort = getAvailablePort(); diff --git a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/config/ServerConfig.java b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/config/ServerConfig.java index 8edb79ea76..569a11dddf 100644 --- a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/config/ServerConfig.java +++ b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/config/ServerConfig.java @@ -17,11 +17,10 @@ package org.apache.hugegraph.ct.config; -import static org.apache.hugegraph.ct.base.ClusterConstant.CT_PACKAGE_PATH; +import static org.apache.hugegraph.ct.base.ClusterConstant.CONFIG_FILE_PATH; import static org.apache.hugegraph.ct.base.ClusterConstant.LOCALHOST; import static org.apache.hugegraph.ct.base.ClusterConstant.SERVER_PROPERTIES; import static org.apache.hugegraph.ct.base.ClusterConstant.SERVER_TEMPLATE_FILE; -import static org.apache.hugegraph.ct.base.ClusterConstant.SERVER_TEMPLATE_PATH; import static org.apache.hugegraph.ct.base.EnvUtil.getAvailablePort; import java.nio.file.Paths; @@ -35,7 +34,7 @@ public class ServerConfig extends AbstractConfig { private final int restPort; public ServerConfig() { - readTemplate(Paths.get(SERVER_TEMPLATE_PATH + SERVER_TEMPLATE_FILE)); + readTemplate(Paths.get(CONFIG_FILE_PATH + SERVER_TEMPLATE_FILE)); this.fileName = SERVER_PROPERTIES; this.rpcPort = getAvailablePort(); this.restPort = getAvailablePort(); diff --git a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/config/StoreConfig.java b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/config/StoreConfig.java index 58ff98a01f..50495f18a5 100644 --- a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/config/StoreConfig.java +++ b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/config/StoreConfig.java @@ -18,10 +18,9 @@ package org.apache.hugegraph.ct.config; import static org.apache.hugegraph.ct.base.ClusterConstant.APPLICATION_FILE; -import static org.apache.hugegraph.ct.base.ClusterConstant.CT_PACKAGE_PATH; +import static org.apache.hugegraph.ct.base.ClusterConstant.CONFIG_FILE_PATH; import static org.apache.hugegraph.ct.base.ClusterConstant.LOCALHOST; import static org.apache.hugegraph.ct.base.ClusterConstant.STORE_TEMPLATE_FILE; -import static org.apache.hugegraph.ct.base.ClusterConstant.STORE_TEMPLATE_PATH; import static org.apache.hugegraph.ct.base.EnvUtil.getAvailablePort; import java.nio.file.Paths; @@ -37,8 +36,7 @@ public class StoreConfig extends AbstractConfig { private final int restPort; public StoreConfig() { - readTemplate( - Paths.get(STORE_TEMPLATE_PATH + STORE_TEMPLATE_FILE)); + readTemplate(Paths.get(CONFIG_FILE_PATH + STORE_TEMPLATE_FILE)); this.fileName = APPLICATION_FILE; this.raftPort = getAvailablePort(); this.grpcPort = getAvailablePort(); diff --git a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/node/PDNodeWrapper.java b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/node/PDNodeWrapper.java index b6cfca6096..a89c614c4c 100644 --- a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/node/PDNodeWrapper.java +++ b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/node/PDNodeWrapper.java @@ -19,7 +19,6 @@ import static org.apache.hugegraph.ct.base.ClusterConstant.CONF_DIR; import static org.apache.hugegraph.ct.base.ClusterConstant.JAVA_CMD; -import static org.apache.hugegraph.ct.base.ClusterConstant.LICENSE_FILE; import static org.apache.hugegraph.ct.base.ClusterConstant.LOG4J_FILE; import static org.apache.hugegraph.ct.base.ClusterConstant.PD_JAR_PREFIX; import static org.apache.hugegraph.ct.base.ClusterConstant.PD_LIB_PATH; diff --git a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/node/ServerNodeWrapper.java b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/node/ServerNodeWrapper.java index 16eff633fb..7f2a5058e7 100644 --- a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/node/ServerNodeWrapper.java +++ b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/node/ServerNodeWrapper.java @@ -24,7 +24,6 @@ import static org.apache.hugegraph.ct.base.ClusterConstant.EXT_DIR; import static org.apache.hugegraph.ct.base.ClusterConstant.GREMLIN_DRIVER_SETTING_FILE; import static org.apache.hugegraph.ct.base.ClusterConstant.GREMLIN_SERVER_FILE; -import static org.apache.hugegraph.ct.base.ClusterConstant.HUGEGRAPH_SERVER_KEYSTORE; import static org.apache.hugegraph.ct.base.ClusterConstant.JAVA_CMD; import static org.apache.hugegraph.ct.base.ClusterConstant.LIB_DIR; import static org.apache.hugegraph.ct.base.ClusterConstant.LOG4J_FILE; @@ -46,10 +45,8 @@ public class ServerNodeWrapper extends AbstractNodeWrapper { public ServerNodeWrapper(int clusterIndex, int index) { super(clusterIndex, index); - this.fileNames = new ArrayList<>(List.of(LOG4J_FILE, HUGEGRAPH_SERVER_KEYSTORE, - COMPUTER_SETTING_FILE, GREMLIN_SERVER_FILE, - GREMLIN_DRIVER_SETTING_FILE, REMOTE_SETTING_FILE, - REMOTE_OBJECTS_SETTING_FILE)); + this.fileNames = new ArrayList<>(List.of(LOG4J_FILE, GREMLIN_SERVER_FILE, GREMLIN_DRIVER_SETTING_FILE, + REMOTE_SETTING_FILE, REMOTE_OBJECTS_SETTING_FILE)); this.workPath = SERVER_LIB_PATH; createNodeDir(Paths.get(SERVER_TEMPLATE_PATH), getNodePath() + CONF_DIR + File.separator); this.fileNames = new ArrayList<>(List.of(EMPTY_SAMPLE_GROOVY_FILE, EXAMPLE_GROOVY_FILE)); diff --git a/hugegraph-pd/hg-pd-common/pom.xml b/hugegraph-pd/hg-pd-common/pom.xml index 79cfbe4112..dcb4557f12 100644 --- a/hugegraph-pd/hg-pd-common/pom.xml +++ b/hugegraph-pd/hg-pd-common/pom.xml @@ -44,5 +44,11 @@ commons-collections4 4.4 + + com.google.guava + guava + 31.0.1-android + compile + From cf6994d6b4a337735d096f10ffe86ebd2a98c8f9 Mon Sep 17 00:00:00 2001 From: 145425491 <1245294786@qq.com> Date: Mon, 14 Oct 2024 18:22:15 +0800 Subject: [PATCH 38/40] fix(ct): simplify the dist --- hugegraph-pd/hg-pd-common/pom.xml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/hugegraph-pd/hg-pd-common/pom.xml b/hugegraph-pd/hg-pd-common/pom.xml index dcb4557f12..79cfbe4112 100644 --- a/hugegraph-pd/hg-pd-common/pom.xml +++ b/hugegraph-pd/hg-pd-common/pom.xml @@ -44,11 +44,5 @@ commons-collections4 4.4 - - com.google.guava - guava - 31.0.1-android - compile - From e677136fd93875a5b925e13bec27644c0a43e98e Mon Sep 17 00:00:00 2001 From: 145425491 <1245294786@qq.com> Date: Mon, 14 Oct 2024 18:24:14 +0800 Subject: [PATCH 39/40] fix(ct): simplify the dist --- .../hugegraph.properties.template | 0 .../{pd => conf}/pd-application.yml.template | 0 .../rest-server.properties.template | 0 .../store-application.yml.template | 0 .../src/assembly/static/pd/log4j2.xml | 135 ---------------- .../server/gremlin-driver-settings.yaml | 25 --- .../static/server/gremlin-server.yaml | 127 --------------- .../src/assembly/static/server/log4j2.xml | 144 ------------------ .../static/server/remote-objects.yaml | 30 ---- .../src/assembly/static/server/remote.yaml | 25 --- .../src/assembly/static/store/log4j2.xml | 137 ----------------- 11 files changed, 623 deletions(-) rename hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/{server => conf}/hugegraph.properties.template (100%) rename hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/{pd => conf}/pd-application.yml.template (100%) rename hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/{server => conf}/rest-server.properties.template (100%) rename hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/{store => conf}/store-application.yml.template (100%) delete mode 100644 hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/pd/log4j2.xml delete mode 100644 hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/server/gremlin-driver-settings.yaml delete mode 100644 hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/server/gremlin-server.yaml delete mode 100644 hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/server/log4j2.xml delete mode 100644 hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/server/remote-objects.yaml delete mode 100644 hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/server/remote.yaml delete mode 100644 hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/store/log4j2.xml diff --git a/hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/server/hugegraph.properties.template b/hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/conf/hugegraph.properties.template similarity index 100% rename from hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/server/hugegraph.properties.template rename to hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/conf/hugegraph.properties.template diff --git a/hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/pd/pd-application.yml.template b/hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/conf/pd-application.yml.template similarity index 100% rename from hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/pd/pd-application.yml.template rename to hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/conf/pd-application.yml.template diff --git a/hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/server/rest-server.properties.template b/hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/conf/rest-server.properties.template similarity index 100% rename from hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/server/rest-server.properties.template rename to hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/conf/rest-server.properties.template diff --git a/hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/store/store-application.yml.template b/hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/conf/store-application.yml.template similarity index 100% rename from hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/store/store-application.yml.template rename to hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/conf/store-application.yml.template diff --git a/hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/pd/log4j2.xml b/hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/pd/log4j2.xml deleted file mode 100644 index a804948703..0000000000 --- a/hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/pd/log4j2.xml +++ /dev/null @@ -1,135 +0,0 @@ - - - - - - - - logs - hugegraph-pd - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/server/gremlin-driver-settings.yaml b/hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/server/gremlin-driver-settings.yaml deleted file mode 100644 index 55f38ab97d..0000000000 --- a/hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/server/gremlin-driver-settings.yaml +++ /dev/null @@ -1,25 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -hosts: [localhost] -port: 8182 -serializer: { - className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV1d0, - config: { - serializeResultToString: false, - ioRegistries: [org.apache.hugegraph.io.HugeGraphIoRegistry] - } -} diff --git a/hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/server/gremlin-server.yaml b/hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/server/gremlin-server.yaml deleted file mode 100644 index 048dded559..0000000000 --- a/hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/server/gremlin-server.yaml +++ /dev/null @@ -1,127 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# host and port of gremlin server, need to be consistent with host and port in rest-server.properties -host: 127.0.0.1 -port: 8182 - -# timeout in ms of gremlin query -evaluationTimeout: 30000 - -channelizer: org.apache.tinkerpop.gremlin.server.channel.WsAndHttpChannelizer -# don't set graph at here, this happens after support for dynamically adding graph -graphs: { -} -scriptEngines: { - gremlin-groovy: { - staticImports: [ - org.opencypher.gremlin.process.traversal.CustomPredicates.*', - org.opencypher.gremlin.traversal.CustomFunctions.* - ], - plugins: { - org.apache.hugegraph.plugin.HugeGraphGremlinPlugin: {}, - org.apache.tinkerpop.gremlin.server.jsr223.GremlinServerGremlinPlugin: {}, - org.apache.tinkerpop.gremlin.jsr223.ImportGremlinPlugin: { - classImports: [ - java.lang.Math, - org.apache.hugegraph.backend.id.IdGenerator, - org.apache.hugegraph.type.define.Directions, - org.apache.hugegraph.type.define.NodeRole, - org.apache.hugegraph.masterelection.GlobalMasterInfo, - org.apache.hugegraph.util.DateUtil, - org.apache.hugegraph.traversal.algorithm.CollectionPathsTraverser, - org.apache.hugegraph.traversal.algorithm.CountTraverser, - org.apache.hugegraph.traversal.algorithm.CustomizedCrosspointsTraverser, - org.apache.hugegraph.traversal.algorithm.CustomizePathsTraverser, - org.apache.hugegraph.traversal.algorithm.FusiformSimilarityTraverser, - org.apache.hugegraph.traversal.algorithm.HugeTraverser, - org.apache.hugegraph.traversal.algorithm.JaccardSimilarTraverser, - org.apache.hugegraph.traversal.algorithm.KneighborTraverser, - org.apache.hugegraph.traversal.algorithm.KoutTraverser, - org.apache.hugegraph.traversal.algorithm.MultiNodeShortestPathTraverser, - org.apache.hugegraph.traversal.algorithm.NeighborRankTraverser, - org.apache.hugegraph.traversal.algorithm.PathsTraverser, - org.apache.hugegraph.traversal.algorithm.PersonalRankTraverser, - org.apache.hugegraph.traversal.algorithm.SameNeighborTraverser, - org.apache.hugegraph.traversal.algorithm.ShortestPathTraverser, - org.apache.hugegraph.traversal.algorithm.SingleSourceShortestPathTraverser, - org.apache.hugegraph.traversal.algorithm.SubGraphTraverser, - org.apache.hugegraph.traversal.algorithm.TemplatePathsTraverser, - org.apache.hugegraph.traversal.algorithm.steps.EdgeStep, - org.apache.hugegraph.traversal.algorithm.steps.RepeatEdgeStep, - org.apache.hugegraph.traversal.algorithm.steps.WeightedEdgeStep, - org.apache.hugegraph.traversal.optimize.ConditionP, - org.apache.hugegraph.traversal.optimize.Text, - org.apache.hugegraph.traversal.optimize.TraversalUtil, - org.opencypher.gremlin.traversal.CustomFunctions, - org.opencypher.gremlin.traversal.CustomPredicate - ], - methodImports: [ - java.lang.Math#*, - org.opencypher.gremlin.traversal.CustomPredicate#*, - org.opencypher.gremlin.traversal.CustomFunctions#* - ] - }, - org.apache.tinkerpop.gremlin.jsr223.ScriptFileGremlinPlugin: { - files: [scripts/empty-sample.groovy] - } - } - } -} -serializers: - - {className: org.apache.tinkerpop.gremlin.driver.ser.GraphBinaryMessageSerializerV1, - config: { - serializeResultToString: false, - ioRegistries: [org.apache.hugegraph.io.HugeGraphIoRegistry] - } - } - - {className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV1d0, - config: { - serializeResultToString: false, - ioRegistries: [org.apache.hugegraph.io.HugeGraphIoRegistry] - } - } - - {className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV2d0, - config: { - serializeResultToString: false, - ioRegistries: [org.apache.hugegraph.io.HugeGraphIoRegistry] - } - } - - {className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV3d0, - config: { - serializeResultToString: false, - ioRegistries: [org.apache.hugegraph.io.HugeGraphIoRegistry] - } - } -metrics: { - consoleReporter: {enabled: false, interval: 180000}, - csvReporter: {enabled: false, interval: 180000, fileName: ./metrics/gremlin-server-metrics.csv}, - jmxReporter: {enabled: false}, - slf4jReporter: {enabled: false, interval: 180000}, - gangliaReporter: {enabled: false, interval: 180000, addressingMode: MULTICAST}, - graphiteReporter: {enabled: false, interval: 180000} -} -maxInitialLineLength: 4096 -maxHeaderSize: 8192 -maxChunkSize: 8192 -maxContentLength: 65536 -maxAccumulationBufferComponents: 1024 -resultIterationBatchSize: 64 -writeBufferLowWaterMark: 32768 -writeBufferHighWaterMark: 65536 -ssl: { - enabled: false -} diff --git a/hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/server/log4j2.xml b/hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/server/log4j2.xml deleted file mode 100644 index f1dd7e8395..0000000000 --- a/hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/server/log4j2.xml +++ /dev/null @@ -1,144 +0,0 @@ - - - - - - logs - hugegraph-server - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/server/remote-objects.yaml b/hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/server/remote-objects.yaml deleted file mode 100644 index 39679d8c30..0000000000 --- a/hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/server/remote-objects.yaml +++ /dev/null @@ -1,30 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -hosts: [localhost] -port: 8182 -serializer: { - className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV1d0, - config: { - serializeResultToString: false, - # The duplication of HugeGraphIoRegistry is meant to fix a bug in the - # 'org.apache.tinkerpop.gremlin.driver.Settings:from(Configuration)' method. - ioRegistries: [ - org.apache.hugegraph.io.HugeGraphIoRegistry, - org.apache.hugegraph.io.HugeGraphIoRegistry - ] - } -} diff --git a/hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/server/remote.yaml b/hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/server/remote.yaml deleted file mode 100644 index 55f38ab97d..0000000000 --- a/hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/server/remote.yaml +++ /dev/null @@ -1,25 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -hosts: [localhost] -port: 8182 -serializer: { - className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV1d0, - config: { - serializeResultToString: false, - ioRegistries: [org.apache.hugegraph.io.HugeGraphIoRegistry] - } -} diff --git a/hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/store/log4j2.xml b/hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/store/log4j2.xml deleted file mode 100644 index 388d09e2fd..0000000000 --- a/hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/store/log4j2.xml +++ /dev/null @@ -1,137 +0,0 @@ - - - - - - - - logs - hugegraph-store - raft-hugegraph-store - audit-hugegraph-store - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - From b4f451d11d97cbb58e0224447573196ae7ed9b05 Mon Sep 17 00:00:00 2001 From: 145425491 <1245294786@qq.com> Date: Mon, 14 Oct 2024 19:14:49 +0800 Subject: [PATCH 40/40] fix(ct): fix server config file path --- .../apache/hugegraph/ct/base/ClusterConstant.java | 10 ++++------ .../apache/hugegraph/ct/node/ServerNodeWrapper.java | 9 +++++---- .../SimpleClusterTest/SimpleClusterDeployTest.java | 13 ++++++------- 3 files changed, 15 insertions(+), 17 deletions(-) diff --git a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/base/ClusterConstant.java b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/base/ClusterConstant.java index 2caa5a6a2a..9120c0cf92 100644 --- a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/base/ClusterConstant.java +++ b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/base/ClusterConstant.java @@ -28,9 +28,6 @@ public class ClusterConstant { public static final String LOG = "logs"; public static final String PROJECT_DIR = getProjectDir(); - public static final String PD = "pd"; - public static final String STORE = "store"; - public static final String SERVER = "server"; public static final String LIB_DIR = "lib"; public static final String EXT_DIR = "ext"; public static final String PLUGINS_DIR = "plugins"; @@ -52,7 +49,6 @@ public class ClusterConstant { public static final String GRAPH_TEMPLATE_FILE = "hugegraph.properties.template"; public static final String GREMLIN_DRIVER_SETTING_FILE = "gremlin-driver-settings.yaml"; public static final String GREMLIN_SERVER_FILE = "gremlin-server.yaml"; - public static final String COMPUTER_SETTING_FILE = "computer.yaml"; public static final String REMOTE_SETTING_FILE = "remote.yaml"; public static final String REMOTE_OBJECTS_SETTING_FILE = "remote-objects.yaml"; public static final String EMPTY_SAMPLE_GROOVY_FILE = "scripts/empty-sample.groovy"; @@ -83,9 +79,11 @@ public class ClusterConstant { public static final String SERVER_LIB_PATH = getFileInDir(SERVER_DIST_PATH, SERVER_PACKAGE_PREFIX) + File.separator; - public static final String SERVER_TEMPLATE_PATH = + public static final String SERVER_PACKAGE_PATH = getFileInDir(SERVER_DIST_PATH, SERVER_PACKAGE_PREFIX) + - File.separator + CONF_DIR + File.separator; + File.separator; + public static final String SERVER_TEMPLATE_PATH = + SERVER_PACKAGE_PATH + CONF_DIR + File.separator; public static final String CT_DIST_PATH = PROJECT_DIR + File.separator + "hugegraph-cluster-test" + File.separator; public static final String CT_PACKAGE_PATH = diff --git a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/node/ServerNodeWrapper.java b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/node/ServerNodeWrapper.java index 7f2a5058e7..e39bc39557 100644 --- a/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/node/ServerNodeWrapper.java +++ b/hugegraph-cluster-test/hugegraph-clustertest-minicluster/src/main/java/org/apache/hugegraph/ct/node/ServerNodeWrapper.java @@ -17,7 +17,6 @@ package org.apache.hugegraph.ct.node; -import static org.apache.hugegraph.ct.base.ClusterConstant.COMPUTER_SETTING_FILE; import static org.apache.hugegraph.ct.base.ClusterConstant.CONF_DIR; import static org.apache.hugegraph.ct.base.ClusterConstant.EMPTY_SAMPLE_GROOVY_FILE; import static org.apache.hugegraph.ct.base.ClusterConstant.EXAMPLE_GROOVY_FILE; @@ -31,6 +30,7 @@ import static org.apache.hugegraph.ct.base.ClusterConstant.REMOTE_OBJECTS_SETTING_FILE; import static org.apache.hugegraph.ct.base.ClusterConstant.REMOTE_SETTING_FILE; import static org.apache.hugegraph.ct.base.ClusterConstant.SERVER_LIB_PATH; +import static org.apache.hugegraph.ct.base.ClusterConstant.SERVER_PACKAGE_PATH; import static org.apache.hugegraph.ct.base.ClusterConstant.SERVER_TEMPLATE_PATH; import static org.apache.hugegraph.ct.base.ClusterConstant.isJava11OrHigher; @@ -45,13 +45,14 @@ public class ServerNodeWrapper extends AbstractNodeWrapper { public ServerNodeWrapper(int clusterIndex, int index) { super(clusterIndex, index); - this.fileNames = new ArrayList<>(List.of(LOG4J_FILE, GREMLIN_SERVER_FILE, GREMLIN_DRIVER_SETTING_FILE, - REMOTE_SETTING_FILE, REMOTE_OBJECTS_SETTING_FILE)); + this.fileNames = new ArrayList<>( + List.of(LOG4J_FILE, GREMLIN_SERVER_FILE, GREMLIN_DRIVER_SETTING_FILE, + REMOTE_SETTING_FILE, REMOTE_OBJECTS_SETTING_FILE)); this.workPath = SERVER_LIB_PATH; createNodeDir(Paths.get(SERVER_TEMPLATE_PATH), getNodePath() + CONF_DIR + File.separator); this.fileNames = new ArrayList<>(List.of(EMPTY_SAMPLE_GROOVY_FILE, EXAMPLE_GROOVY_FILE)); this.startLine = "INFO: [HttpServer] Started."; - createNodeDir(Paths.get(SERVER_TEMPLATE_PATH), getNodePath()); + createNodeDir(Paths.get(SERVER_PACKAGE_PATH), getNodePath()); createLogDir(); } diff --git a/hugegraph-cluster-test/hugegraph-clustertest-test/src/main/java/org/apache/hugegraph/SimpleClusterTest/SimpleClusterDeployTest.java b/hugegraph-cluster-test/hugegraph-clustertest-test/src/main/java/org/apache/hugegraph/SimpleClusterTest/SimpleClusterDeployTest.java index 61ef9d6ce4..61a73ff0f4 100644 --- a/hugegraph-cluster-test/hugegraph-clustertest-test/src/main/java/org/apache/hugegraph/SimpleClusterTest/SimpleClusterDeployTest.java +++ b/hugegraph-cluster-test/hugegraph-clustertest-test/src/main/java/org/apache/hugegraph/SimpleClusterTest/SimpleClusterDeployTest.java @@ -29,11 +29,11 @@ import org.apache.hugegraph.pd.client.PDConfig; import org.apache.hugegraph.pd.common.PDException; import org.apache.hugegraph.structure.constant.T; +import org.apache.hugegraph.structure.graph.Edge; +import org.apache.hugegraph.structure.graph.Path; import org.apache.hugegraph.structure.graph.Vertex; -import org.apache.hugegraph.structure.gremlin.ResultSet; import org.apache.hugegraph.structure.gremlin.Result; -import org.apache.hugegraph.structure.graph.Path; -import org.apache.hugegraph.structure.graph.Edge; +import org.apache.hugegraph.structure.gremlin.ResultSet; import org.junit.Assert; import org.junit.Test; @@ -41,7 +41,7 @@ public class SimpleClusterDeployTest extends BaseSimpleTest { @Test public void testPDNodesDeployment() { - try{ + try { List addrs = env.getPDGrpcAddrs(); for (String addr : addrs) { PDConfig pdConfig = PDConfig.of(addr); @@ -49,7 +49,7 @@ public void testPDNodesDeployment() { pdClient.dbCompaction(); } assert true; - }catch (PDException pdException){ + } catch (PDException pdException) { assert false; } } @@ -73,8 +73,7 @@ public void testStoreNodesDeployment() throws IOException { public void testServerNodesDeployment() { List addrs = env.getServerRestAddrs(); for (String addr : addrs) { - hugeClient = HugeClient.builder("http://" + addr, "hugegraph") - .build(); + hugeClient = HugeClient.builder("http://" + addr, "hugegraph").build(); SchemaManager schema = hugeClient.schema(); schema.propertyKey("name").asText().ifNotExist().create();