Oracle_12c_Sharding cluster installation tutorial

Oracle Sharding Oracle 12.2 is introduced a new version of the feature, also called data piece for online transaction processing (OLTP). Oracle Sharding table based partitioning technique, is a data layer in the horizontal partition data stored in the database to a different technology. Sharding can be implemented in different databases, each database server located on a different partition table stored in different partitions, each shard is called a database, which form a logical database shard referred sharded database (SDB). this table also known sharded table, each shard hold different data sets in the database table (partition according sharding key), but they have the same column (columns).

Oracle Sharding advantages:
Oracle Sharding technology provides linear scaling and failure isolation advantages:

  • Linear expansion: Because each shard is a separate database, Shard by adding new nodes to the linear scalability. Automatically rebalance data.

  • Failure isolation: As the Shard is a shared-nothing technology, each shard using a separate hardware, so a shard node fails, it will only affect the data stored in this shard, without affecting the other shard.

  • Geographically distributed data: can be selected depending on the geographic location, the data is stored in a different shard.

  • Rolling upgrade: Select Upgrade at different times different shard. For example, at the same time upgrade only one or a part shard, only the data stored in these upgrades shard is affected, the other shard is not affected, can continue to provide services.

  • Cloud deployment: Shard ideal for deployment in the cloud.

12c new features -Oracle Sharding Profile

Oracle 12c realese2 installation tutorial

Oracle Download

Oracle Download

Stand-alone node

1
2
10.244.4.30 1521 SID=orcl
user:system password:oracle

shard cluster information

1
2
3
4
5
6
7
8
9
10
11
12
master:
100.88.11.91 1521 SID=catadb
user:app_schema password:oracle
sysdba:oracle

shard1:
100.88.11.96 1521 SID=sh1
user:app_schema password:oracle

shard2:
100.88.8.49 1521 SID=sh2
user:app_schema password:oracle

single vision

1. Create the oracle user and the oinstall user groups

Oracle create users and user groups oinstall

1
2
3
4
5
sudo groupadd oinstall
sudo groupadd dba
sudo groupadd oper
sudo useradd -g oinstall -G dba,oper oracle
sudo passwd oracle

Create the oracle installation directory

1
2
[oracle] mkdir -p ~/u01/app
[oracle] chown oracle:oinstall -R ~/u01

Before you create must use df -hto view the next disk partition, select the appropriate installation directory, the best remaining disk space is larger than 20G, under development machine / directory only 50G space, does not recommend the oracle installation directory in the / directory.

2. Set swap partition

free -m Check swap partition case

The method of setting swap partition (512M)

1
2
3
4
5
6
sudo dd if=/dev/zero of=/swapfile1 bs=1024k count=512
sudo mkswap /swapfile1
sudo swapon /swapfile1

sudo swapoff / swapfile # disabling the swap file
sudo rm / swapfile # delete files

3.vnc Configuration

By vnc can use the graphical interface to install oracle, greatly improving the success rate of installation

1
2
sudo yum install tigervnc-server -y
sudo yum install -y xterm

vnc Operating Guide

server open vnc: vncserver :1
server stop vnc:vncserver -kill :1

Vnc client Download
client connection methods:IP:开启的端口号

TIPS:
1, if vnc shell window does not appear, check the server is installed xterm
2, if a more graphical interface, install the gnome

4. Installation oracle 12c dependencies

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
sudo yum install -y binutils*
sudo yum install -y compat-libcap1*
sudo yum install -y compat-libstdc++*
sudo yum install -y glibc*
sudo yum install -y glibc-devel*
sudo yum install -y ksh*
sudo yum install -y libX11*
sudo yum install -y libXau*
sudo yum install -y libXi*
sudo yum install -y libXtst*
sudo yum install -y libaio*
sudo yum install -y libaio-devel*
sudo yum install -y libgcc*
sudo yum install -y libstdc++*
sudo yum install -y libstdc++-devel*
sudo yum install -y libxcb*
sudo yum install -y make*
sudo yum install -y net-tools*
sudo yum install -y nfs-utils*
sudo yum install -y smartmontools*
sudo yum install -y sysstat*
sudo yum install -y unixODBC*
sudo yum install -y binutils*686*
sudo yum install -y compat-libcap1*686*
sudo yum install -y compat-libstdc++*686*
sudo yum install -y glibc*686*
sudo yum install -y glibc-devel*686*
sudo yum install -y ksh*686*
sudo yum install -y libX11*686*
sudo yum install -y libXau*686*
sudo yum install -y libXi*686*
sudo yum install -y libXtst*686*
sudo yum install -y libaio*686*
sudo yum install -y libaio-devel*686*
sudo yum install -y libgcc*686*
sudo yum install -y libstdc++*686*
sudo yum install -y libstdc++-devel*686*
sudo yum install -y libxcb*686*
sudo yum install -y make*686*
sudo yum install -y net-tools*686*
sudo yum install -y nfs-utils*686*
sudo yum install -y smartmontools*686*
sudo yum install -y sysstat*686*
sudo yum install -y unixODBC*686*

5.开始安装

通过vnc连接server,在安装目录下执行 ./runInstaller
安装过程具体每一步操作参考: 大专栏  Oracle_12c_Sharding集群安装教程ntq.net/2017/04/18/install-db12c-ol73/#%E6%93%8D%E4%BD%9C%E7%B3%BB%E7%BB%9F%E8%AE%BE%E7%BD%AE" target="_blank" rel="noopener noreferrer">Oracle Linux 7.3 下安装 Oracle Database 12c R2

Oracle环境变量

1
2
3
4
export ORACLE_BASE=/home/oracle/u01/app
export ORACLE_HOME=/home/oracle/u01/app/product/12.2.0/dbhome_1
export PATH=$ORACLE_HOME/bin:$PATH
export ORACLE_SID=catadb

Listener开启和关闭方法

1
2
lsnrctl start
lsnrctl stop

TIPS: 如果遇到sqlplus command not found lsnrctl command not found,检查下环境变量是否失效

创建Oracle实例的方法: 执行 $ORACLE_HOME/bin/dbca

Sharding集群版

1.节点需要安装的服务

Master节点: Oracle RDMS,GSM
Slave节点: Oracle RDMS

Oracle安装Singleinstance database installation版本,安装好之后仅仅在Master节点创建实例(非non-cdb

slave节点可采用响应文件进行静默安装 ./runInstaller -silent -responseFile /home/oracle/db.rsp

安装详细过程过程参考

2.配置hosts和防火墙

配置SDB与各个shard节点的host

1
2
3
100.88.11.91 OceanBase088011091.gtjsqa OceanBase088011091
100.88.11.96 OceanBase088011096.gtjsqa OceanBase088011096
100.88.8.49 OceanBase008049.gtjsqa OceanBase008049

关闭防火墙,开发机上默认是关闭的,最好检查一下

1
2
sudo service iptables status
sudo service iptables stop

3.Shard配置流程

  • 环境变量

    Oracle

    1
    2
    3
    4
    export ORACLE_BASE=/home/oracle/u01/app
    export ORACLE_HOME=/home/oracle/u01/app/product/12.2.0/dbhome_1
    export PATH=$ORACLE_HOME/bin:$PATH
    export ORACLE_SID=catadb

    GSM

    1
    2
    3
    export ORACLE_BASE=/home/oracle/u01/app
    export ORACLE_HOME=/home/oracle/u01/app/product/12.2.0/gsmhome_1
    export PATH=$PATH:$HOME/bin:$ORACLE_HOME/bin
  • 在master服务器(catalog 数据库/shard director),连接到Sharding catalog数据库, 解锁 GSMCATUSER 用户,shard director 通过GSMCATUSER 用户连接到shard catalog database

    1
    SQL> alter user gsmcatuser identified by oracle account unlock;
  • 在 catalog数据库,创建管理用户mygds,用户mygds用于存储Sharding管理信息,GDSCTL接口通过用户mygds连接到catalog数据库

    1
    2
    3
    4
    SQL> create user mygds identified by oracle;
    SQL> grant connect, create session, gsmadmin_role to mygds;
    SQL> grant inherit privileges on user SYS to GSMADMIN_INTERNAL;
    SQL> exec DBMS_SCHEDULER.SET_AGENT_REGISTRATION_PASS('oracle');
  • 在gsm1服务器(catalog 数据库/shard director),创建shard catalog,在shard catalog中配置remote scheduler agent

    1
    2
    3
    $ gdsctl
    GDSCTL> create shardcatalog -database OceanBase088011091:1521:catadb -chunks 12 -user mygds/oracle -sdb shdb -region region1, region2 -agent_port 8080 -agent_password oracle
    Catalog is created
  • 创建和启动shard director

    1
    2
    3
    4
    5
    6
    7
    8
        GDSCTL> add gsm -gsm sharddirector3 -listener 1522 -pwd oracle -catalog OceanBase088011091:1521:catadb -region region1
    GSM successfully added

    GDSCTL>start gsm -gsm sharddirector3
    GSM is started successfully

    GDSCTL> add credential -credential cre_reg1 -osaccount oracle -ospassword oracle
    The operation completed successfully
  • 去shard节点上进行注册

    1
    2
    3
    4
    5
    $ schagent -start
    Scheduler agent started using port 21620
    $ schagent -status
    $ echo oracle | schagent -registerdatabase 100.88.11.91 8080
    $ lsnrctl stop
**一定要关闭shard节点上的监听器**
  • deploy shard

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
        $ gdsctl
    GDSCTL> set gsm -gsm sharddirector3

    GDSCTL> connect mygds/oracle
    Catalog connection is established

    GDSCTL> add shardgroup -shardgroup primary_shardgroup -deploy_as primary -region region1
    The operation completed successfully

    GDSCTL> add invitednode OceanBase088011096

    GDSCTL> create shard -shardgroup primary_shardgroup -destination OceanBase088011096 -credential cre_reg1 -sys_password oracle
    The operation completed successfully
    DB Unique Name: sh1

    GDSCTL> deploy
查看shard配置 `config shard`
查看invitednode `config vncr`
删除shard配置 `remove shard -shard sh1`
删除invitednode `remove invitednode oceanbase004085`

看到如下信息,说明shard集群已经搭建成功


  
  
1
2
3
4
5
6
    GDSCTL>config shard
Catalog connection is established
Name Shard Group Status State Region Availability
---- ----------- ------ ----- ------ ------------
sh1 primary_shardgroup Ok Deployed region1 ONLINE
sh2 primary_shardgroup Ok Deployed region1 ONLINE

3.注意事项

下面是我安装过程中碰到的坑

  • 安装Oracle过程中会检查安装条件,ignore即可
  • slave节点安装好Oracle后,关闭Listener,否则deploy过程中会报错
  • add shard过程中,如果遇到destination not found错误,检查节点上Hosts文件配置,确保各个节点上可以ping通
  • deploy过程中十分缓慢(10分钟至20分钟),成功或者错误都会返回信息

如果还碰到困难参考下面帖子:

Guess you like

Origin www.cnblogs.com/sanxiandoupi/p/11698674.html