1 Star 0 Fork 0

Gitee 极速下载 / OpenTenBase

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
此仓库是为了提升国内下载速度的镜像仓库,每日同步一次。 原始仓库: https://github.com/OpenTenBase/OpenTenBase
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
BSD-3-Clause

logo


OpenTenBase 数据库管理系统

OpenTenBase 是基于 Postgres-XL 项目的先进企业级数据库管理系统。它支持SQL标准的扩展子集,包括事务、外键、用户定义类型和函数。此外,它还添加了并行计算、安全性、管理、审计和其他功能。

OpenTenBase具有许多类似于PostgreSQL的语言接口,其中的一些可以在下面的链接中找到:

https://www.postgresql.org/download

概览

一个 OpenTenBase 集群由多个 CoordinateNodesDataNodesGTM 节点组成。所有用户数据都存储在 DataNode 中,CoordinateNode 仅包含元数据,GTM 则用于全局事务管理。CoordinateNodesDataNodes 共享相同的视图。

用户总是会将请求发送到到 CoordinateNodesCoordinateNodes将请求分段之后分发给 DataNodes执行 ,CoordinateNodes将收集到的请求汇总后返回给用户。

您可以在以下的链接获取 OpenTenBase 软件的最新版本:

https://github.com/OpenTenBase/OpenTenBase

更多的信息则可以从我们的网站中获取到:

https://www.opentenbase.org/

构建过程

系统要求

内存: 最小 4G RAM

操作系统: TencentOS 2, TencentOS 3, OpenCloudOS, CentOS 7, CentOS 8, Ubuntu等

安装依赖

yum -y install gcc make readline-devel zlib-devel openssl-devel uuid-devel bison flex

或者

apt install -y gcc make libreadline-dev zlib1g-dev libssl-dev libossp-uuid-dev bison flex

创建用户 'opentenbase'

mkdir /data
useradd -d /data/opentenbase -s /bin/bash -m opentenbase # add user opentenbase
passwd opentenbase # set password

编译

git clone https://github.com/OpenTenBase/OpenTenBase

export SOURCECODE_PATH=/data/opentenbase/OpenTenBase
export INSTALL_PATH=/data/opentenbase/install

cd ${SOURCECODE_PATH}
rm -rf ${INSTALL_PATH}/opentenbase_bin_v2.0
chmod +x configure*
./configure --prefix=${INSTALL_PATH}/opentenbase_bin_v2.0 --enable-user-switch --with-openssl --with-ossp-uuid CFLAGS=-g
make clean
make -sj
make install
chmod +x contrib/pgxc_ctl/make_signature
cd contrib
make -sj
make install

注意: 如果您使用 Ubuntu 并且在"init all"的过程中出现了 initgtm: command not found错误, 你可以需要添加 ${INSTALL_PATH}/opentenbase_bin_v2.0/bin/etc/environment

安装

使用 PGXC_CTL 工具 来搭建一个集群, 例如: 搭建一个具有1个 global transaction management(GTM) 节点, 1个 coordinator(COORDINATOR)节点以及2个 data nodes (DATANODE) 节点的集群。

topology

准备工作

  1. 安装 pgxc 并且把 pgxc 安装包的路径导入到系统环境变量中

    PG_HOME=${INSTALL_PATH}/opentenbase_bin_v2.0
    export PATH="$PATH:$PG_HOME/bin"
    export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$PG_HOME/lib"
    export LC_ALL=C
  2. 关掉 SELinuxfirewall (可选的)

    vi /etc/selinux/config # set SELINUX=disabled
    # Disable firewalld
    systemctl disable firewalld
    systemctl stop firewalld
  3. 实现集群节点所在机器之间的 ssh 无密码登录,然后进行部署和初始化将会通过 ssh 连接到每个节点的机器。一旦完成这一步,就无需输入密码

    ssh-keygen -t rsa
    ssh-copy-id -i ~/.ssh/id_rsa.pub destination-user@destination-server

集群启动步骤

  1. 生成并填写配置文件 pgxc_ctl.confpgxc_ctl 工具可以生成配置文件的模板,需要在模板中填写集群节点的信息。启动 pgxc_ctl 工具后,将在当前用户的主目录中生成 pgxc_ctl 目录。在输入 "prepare config" 命令后,将在 pgxc_ctl 目录中生成可直接修改的配置文件模板。

    • 配置文件开头的 pgxcInstallDir 指的是 pgxc 安装包的存放位置, 数据库用户可以根据自己的需求进行设置
    pgxcInstallDir=${INSTALL_PATH}/opentenbase_bin_v2.0
    • 对于GTM节点,您需要配置节点名称、IP端口、端口号和节点目录
    #---- GTM ----------
    gtmName=gtm
    gtmMasterServer=xxx.xxx.xxx.1
    gtmMasterPort=50001
    gtmMasterDir=${GTM_MASTER_DATA_DIR}/data/gtm_master
    • 如果您不需要gtmSlave,您可以直接在相应节点的配置中将其设置为n
    gtmSlave=n

    如果您需要gtmSlave,则可以按照配置文件中的说明进行配置。

    • Coordination节点要配置IP、端口、目录等信息
    coordNames=(cn001)
    coordMasterCluster=(opentenbase_cluster)
    coordPorts=(30004)
    poolerPorts=(30014)
    coordPgHbaEntries=(0.0.0.0/0)
    coordMasterServers=(xxx.xxx.xxx.2)
    coordMasterDirs=(${COORD_MASTER_DATA_DIR}/data/cn_master/cn001)
    • Data节点与上述节点类似:需要配置IP地址、端口号、目录等(由于有两个数据节点,您需要配置与节点数量相同的信息)。
    primaryDatanode=dn001
    datanodeNames=(dn001 dn002)
    datanodePorts=(20008 20009)
    datanodePoolerPorts=(20018 20019)
    datanodeMasterCluster=(opentenbase_cluster opentenbase_cluster)
    datanodePgHbaEntries=(0.0.0.0/0)
    datanodeMasterServers=(xxx.xxx.xxx.3 xxx.xxx.xxx.4)
    datanodeMasterDirs=(${DATANODE_MASTER_DATA_DIR}/data/dn_master/dn001 ${DATANODE_MASTER_DATA_DIR}/data/dn_master/dn002)

    Coordination节点和Data节点分别对应 coordSlavedatanodeSlave。如果不需要这些节点,则可以将它们配置为'n';否则,需要根据配置文件的说明进行配置。

    此外,Coordination节点和Data节点需要配置两种类型的端口:poolerPortport, poolerPort 用于节点之间的通信,port 用于用户登录节点。值得注意的是,poolerPortport 必须配置不同,否则会发生冲突,导致集群无法启动。

    每个节点都需要有自己的目录,并且不能配置位相同的目录。

  2. 安装包的分发(deploy all)。在填写好配置文件后,运行 pgxc_ctl 工具,然后输入 "deploy all" 命令,将安装包分发到每个节点的IP机器上。 topology

  3. 初始化集群的每个节点(init all)。在安装包分发完成后,在 pgxc_ctl 工具中输入 "init all" 命令,初始化配置文件 pgxc_ctl.conf 中的所有节点,并启动集群。到目前为止,集群已经完成启动。 topology

使用

$ psql -h ${CoordinateNode_IP} -p ${CoordinateNode_PORT} -U ${pgxcOwner} -d postgres

postgres=# create default node group default_group  with (dn001,dn002);
CREATE NODE GROUP
postgres=# create sharding group to group default_group;
CREATE SHARDING GROUP
postgres=# create table foo(id bigint, str text) distribute by shard(id);

引用

https://docs.opentenbase.org/

许可

OpenTenBase 使用 BSD 3-Clause 许可证,版权和许可信息可以在 LICENSE.txt 中找到。

贡献者

感谢所有参与项目贡献的人: CONTRIBUTORS

最新消息和活动

新闻
开放原子校源行走进苏南,加速开源人才培养和创新能力提升
OpenTenBase首亮相,腾讯云数据库开源取得重大突破
开放原子校源行走进西部,加速开源人才培养
开源数据库OpenTenBase获信通院“OSCAR尖峰开源项目优秀案例”奖
开放原子开源基金会赴黑龙江科技大学走访交流

博客和文章

博客和文章
快速入门

过去的活动

history_events

Tencent is pleased to support the open source community by making OpenTenBase available. Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. OpenTenBase is licensed under the BSD 3-Clause License, except for the third-party component listed below. A copy of the BSD 3-Clause License is included in this file. Other dependencies and licenses: Open Source Software Licensed Under the PostgreSQL License: -------------------------------------------------------------------- 1. Postgres-XL XL9_5_STABLE Portions Copyright (c) 2015-2016, 2ndQuadrant Ltd Portions Copyright (c) 2012-2015, TransLattice, Inc. Portions Copyright (c) 2010-2017, Postgres-XC Development Group Portions Copyright (c) 1996-2015, The PostgreSQL Global Development Group Portions Copyright (c) 1994, The Regents of the University of California Terms of the PostgreSQL License: -------------------------------------------------------------------- Permission to use, copy, modify, and distribute this software and its documentation for any purpose, without fee, and without a written agreement is hereby granted, provided that the above copyright notice and this paragraph and the following two paragraphs appear in all copies. IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. Terms of the BSD 3-Clause License: -------------------------------------------------------------------- Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither the name of THL A29 Limited nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

简介

OpenTenBase 是一个提供写可靠性,多主节点数据同步的关系数据库集群平台 展开 收起
BSD-3-Clause
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C/C++
1
https://gitee.com/mirrors/OpenTenBase.git
git@gitee.com:mirrors/OpenTenBase.git
mirrors
OpenTenBase
OpenTenBase
master

搜索帮助

344bd9b3 5694891 D2dac590 5694891