当前位置: 首页 > 工具软件 > YugaByteDB > 使用案例 >

centos 7.4 + yugabytedb 2.5

卜高超
2023-12-01

os: centos 7.4.1708
db: yugabytedb 2.5

参考《centos 7.x 安装 yugabytedb 的优化设置》设置好centos 7.4

setup python

yugabytedb 2.5 需要 python 环境,2.5 版本 对 python2 或者 python3 都可以
python2 安装如下

# yum install python python-libs python-devel python2-pip

python3 安装如下

# yum install -y python3 python3-libs python3-devel python3-pip python3-setuptools

# alternatives --set python /usr/bin/python3

create user

# groupadd -g 5000 yugabyte;
useradd -g yugabyte -u 5000 yugabyte -d /home/yugabyte;
usermod -g yugabyte yugabyte;
mkdir -p /var/lib/yugabytedb; 
chown -R yugabyte:yugabyte /var/lib/yugabytedb;

yugabyte 用户的环境变量,先占位,后面修改

# vi /home/yugabyte/.bash_profile

export PGHOME=/usr/yugabytedb-
export PGDATA=/var/lib/yugabytedb 

export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${PGHOME}/lib
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/lib:/usr/lib:/usr/local/lib
export PATH=${PGHOME}/bin:$PATH
export MANPATH=${PGHOME}/share/man:$MANPATH

export TMP=/tmp
export TEMP=/tmp
export TMPDIR=/tmp

download、setup

# cd /usr
# wget https://downloads.yugabyte.com/yugabyte-2.5.1.0-linux.tar.gz
# tar xvfz yugabyte-2.5.1.0-linux.tar.gz
# chown -R yugabyte:yugabyte ./yugabyte-2.5.1.0

# su - yugabyte
$ cd /usr/yugabyte-2.5.1.0
$ ./bin/post_install.sh

startup(RF=1)

To create a single-node local cluster with a replication factor (RF) of 1
该方式只能初步试用,没有HA。

# su - yugabyte
$ cd /usr/yugabyte-2.5.1.0

$ ./bin/yugabyted start --base_dir=/var/lib/yugabytedb/node1 --listen=127.0.0.1

✅ System checks           

+--------------------------------------------------------------------------------------------------+
|                                            yugabyted                                             |
+--------------------------------------------------------------------------------------------------+
| Status              : Running                                                                    |
| Web console         : http://127.0.0.1:7000                                                      |
| JDBC                : jdbc:postgresql://127.0.0.1:5433/yugabyte?user=yugabyte&password=yugabyte  |
| YSQL                : bin/ysqlsh   -U yugabyte -d yugabyte                                       |
| YCQL                : bin/ycqlsh   -u cassandra                                                  |
| Data Dir            : /var/lib/yugabytedb/data                                             |
| Log Dir             : /var/lib/yugabytedb/logs                                             |
| Universe UUID       : eca123a7-e34a-42e5-b99d-a60551a5a9ac                                       |
+--------------------------------------------------------------------------------------------------+
 yugabyted started successfully! To load a sample dataset, try 'yugabyted demo'.
 Join us on Slack at https://www.yugabyte.com/slack
 Claim your free t-shirt at https://www.yugabyte.com/community-rewards/

startup(RF=3)

Start a new local three-node cluster with a replication factor (RF) of 3

# su - yugabyte
$ cd /usr/yugabyte-2.5.1.0
$ ./bin/yugabyted destroy --base_dir=/var/lib/yugabytedb
$ mkdir -p /var/lib/yugabytedb/{node1,node2,node3}

$ ./bin/yugabyted start --base_dir=/var/lib/yugabytedb/node1 --listen=127.0.0.1

$ ./bin/yugabyted start --base_dir=/var/lib/yugabytedb/node2 --listen=127.0.0.2 --join=127.0.0.1

$ ./bin/yugabyted start --base_dir=/var/lib/yugabytedb/node3 --listen=127.0.0.3 --join=127.0.0.1

✅ System checks           

+--------------------------------------------------------------------------------------------------+
|                                            yugabyted                                             |
+--------------------------------------------------------------------------------------------------+
| Status              : Running                                                                    |
| Web console         : http://127.0.0.1:7000                                                      |
| JDBC                : jdbc:postgresql://127.0.0.1:5433/yugabyte?user=yugabyte&password=yugabyte  |
| YSQL                : bin/ysqlsh   -U yugabyte -d yugabyte                                       |
| YCQL                : bin/ycqlsh   -u cassandra                                                  |
| Data Dir            : /var/lib/yugabytedb/node1/data                                             |
| Log Dir             : /var/lib/yugabytedb/node1/logs                                             |
| Universe UUID       : fcf152a7-f3aa-42e5-b99d-a60551a5a9ac                                       |
+--------------------------------------------------------------------------------------------------+
 yugabyted started successfully! To load a sample dataset, try 'yugabyted demo'.
 Join us on Slack at https://www.yugabyte.com/slack
 Claim your free t-shirt at https://www.yugabyte.com/community-rewards/

✅ System checks           

+--------------------------------------------------------------------------------------------------+
|                                            yugabyted                                             |
+--------------------------------------------------------------------------------------------------+
| Status              : Running                                                                    |
| Web console         : http://127.0.0.2:7000                                                      |
| JDBC                : jdbc:postgresql://127.0.0.2:5433/yugabyte?user=yugabyte&password=yugabyte  |
| YSQL                : bin/ysqlsh -h 127.0.0.2  -U yugabyte -d yugabyte                           |
| YCQL                : bin/ycqlsh 127.0.0.2 9042 -u cassandra                                     |
| Data Dir            : /var/lib/yugabytedb/node2/data                                             |
| Log Dir             : /var/lib/yugabytedb/node2/logs                                             |
| Universe UUID       : fcf152a7-f3aa-42e5-b99d-a60551a5a9ac                                       |
+--------------------------------------------------------------------------------------------------+
 yugabyted started successfully! To load a sample dataset, try 'yugabyted demo'.
 Join us on Slack at https://www.yugabyte.com/slack
 Claim your free t-shirt at https://www.yugabyte.com/community-rewards/

✅ System checks           

+--------------------------------------------------------------------------------------------------+
|                                            yugabyted                                             |
+--------------------------------------------------------------------------------------------------+
| Status              : Running                                                                    |
| Web console         : http://127.0.0.3:7000                                                      |
| JDBC                : jdbc:postgresql://127.0.0.3:5433/yugabyte?user=yugabyte&password=yugabyte  |
| YSQL                : bin/ysqlsh -h 127.0.0.3  -U yugabyte -d yugabyte                           |
| YCQL                : bin/ycqlsh 127.0.0.3 9042 -u cassandra                                     |
| Data Dir            : /var/lib/yugabytedb/node3/data                                             |
| Log Dir             : /var/lib/yugabytedb/node3/logs                                             |
| Universe UUID       : fcf152a7-f3aa-42e5-b99d-a60551a5a9ac                                       |
+--------------------------------------------------------------------------------------------------+
 yugabyted started successfully! To load a sample dataset, try 'yugabyted demo'.
 Join us on Slack at https://www.yugabyte.com/slack
 Claim your free t-shirt at https://www.yugabyte.com/community-rewards/

 类似资料:

相关阅读

相关文章

相关问答