This is an automated email from the ASF dual-hosted git repository. junchao pushed a commit to branch port in repository https://gitbox.apache.org/repos/asf/incubator-resilientdb.git
commit 698df622e0b85600b448323f14db3a6687dbd200 Author: cjcchen <[email protected]> AuthorDate: Sun Dec 8 04:30:12 2024 +0000 add port reset --- README.md | 49 +++++-------- service/tools/config/generate_config.sh | 92 ++++++++++++++++++++++++ service/tools/kv/server_tools/generate_config.sh | 15 ++++ 3 files changed, 125 insertions(+), 31 deletions(-) diff --git a/README.md b/README.md index 6d3fea22..050ccf35 100644 --- a/README.md +++ b/README.md @@ -1,22 +1,3 @@ -<!-- - - 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. - --> -    @@ -41,7 +22,7 @@ Download address for run-directly software package: https://downloads.apache.org 4. ResilientDB exposes a wide range of interfaces such as a **Key-Value** store, **Smart Contracts**, **UTXO**, and **Python SDK**. Following are some of the decentralized applications (DApps) built on top of ResilientDB: **[NFT Marketplace](https://nft.resilientdb.com/)** and **[Debitable](https://debitable.resilientdb.com/)**. 5. To persist blockchain, chain state, and metadata, ResilientDB provides durability through **LevelDB**. 6. ResilientDB provides access to a seamless **GUI display** for deployment and maintenance, and supports **Grafana** for plotting monitoring data. -7. **[Historial Facts]** The ResilientDB project was founded by **[Mohammad Sadoghi](https://expolab.org/)** along with his students ([Suyash Gupta](https://gupta-suyash.github.io/index.html) as the lead Architect, [Sajjad Rahnama](https://sajjadrahnama.com/) as the lead System Designer, and [Jelle Hellings](https://www.jhellings.nl/)) at **[UC Davis](https://www.ucdavis.edu/)** in 2018 and was open-sourced in late 2019. On September 30, 2021, we released ResilientDB v-3.0. In 2022, Resi [...] +7. **[Historial Facts]** The ResilientDB project was founded by **[Mohammad Sadoghi](https://expolab.org/)** along with his students ([Suyash Gupta](https://gupta-suyash.github.io/index.html) as the lead Architect, [Sajjad Rahnama](https://sajjadrahnama.com/) as the lead System Designer, and [Jelle Hellings](https://www.jhellings.nl/)) at **[UC Davis](https://www.ucdavis.edu/)** in 2018 and was open-sourced in late 2019. On September 30, 2021, we released ResilientDB v-3.0. In 2022, Resi [...] <div align = "center"> <img src="./img/resdb-v2.png" width="220"> @@ -89,7 +70,7 @@ Install dependencies: ./INSTALL.sh -For non-root users, see [INSTALL/README.md](https://github.com/apache/incubator-resilientdb/blob/master/INSTALL/README.md) +For non-root users, see [INSTALL/README.md](https://github.com/apache/incubator-resilientdb/blob/install/INSTALL/README.md) Run ResilientDB (Providing a Key-Value Service): @@ -101,10 +82,6 @@ Build Interactive Tools: bazel build service/tools/kv/api_tools/kv_service_tools -### Issues ### -If you cannot build the project successfully, try to reduce the bazel jobs [here]( -https://github.com/apache/incubator-resilientdb/blob/master/.bazelrc#L1). - ## Functions ## ResilientDB supports two types of functions: version-based and non-version-based. Version-based functions will leverage versions to protect each update, versions must be obtained before updating a key. @@ -360,11 +337,21 @@ We also provide access to a [deployment script](https://github.com/resilientdb/r docker exec -it myserver bash ``` -5. **NOTE: If you encounter a Connection Refused error** + Verify the functionality of the service by performing set and get operations provided above [functions](README.md#functions). + + +## Custom Port ## +When starting the service locally, current services are running on 10000 port-base with 5 services where the server config is located [here](https://github.com/apache/incubator-resilientdb/blob/master/service/tools/config/server/server.config) + +If you want to change the setting, you need to generate the certificates. + +Go the the workspace where the resilientdb repo is localted. + +Change the setting parameters here and run the script: + ./service/tools/kv/server_tools/generate_config.sh + +Then re-run the start script: + ./service/tools/kv/server_tools/start_kv_service.sh + - Run the following command within the container: - ```shell - ./service/tools/kv/server_tools/start_kv_service.sh - ``` - Verify the functionality of the service by performing set and get operations provided above [functions](README.md#functions). diff --git a/service/tools/config/generate_config.sh b/service/tools/config/generate_config.sh new file mode 100755 index 00000000..8d493c55 --- /dev/null +++ b/service/tools/config/generate_config.sh @@ -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. +# +base_path=$1; shift +key_path=$1; shift +output_cert_path=$1; shift +output_path=$1; shift +admin_key_path=$1; shift +client_num=$1; shift +base_port=$1; shift + +iplist=$@ + +echo "generage certificates" + +echo "base path:"$base_path +echo "key path:"$key_path +echo "output cert path:"$output_cert_path +echo "output path:"$output_path +echo "admin_key_path:"$admin_key_path + +cd ${output_path} + +ADMIN_PRIVATE_KEY=${admin_key_path}/admin.key.pri +ADMIN_PUBLIC_KEY=${admin_key_path}/admin.key.pub + +CERT_TOOLS_BIN=${base_path}/bazel-bin/tools/certificate_tools +CONFIG_TOOLS_BIN=${base_path}/bazel-bin/tools/generate_region_config + +USERNAME=ubuntu +BASE_PORT=${base_port} +CLIENT_NUM=${client_num} + + +echo "" > client.config +echo "" > server.config + +bazel build //tools:certificate_tools +bazel build //tools:generate_region_config + +idx=1 +tot=0 +for _ in ${iplist[@]}; +do + tot=$(($tot+1)) +done + +echo $PWD +echo "node num:"$tot +echo "base port:"${BASE_PORT} +echo "client num:" ${CLIENT_NUM} + +for ip in ${iplist[@]}; +do + port=$((${BASE_PORT}+${idx})) + public_key=${key_path}/node${idx}.key.pub + echo "get ip:"${ip} + + # create public key + # create server config + # create the public key and certificate + if [ $(($idx+$CLIENT_NUM)) -gt $tot ] ; then + $CERT_TOOLS_BIN ${output_cert_path} ${ADMIN_PRIVATE_KEY} ${ADMIN_PUBLIC_KEY} ${public_key} ${idx} ${ip} ${port} client + echo "${idx} ${ip} ${port}" >> client.config + else + $CERT_TOOLS_BIN ${output_cert_path} ${ADMIN_PRIVATE_KEY} ${ADMIN_PUBLIC_KEY} ${public_key} ${idx} ${ip} ${port} replica + echo "${idx} ${ip} ${port}" >> server.config + fi + + idx=$(($idx+1)) +done + +python3 ${CONFIG_TOOLS_BIN} ./server.config ./server.config.json +mv server.config.json ${output_path}/server/server.config +mv client.config ${output_path}/interface/service.config +echo "config done:" ${output_path}/server/server.config + diff --git a/service/tools/kv/server_tools/generate_config.sh b/service/tools/kv/server_tools/generate_config.sh new file mode 100755 index 00000000..300d8376 --- /dev/null +++ b/service/tools/kv/server_tools/generate_config.sh @@ -0,0 +1,15 @@ +iplist=( +127.0.0.1 +127.0.0.1 +127.0.0.1 +127.0.0.1 +127.0.0.1 +) + +WORKSPACE=$PWD +CERT_PATH=$PWD/service/tools/data/cert/ +CONFIG_PATH=$PWD/service/tools/config/ +PORT_BASE=20000 +CLIENT_NUM=1 + +./service/tools/config/generate_config.sh ${WORKSPACE} ${CERT_PATH} ${CERT_PATH} ${CONFIG_PATH} ${CERT_PATH} ${CLIENT_NUM} ${PORT_BASE} ${iplist[@]}
