随着IT信息化的发展。现在数据中心的规模越来越大,对管理员的要求也越来越高。同时,用户希望快速访问始终在线的服务,因此对于企业来说,部署和维护必须高效且对业务运行无干扰。为了跟上步伐,必须减少运维复杂性和手动参与的步骤。Oracle RHP (Rapid Home Provisioning) 的解决方案标准化、简化了软件分发和管理。自动化和高效率是她的特点,她最小化了对大规模部署的影响。
Rapid Home Provisioning (RHP) 代表了一种标准的方法,以统一的方式,在软件基础设施的所有体系结构层 (Oracle Database和其他第三方定制软件) 上进行部署、补丁、升级、迁移等工作,尤其是Oracle集群、数据库的部署、升级、补丁、迁移,以及集群节点的伸缩等操作非常便捷。
RHP可以理解成一个独立的集群(仅安装GI即可)。RHP服务是Grid Infrastructure的一部分。Oracle Clusterware会管理RHP的相关组件。这些组件包括RHP Server自身、GNS、一个用于支持HA-NFS的VIP(不论是否使用NFS来存储workingcopy,都是必须的)和用于存储workingcopy快照的ASM集群文件系统(ACFS)。在日常操作中,通过RHP部署的客户端或目标端不依赖于RHP服务。因此,即使RHP服务不可用,已经部署的home不会受到影响。
Rapid Home Provisioning (RHP) 是一种部署软件HOME的方法。我们可以从已安装的HOME中创建Image,并存储和管理,Oracle称之为“Gold Image”。DBA可以在这个“Gold Image”上制作副本(workingcopy),然后把这些副本供应到数据中心的所有目标端。
RHP的相关元数据存储在Grid Infrastructure Management Repository。Management Database MGMTDB在安装Grid infrastructure时会被创建。
RHP的特点和功能
RHP提供集中的软件部署和维护。软件只需要安装一次,然后存储在RHP服务器上,并且从那里可以随时向数据中心的任何节点或集群供应。主要特征包括:管理现有部署,不需要任何更改、不需要重新配置、也不需要代理或守护程序。
流程自动化,减少人工参与的步骤RHP的基本功能
简化了数据库相关的安装部署、修补和升级
最大限度地减少维护的影响和风险
支持大规模部署
Gold Images集中存储,包括GI、DB、应用、中间件等RHP架构图
支持安装和配置新的集群和数据库
最小化维护窗口
一条命令就能搞定安装、补丁或升级
内置了还原和从失败点继续的能力执行
支持自定义工作流
提供审计日志
支持所有部署模型——物理机器、虚拟化、容器、Oracle多租户
RHP (Rapid Home Provisioning) 服务依赖于Grid Infrastructure。她存储和管理了很多ORACLE_HOME的模板,我们称之为“Gold Images”。 您可以向数据中心中的任何节点部署基于“Gold Images”的副本(working copy实际上就是基于Gold Image部署的ORACLE HOME)。RHP支持Oracle Home、Oracle Database、Grid Infrastructure、和新集群(前提是需要操作系统和网络已配置好)的部署,以及GI、DB的升级和迁移等,还支持第三方的软件。
RHP可以管理其集群自身,12.2.0.1或更高版本的Rapid Home Provisioning Clients,还可以管理通过RHP Service部署的Oracle Grid Infrastructure 11gR2 (11.2.0.4) 和12cR1 (12.1.0.2) ,称为Clientless Targets部署。RHP还可以管理在Oracle Restart上运行的单实例数据库以及没有集群软件的服务器。总之一句话,只要是11.2.0.4及以上的无论是集群还是单实例都可以管理,前提是必须通过RHP部署部署。
下面的架构图描述的是通过RHP Server部署11.2、12.1、12.2、18c target,这些称为Managed target。还有一些未连接的18c target,这些不是通过RHP Server部署的,称之为Unmanaged target,不能通过RHP管理。由于这些不是通过RHP Server部署的,所以RHP也无法直接管理。下面会介绍目标端、RHP客户端,注意这些都不是必须的。
目标端(no RHP Client)
没有运行Oracle Grid Infrastructure RHP Client的目标称为Clientless Targets。这些目标不能发起与RHP Service的通信,只能从RHP Service端进行管理。这些目标可以运行网格基础设施11.2.0.4/12.1.0.2/12.2.0.1,或者没有安装GI,只运行了单实例的Oracle实例数据库,或者是安装Oracle Restart等。SSH协议用于RHPS和目标之间的通信。
RHP客户端(RHP Client)
RHP Client进程是一个集群中的HA资源,运行在集群的一个节点中,并处理来自RHP Service的请求。能够与客户端交互,并在没有凭据的情况下执行预期的任务。此外,客户端可以在本地启动许多任务。在启动时,客户机-服务器进程之间建立一个经过身份验证的通信通道并保持连接,称为JMX通信通道。这需要在RHP Service和RHP Client上都打开端口来建立这个通道。
如何配置RHP Server
从18c开始,在安装GI的时候,RHP Server是默认被安装的,使用的是本地模式。也就是下面的输出,只有move命令。如果只想在本地模式下使用,也可以不配置RHP Server。
本地模式下的输出
[orgrid@ohs1 ~]$ rhpctl Usage: rhpctl <command> <object> [<options>] commands: move objects: database|gihome For detailed help on each command and object and its options use: rhpctl <command> <object> -help [orgrid@ohs1 ~]$
服务器模式下的输出(如果是这种模式,请忽略下面的步骤)
[orgrid@ohs1 ~]$ rhpctl Usage: rhpctl <command> <object> [<options>] commands: add|addnode|allow|delete|deleteimage|deletenode|disallow|discover|export|grant|import|insertimage|instantiate|modify|move|promote|query|register|revoke|subscribe|uninstantiate|unregister|unsubscribe|upgrade|verify|enable|disable|collect|deploy objects: audit|client|credentials|database|gihome|image|imagetype|job|node|osconfig|peerserver|role|series|server|user|useraction|workingcopy For detailed help on each command and object and its options use: rhpctl <command> <object> -help [orgrid@ohs1 ~]$
下图记录了在已安装18c(18.3)集群上建立RHP Server的详细步骤。
ohs1和ohs2是已安装18c的集群,其中RHP Client不是可选的。
停止RHP Server [orgrid@ohs1 ~]$ srvctl stop rhpserver [orgrid@ohs1 ~]$ srvctl remove rhpserver PRCN-2018 : Current user orgrid is not a privileged user [orgrid@ohs1 ~]$ which srvctl /pgold/orgrid/oracle/product/183/bin/srvctl [orgrid@ohs1 ~]$ su - Password:
移除RHP Server [root@ohs1 ~]# /pgold/orgrid/oracle/product/183/bin/srvctl remove rhpserver [root@ohs1 ~]#
增加RHP Server [root@ohs1 ~]# /pgold/orgrid/oracle/product/183/bin/srvctl add rhpserver -storage /rhpstorage -diskgroup DATA -verbose ohs1.ohsdba.cn: Creating a new volume... ohs1.ohsdba.cn: Checking for the existence of file system... ohs1.ohsdba.cn: Creating a new ACFS file system... ohs1.ohsdba.cn: Starting the ACFS file system... ohs1.ohsdba.cn: Creating authentication keys... [root@ohs1 ~]# su – orgrid Note:/rhpstorage会被自动创建
启动RHP Server [root@ohs1 ~]# /pgold/orgrid/oracle/product/183/bin/srvctl start rhpserver [root@ohs1 ~]# /pgold/orgrid/oracle/product/183/bin/srvctl status rhpserver Rapid Home Provisioning Server is enabled Rapid Home Provisioning Server is running on node ohs1
查看RHP Server配置 [root@ohs1 ~]# /pgold/orgrid/oracle/product/183/bin/srvctl config rhpserver Storage base path: /rhpstorage Disk Groups: DATA Port number: 23795 Transfer port range: Rapid Home Provisioning Server is enabled Rapid Home Provisioning Server is individually enabled on nodes: Rapid Home Provisioning Server is individually disabled on nodes: Email address: Mail server address: Mail server port: Transport Level Security disabled HTTP Secure is enabled [orgrid@ohs1 ~]$ df -h Filesystem Size Used Avail Use% Mounted on /dev/mapper/vg_ohs-lv_root 50G 5.1G 42G 11% / tmpfs 2.4G 1.1G 1.3G 46% /dev/shm /dev/sda1 477M 84M 368M 19% /boot /dev/mapper/vg_ohs-lv_pgold 537G 23G 487G 5% /pgold /dev/asm/ghchkpt-33 5.5G 784M 4.8G 14% /rhpstorage/chkbase /dev/asm/ghvol464715-33 12G 5.7G 6.4G 47% /rhpstorage/images/iDB112957258 /dev/asm/ghvol895499-33 22G 12G 11G 51% /rhpstorage/images/iDB183271079 [orgrid@ohs1 ~]$
增加HAVIP [root@ohs1 ~]# /pgold/orgrid/oracle/product/183/bin/srvctl add havip -id havip -address 192.168.56.6
rhpctl命令行
RHP是从12.1开始引入的,也只有在GI下面才有,文件名是rhpctl。在这个版本,如果要通过rhpctl部署软件HOME,必须是配置了RHP Client才可以。到了12.2,在没有RHP Client客户下,也可以部署。从18c开始,没有安装GI也可以使用(也可以说在单实例下面也可以使用),从数据库的HOME下我们能找到rhpctl这命令。
版本 |
GI_HOME(rhpctl) |
DB_HOME(rhpctl) |
RHP是否 默认安装 |
是否需要配置 RHP Client才部署 |
DB是否支持 本地move |
12.1 |
有 |
无 |
否 |
是 |
否 |
12.2 |
有 |
无 |
否 |
否 |
否 |
18c |
有 |
有 |
是 |
否 |
是 |
[root@ohs1 ~]# rhpctl -h
Performs Rapid Home Provisioning operations and manages Rapid Home Provisioning Servers and Clients. Usage: rhpctl add Adds a resource, type or other entity. rhpctl addnode Adds nodes or instances of specific resources. rhpctl addpdb Adds a pluggable database to the specified multitenant container database. rhpctl allow Allows access to the image, series or image type. rhpctl collect Collects backup of operating system configuration for the cluster. rhpctl compare Compares operating system configurations for the specified cluster. rhpctl delete Deletes a resource, type or other entity. rhpctl deleteimage Deletes an image from a series. rhpctl deletenode Deletes nodes or instances of specific resources. rhpctl deletepdb Removes a pluggable database from the specified multitenant container database. rhpctl deploy Deploys OS image for the cluster. rhpctl disable Disables the scheduled daily backup of operating system configuration for the cluster. rhpctl disallow Disallows access to the image, series or image type. rhpctl discover Validates and discovers parameters to generate a response file. rhpctl enable Enables the scheduled daily backup of operating system configuration for the cluster. rhpctl export Exports data from the repository to a client or server data file. rhpctl grant Grants a role to a client user. rhpctl import Creates a new image from the specified path. rhpctl insertimage Inserts a new image into a series. rhpctl instantiate Requests images from another server. rhpctl modify Modifies a resource, type or other entity. rhpctl move Moves a resource from a source path to a destination path. rhpctl promote Promotes an image. rhpctl query Gets information of a resource, type or other entity. rhpctl recover Recovers a node after its failure. rhpctl register Registers an image, user or server. rhpctl replicate Replicate image from server to a specified client. rhpctl revoke Revokes a role of a client user. rhpctl subscribe Subscribes the specified user to an image series. rhpctl uninstantiate Stops updates for previously requested images from another server. rhpctl unregister Unregisters an image, user or server. rhpctl unsubscribe Unsubscribes the specified user to an image series. rhpctl upgrade Upgrades a resource. rhpctl verify Validates and creates or completes a response file. rhpctl zdtupgrade Performs zero downtime upgrade of a database. For detailed help on each command use: rhpctl <command> -help [root@ohs1 ~]#
RHP的“Gold Image”和“workingcopy”
RHP最基本的操作,一个是创建“Gold Image”,一个是创建“workingcopy”。
每个 “Gold Image”都代表一个HOME,可以是Oracle数据库HOME、Grid Infrastructure HOME或任何其他软件HOME。应用程序不会直接在“Gold Image”上运行。可以从“Gold Image”上创建副本(working copy),然后在这些workingcopy上运行。“Gold Image”可以从RHP服务上安装的HOME、RHP Client或数据中心中的任何节点导入。Gold Image还可以在RHP服务之间共享。默认的状态是PUBLISHED,在创建image的时候可以指定参数-state来设置状态,之后还可以通过“promote image”命令来改变状态。
有多种方式来创建“Gold Images”
一个是“import image”,
一个是“add image”,
一个是“register image”(这个在白皮书中暂时没找到说明)
“add image”用于从workingcopy中创建副本。并且这个workingcopy是在RHP服务端上,并且部署时的存储选项是RHP_MANAGED。通过这个还可以节省存储空间。这个在后面会有介绍。
支持import image的Database 和 GI 版本为11.2.0.4, 12.1.0.2, and 12.2.0.1。请记住,数据中心中的任何家HOME都可以作为“gold images”导入,因此您可以选择哪些image作为标准化部署基础。
Image状态和访问
RHP允许您定义Image的状态PUBLISHED、RESTRICTED、TESTABLE(发布的、可测试的或受限的三种),来实现Image的生命周期管理。此外,还可以在角色和特定用户级别控制对给定映像的访问。
Workingcopy
只要是通过rhpctl部署的HOME(就是wokingcopy)都属于被托管(managed)的,不是通过rhpctl部署的HOME都统称为非托管(unmanaged)的。例如,在一个非托管的HOME下,在补丁或升级过程中,可以通过rhpctl部署新的HOME,然后通过rhpctl做升级或迁移,非托管(unmanaged)的HOME可以很容易的切换到被托管(managed),纳入RHP的管理框架。
打补丁方式的改变
之前打补丁的操作以及后续步骤,现在通过下面的两条命令就可以搞定了
1. rhpctl add workingcopy
2. rhpctl move database
部署新集群或数据库就是这么简单
只要操作系统、相关安装包和网络配置好。在RHP服务端通过下面的三个命令就可以快速的部署一个新集群,包含数据库。
通过RHP部署和升级体验
下面是原始环境的信息。我们通过在RHP Server ohs1上导入ood 11204的ORACLE_HOME,在ohs1上导入183的ORACLE HOME。然后在ohs1上通过RHP为ohs部署11204的ORACLE_HOME,并创建数据库,然后再部署183的ORACLE_HOME,最后将11204的数据库升级都183。
OS Server |
ohs1,ohs2 RHP Server |
ood |
ohs |
GI HOME |
/pgold/orgrid/oracle/product/183 |
N/A |
N/A |
Database HOME |
/pgold/ordb/oracle/product/183 |
/u01/app/oracle/product/11204 |
N/A |
18c在本地模式下通过rhpctl move切换ORACLE HOME
注意:move只适合于大版本相同,小版本不同的情况。比如这里是介绍从Oracle 18.2切换到18.3。
查看情况环境
[oracle@sdb09] /home/oracle> env |grep ORACLE ORACLE_BASE=/u01/app/oracle ORACLE_HOME=/u01/app/oracle/product/18.0.0/dbhome_1 ORACLE_HOSTNAME=sdb09 ORACLE_PATH=/home/oracle/scripts ORACLE_SID=cdb2 ORACLE_UNQNAME=cdb2 [oracle@sdb09] /home/oracle> sqlplus "/as sysdba" SQL*Plus: Release 18.0.0.0.0 - Production on Tue Jul 24 16:43:00 2018 Version 18.2.0.0.0 Copyright (c) 1982, 2018, Oracle. All rights reserved. Connected to: Oracle Database 18c Enterprise Edition Release 18.0.0.0.0 - Production Version 18.2.0.0.0 CDB$ROOT@cdb2>show pdbs CON_ID CON_NAME OPEN MODE RESTRICTED ---------- ------------------------------ ---------- ---------- 2 PDB$SEED READ ONLY YES 3 PDB2 READ WRITE NO CDB$ROOT@cdb2>exit Disconnected from Oracle Database 18c Enterprise Edition Release 18.0.0.0.0 - Production Version 18.2.0.0.0 [oracle@sdb09] /home/oracle>安装18.3 ORACLE HOME
18.3 ORACLE_HOME的安装(略)
注意:这里是本地模式,就不能通过rhpctl add workingcopy来部署183的ORACLE HOME了
执行rhpctl move database
一条命令搞定,真的很简单。在18.2下执行rhpctl move database
[oracle@sdb09] /home/oracle> rhpctl move database -dbname cdb2 \
> -sourcehome /u01/app/oracle/product/18.0.0/dbhome_1 \
> -desthome /u01/app/oracle/product/18.0.0/dbhome_3 \
> -stopoption IMMEDIATE
Running RHPCTL for Stand Alone Home SQL*Plus: Release 18.0.0.0.0 - Production on Tue Jul 24 16:46:23 2018 Version 18.2.0.0.0 Copyright (c) 1982, 2018, Oracle. All rights reserved. Connected to: Oracle Database 18c Enterprise Edition Release 18.0.0.0.0 - Production Version 18.2.0.0.0 SQL> Database closed. Database dismounted. ORACLE instance shut down. SQL> Disconnected from Oracle Database 18c Enterprise Edition Release 18.0.0.0.0 - Production Version 18.2.0.0.0 SQL*Plus: Release 18.0.0.0.0 - Production on Tue Jul 24 16:46:55 2018 Version 18.3.0.0.0 Copyright (c) 1982, 2018, Oracle. All rights reserved. Connected to an idle instance. SQL> ORACLE instance started. Total System Global Area 1073741304 bytes Fixed Size 8904184 bytes Variable Size 771751936 bytes Database Buffers 289406976 bytes Redo Buffers 3678208 bytes Database mounted. Database opened. SQL> Disconnected from Oracle Database 18c Enterprise Edition Release 18.0.0.0.0 - Production Version 18.3.0.0.0 /u01/app/oracle/product/18.0.0/dbhome_3 cdb2 SQL Patching tool version 18.0.0.0.0 Production on Tue Jul 24 16:47:19 2018 Copyright (c) 2012, 2018, Oracle. All rights reserved. Log file for this invocation: /u01/app/oracle/cfgtoollogs/sqlpatch/sqlpatch_533_2018_07_24_16_47_19/sqlpatch_invocation.log Connecting to database...OK Gathering database info...done Note: Datapatch will only apply or rollback SQL fixes for PDBs that are in an open state, no patches will be applied to closed PDBs. Please refer to Note: Datapatch: Database 12c Post Patch SQL Automation (Doc ID 1585822.1) Bootstrapping registry and package to current versions...done Determining current state...done Current state of interim SQL patches: Interim patch 27923415 (OJVM RELEASE UPDATE: 18.3.0.0.180717 (27923415)): Binary registry: Installed PDB CDB$ROOT: Rolled back with errors on 24-JUL-18 04.30.06.505223 PM PDB PDB$SEED: Rolled back with errors on 24-JUL-18 04.30.06.873780 PM PDB PDB2: Rolled back with errors on 24-JUL-18 04.30.07.119076 PM Current state of release update SQL patches: Binary registry: 18.3.0.0.0 Release_Update 1806280943: Installed PDB CDB$ROOT: Rolled back to 18.2.0.0.0 Release_Update 1804041635 successfully on 24-JUL-18 04.30.06.555634 PM PDB PDB$SEED: Rolled back to 18.2.0.0.0 Release_Update 1804041635 successfully on 24-JUL-18 04.30.06.951502 PM PDB PDB2: Rolled back to 18.2.0.0.0 Release_Update 1804041635 successfully on 24-JUL-18 04.30.07.155698 PM Adding patches to installation queue and performing prereq checks...done Installation queue: For the following PDBs: CDB$ROOT PDB$SEED PDB2 No interim patches need to be rolled back Patch 28090523 (Database Release Update : 18.3.0.0.180717 (28090523)): Apply from 18.2.0.0.0 Release_Update 1804041635 to 18.3.0.0.0 Release_Update 1806280943 The following interim patches will be applied: 27923415 (OJVM RELEASE UPDATE: 18.3.0.0.180717 (27923415)) Installing patches... Patch installation complete. Total patches installed: 6 Validating logfiles...done Patch 28090523 apply (pdb CDB$ROOT): SUCCESS logfile: /u01/app/oracle/cfgtoollogs/sqlpatch/28090523/22329768/28090523_apply_CDB2_CDBROOT_2018Jul24_16_49_17.log (no errors) Patch 27923415 apply (pdb CDB$ROOT): SUCCESS logfile: /u01/app/oracle/cfgtoollogs/sqlpatch/27923415/22239273/27923415_apply_CDB2_CDBROOT_2018Jul24_16_51_54.log (no errors) Patch 28090523 apply (pdb PDB$SEED): SUCCESS logfile: /u01/app/oracle/cfgtoollogs/sqlpatch/28090523/22329768/28090523_apply_CDB2_PDBSEED_2018Jul24_16_52_15.log (no errors) Patch 27923415 apply (pdb PDB$SEED): SUCCESS logfile: /u01/app/oracle/cfgtoollogs/sqlpatch/27923415/22239273/27923415_apply_CDB2_PDBSEED_2018Jul24_16_55_08.log (no errors) Patch 28090523 apply (pdb PDB2): SUCCESS logfile: /u01/app/oracle/cfgtoollogs/sqlpatch/28090523/22329768/28090523_apply_CDB2_PDB2_2018Jul24_16_52_16.log (no errors) Patch 27923415 apply (pdb PDB2): SUCCESS logfile: /u01/app/oracle/cfgtoollogs/sqlpatch/27923415/22239273/27923415_apply_CDB2_PDB2_2018Jul24_16_55_01.log (no errors) SQL Patching tool complete on Tue Jul 24 16:55:24 2018 [oracle@sdb09] /home/oracle>
Reference
https://www.oracle.com/technetwork/database/database-cloud/private/index.html
https://www.oracle.com/assets/rapid-home-provisioning-2405191.pdf
https://blogs.oracle.com/db_maintenance/rapid-home-provisioning-simplifies-oracle-database-estate-management
https://blogs.oracle.com/db_maintenance/whats-new-in-122-for-rapid-home-provisioning-and-maintenance
https://blogs.oracle.com/db_maintenance/rapid-home-provisioning-and-maintenance-whats-new-in-18c
https://www.oracle.com/technetwork/database/database-cloud/private/rhp-datasheet-2529714.pdf
https://docs.oracle.com/en/database/oracle/oracle-database/18/sprhp/rapid-home-provisioning-use-cases.html
https://docs.oracle.com/en/database/oracle/oracle-database/18/sprhp/rhp_upgrading-oracle-database-12c-release-2.html
12.1 Reference
https://docs.oracle.com/database/121/CWADD/GUID-CCEC5960-EDA4-4A3F-9643-0CA308EA49AA.htm#CWADD92402
https://docs.oracle.com/database/121/CWADD/GUID-CDF55B0E-85FE-48A6-9329-EC3D78252F29.htm#CWADD-GUID-CDF55B0E-85FE-48A6-9329-EC3D78252F29
12.2 Reference
https://docs.oracle.com/en/database/oracle/oracle-database/12.2/cwadd/rapid-home-provisioning.html#GUID-CCEC5960-EDA4-4A3F-9643-0CA308EA49AA
https://docs.oracle.com/en/database/oracle/oracle-database/12.2/cwadd/rapid-home-provisioning-and-server-control-command-reference.html#GUID-CDF55B0E-85FE-48A6-9329-EC3D78252F29
18c Reference
https://docs.oracle.com/en/database/oracle/oracle-database/18/cwadd/rapid-home-provisioning.html#GUID-CCEC5960-EDA4-4A3F-9643-0CA308EA49AA
https://docs.oracle.com/en/database/oracle/oracle-database/18/cwadd/rapid-home-provisioning-and-server-control-command-reference.html#GUID-66345667-F035-4ADB-A25F-5530299E04B7
https://docs.oracle.com/en/database/oracle/oracle-database/18/sprhp/deploying-and-managing-oracle-software-using-rapid-home-provisioning.pdf
2126710.1 RHP: Rapid Home Provisioning Server - Minimum Requirement
2097026.1 How to Setup a Rapid Home Provisioning (RHP) Server and Client2124960.1 Rapid Home Provisioning (RHP) setup in 1-Click