搭建HA的基礎(chǔ)設(shè)施環(huán)境:
兩臺Windows Server 2016的服務器A和B;
A的內(nèi)網(wǎng)IP為internal_ipaddress1,外網(wǎng)IP為external_ipaddress1;
B的內(nèi)網(wǎng)IP為internal_ipaddress2,外網(wǎng)IP為external_ipaddress2;
一臺Windows Server 2016數(shù)據(jù)庫服務器C,內(nèi)網(wǎng)IP為internal_ipaddress3;
一臺負載均衡Load Balancer,外網(wǎng)IP為external_ipaddress4;
一臺Windows Server作為文件共享服務器D,外網(wǎng)IP為external_ipaddress5;
一、安裝Oracle數(shù)據(jù)庫(Windows)
1、以管理員身份運行安裝程序;

2、打開安裝程序后,跟著安裝向?qū)?,選默認選擇“創(chuàng)建并配置單實例數(shù)據(jù)庫”,下一步;
3、選擇安裝桌面類,下一步;
4、選擇使用虛擬賬戶,下一步;
5、設(shè)置基目錄,文件目錄,也可以選擇默認,設(shè)置口令。注意:不能勾選“創(chuàng)建為容器數(shù)據(jù)庫”;

6、接下來一步一步默認執(zhí)行即可。
二、配置Oracle數(shù)據(jù)庫
1、檢查監(jiān)聽端口1521是否打開
打開防火墻的入站規(guī)則 TCP 1521端口;
用管理員身份運行CMD命令行;
執(zhí)行lsnctl status命令,查看監(jiān)聽端口;
執(zhí)行netstat -ano | findstr 1521命令,檢查是否端口已經(jīng)啟動;

如果監(jiān)聽端口有錯誤,可以手工啟動Oracle Net Configuration Assistant程序,刪除原有的監(jiān)聽配置,再手工新增一個監(jiān)聽配置。修改后,使用lsnrctl stop和lsnrctl start命令,重啟監(jiān)聽服務。
2、建立數(shù)據(jù)庫表空間、用戶及用戶權(quán)限
用管理員身份運行CMD命令行,運行sqlplus / as sysdba命令,進入SQL命令狀態(tài)。執(zhí)行命令行,創(chuàng)建兩個數(shù)據(jù)庫空間和用戶,一個是為了control Room,一個是為了Bot Insight:
Control Room的表空間和用戶,假定表空間名為crdb1,用戶名和密碼都為crdb1
create bigfile TABLESPACE crdb1 datafile 'C:\INSTALL\ORADATA\ORCL\crdb1.dbf' SIZE 4096M;
create user crdb1 identified by crdb1 default tablespace CRDB1;
grant connect to crdb1;
grant resource to crdb1;
grant select any dictionary to crdb1;
grant select any dictionary to crdb1;
grant select any table to crdb1;
grant select any table to crdb1;
grant flashback any table to crdb1;
grant alter any table to crdb1;
grant alter session to crdb1;
grant execute on dbms_flashback to crdb1;
grant execute any procedure to crdb1;
grant execute any procedure to crdb1;
grant create any procedure to crdb1;
grant create session to crdb1;
grant create sequence to crdb1;
grant create synonym to crdb1;
grant create any table to crdb1;
grant create user to crdb1;
grant create view to crdb1;
grant execute_catalog_role,select_catalog_role to crdb1;
grant aq_user_role,aq_administrator_role to crdb1;
grant drop any table to crdb1;
grant drop user to crdb1;
grant dba to crdb1;
Bot Insight的表空間和用戶,假定表空間名為bidb1,用戶名和密碼都為bidb1
create bigfile TABLESPACE bidb1 datafile 'C:\INSTALL\ORADATA\ORCL\bidb1.dbf' SIZE 4096M;
create user bidb1 identified by bidb1 default tablespace bidb1;
grant connect to bidb1;
grant resource to bidb1;
grant select any dictionary to bidb1;
grant select any dictionary to bidb1;
grant select any table to bidb1;
grant select any table to bidb1;
grant flashback any table to bidb1;
grant alter any table to bidb1;
grant alter session to bidb1;
grant execute on dbms_flashback to bidb1;
grant execute any procedure to bidb1;
grant execute any procedure to bidb1;
grant create any procedure to bidb1;
grant create session to bidb1;
grant create sequence to bidb1;
grant create synonym to bidb1;
grant create any table to bidb1;
grant create user to bidb1;
grant create view to bidb1;
grant execute_catalog_role,select_catalog_role to bidb1;
grant aq_user_role,aq_administrator_role to bidb1;
grant drop any table to bidb1;
grant drop user to bidb1;
grant dba to bidb1;
最后在提交一下
commit;
三、安裝和配置PostgreSQL數(shù)據(jù)庫
由于做AAE的HA需要使用到PostgreSQL
安裝PostgreSQL的說明,請參考?https://www.yiibai.com/postgresql/install-postgresql.html
還需要打開防火墻的入站規(guī)則 TCP 5432端口
四、在A機器上安裝AAE的Control Room
1、使用管理員身份運行AAE11.3.4的安裝文件;
2、選擇自定義安裝方式;
3、選擇默認安裝目錄;
4、在Cluster Configuration頁面中,勾選Enable Cluster Setup。在Cluster IP中按照固定順序輸入A和B兩臺機器的內(nèi)網(wǎng)IP地址internal_ipaddress1和internal_ipaddress2,在Local IP中選擇A機器的內(nèi)網(wǎng)IP,internal_ipaddress1。

5、設(shè)置HTTP端口和HTTPS端口,且確認防火墻已經(jīng)打開入站規(guī)則;
6、設(shè)置數(shù)據(jù)庫連接信息,包括C機器的IP地址 internal_ipaddress3,端口 1521,Control Room和Bot Insight的用戶名口令;

7、設(shè)置PostgreSQL的IP地址和端口,用戶名和用戶口令;
8、下一步完成安裝。
9、檢查一下A機器的Contro Room的頁面是否可以打開。

五、?在B機器上安裝AAE的Control Room
步驟同A機器,只是在在Cluster Configuration頁面中,勾選Enable Cluster Setup。在Cluster IP中按照固定順序輸入A和B兩臺機器的內(nèi)網(wǎng)IP地址internal_ipaddress1和internal_ipaddress2,輸入順序同A機器安裝配置,在Local IP中選擇B機器的內(nèi)網(wǎng)IP,internal_ipaddress2。
注意:數(shù)據(jù)庫的地址和訪問方式,與A機器的安裝配置一致;PostgreSQL的訪問地址和用戶名口令與A機器的安裝配置一致。
一步一步安裝完成后,檢查一下B機器的Contro Room的頁面是否可以打開。
執(zhí)行到此步驟,表明A和B機器的Control Room共享了C機器的數(shù)據(jù)庫。
六、?設(shè)置負載均衡Load Balancer
在負載均衡設(shè)置中,加入A和B的外網(wǎng)IP地址external_ipaddress1和external_ipaddress2。
設(shè)置負載均衡的外網(wǎng)IP為external_ipaddress4,端口設(shè)為80。
七、?設(shè)置文件共享服務器
在Windows服務器D里面配置共享文件可以使用域管理模式,也可以使用NFS文件服務。本次配置中,采用NFS文件服務的方式。
1、在服務器D中安裝NFS服務組件









2、設(shè)置該共享文件夾的訪問權(quán)限



3、打開該服務器防火墻的入站規(guī)則:端口111(NFS), 2049(NFS02), 及1058(NFS03)
4、在服務器A和B中安裝NFS客戶端,同第1步,打開“服務器管理器”,在主頁儀表板中單擊“添加角色和功能” 。

5、測試服務器A和B是否可以訪問服務器C的共享目錄,\\external_ipaddress5\共享文件夾,并在該目錄匯總建立Server Files文件夾作為Control Room的Repository

八、?設(shè)置Control Room的初始化配置
在A或B機器的Control Room初始配置頁面中,
Repository path輸入文件存儲的共享目錄?\\external_ipaddress5\共享文件夾\Server Files
Control Room Access URL地址中輸入http://external_ipaddress4:80,指向負載均衡的IP地址.

由于A和B共享了數(shù)據(jù)庫,所以配置完一臺機器的Control Room,另一臺機器也就相當于配置好了。
九、?測試已經(jīng)搭建好的HA環(huán)境
嘗試使用http://external_ipaddress4:80來訪問Control Room,測試連接成功。
接下來可以嘗試停掉A或B某臺機器的Control Room的Service,不會影響用戶訪問http://external_ipaddress4:80這個地址。