VCenter 5.5 install on Windows Server 2012R2 with oracle database ,有幾個要注意的地方,在此僅記錄重點。安裝的順序可以使用 Simple Install ,或是單獨逐一依 Custom Install 安裝。

vcenter55_install_welcome_page  

 

環境:

1. windows server 2012 R2 多國語言;注意安裝時,1. 預設語言要切換為 英文 才不會有錯誤 2. VCenter 的 Host 要先加入AD網域,Vcenter 的權限才有辦法選到 AD 網域的帳號,不然就要用帳號: administrator@vsphere.local 登入 https://vcenter:9443/vsphere-client 到 SSO 作設定了

2. VCcenter 5.5 :VMware-VIMSetup-all-5.5.0-VMware vCenter Server 5.5 Update 2e and modules-2646481-20150401.iso

3. Oracle DataBase: 11gR2_11204_WIN64

安裝注意事項:

一、 依序安裝 vCenter Single Sign-on , vSphere Web Client , vShpere Inventory Service 時,不會連結到oracle database ;只有安裝 vCenter Server 才會連結到 Oracle DB,但 vCenter Single Sign-on 的 Administrator 密碼要記得,後續安裝都會用到它。

vCenter_Single_Sign_On  

例如:vCenter Server 安裝時

vCenterSSO  

 

二、vCenter Service 使用Windows 本機系統帳戶

vCenterService  

 

三、 vCenter 安裝後第一次用 vShpere Client 登入會有錯誤。

vcenter55_first_client_login  

 

1. 使用 google Chrome 需先登入 vShpere web clinet: https://vc55.gu.com:9443/vsphere-client ,使用帳號:administrator@vsphere.local 登入

vsphere_chrome_web_login  

2. 在 vCenter Servers 中選擇主機 VC55 加入 本機AD網域 的 administrator 權限

vCenter_Add_AD_Account  

 

四、使用 Oracle 11gR2 取代 MSSQL Express 作為 vCenter 的資料庫
註:( 對於小型安裝 "最多 5 台主機和 50 台虛擬機器",您可以使用配套的 Microsoft SQL Server 2008 Express 資料庫 )

1. 安裝 Oracle DB ,選擇 建立並設定資料庫。若是選擇 只安裝資料庫軟體 ,則之後必需利用指令 netca 建立 Listener ,可利用 lsnrctl status 確認一下 Listener 是否已正常工作;再利用指令 dbca 建立資料庫。

vCenter_oracleDB_install_01  

 選擇項目如下,後安裝

vCenter_oracleDB_install_02  

2. 測試連線到資料庫 vcdb 沒有問題。指令: sqlplus 帳號/密碼@資料庫 as sysdba

vCenter_oracleDB_install_03  

查詢資料庫的檔案: select name from v$datafile;

vCenter_oracleDB_install_04  

 

3. vCenter Server 系統必須具有 64 位元 DSN,通過 ODBC 資料來源建立一個系統 DSN:vcdb,如圖

vCenter_oracleDB_install_06  

 

4.  建立 vCenter 專屬的 TABLESPACE "VPX"

執行下列指令碼。該指令碼位於 vCenter Server 安裝套件的 /installation directory/vCenter-Server/dbschema/DB_and_schema_creation_scripts_oracle.txt 檔案中。

CREATE SMALLFILE TABLESPACE "VPX" DATAFILE '/u01/app/oracle/oradata/vcdb/vpx01.dbf'
SIZE 1G AUTOEXTEND ON NEXT 10M MAXSIZE UNLIMITED LOGGING EXTENT MANAGEMENT LOCAL SEGMENT
SPACE MANAGEMENT AUTO;

對於 Windows 安裝,請變更 vpx01.dbf 檔案的目錄路徑,如下。

CREATE SMALLFILE TABLESPACE "VPX" DATAFILE 'C:\APP\ORACLE\ORADATA\VCDB\vpx01.dbf' SIZE 1G AUTOEXTEND ON NEXT 10M MAXSIZE UNLIMITED LOGGING EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO;

vCenter_oracleDB_install_05  

 

5. 設定 Oracle 資料庫使用者: VPXADMIN

執行下列 SQL 命令,建立具有正確權限的 vCenter Server 資料庫使用者。該指令碼位於 vCenter Server 安裝套件的 /installation directory/vCenter-Server/dbschema/DB_and_schema_creation_scripts_oracle.txt 檔案中。

在此範例中,使用者名稱為 VPXADMIN。

CREATE USER "VPXADMIN" PROFILE "DEFAULT" IDENTIFIED BY "oracle" DEFAULT TABLESPACE "VPX" ACCOUNT UNLOCK;
grant connect to VPXADMIN;
grant resource to VPXADMIN;
grant create view to VPXADMIN;
grant create sequence to VPXADMIN;
grant create table to VPXADMIN;
grant create materialized view to VPXADMIN;
grant execute on dbms_lock to VPXADMIN;
grant execute on dbms_job to VPXADMIN;
grant select on dba_tablespaces to VPXADMIN;
grant select on dba_temp_files to VPXADMIN;
grant select on dba_data_files to VPXADMIN;
grant unlimited tablespace to VPXADMIN;
alter user "VPXADMIN" quota unlimited on "VPX";

 

6.  安裝 vCenter Server 時選 通過 ODBC 資料來源建立的 System DSN:vcdb

vCenter_oracleDB_install_08  

輸入剛建立的 VPXADMIN 帳號及密碼

vCenter_oracleDB_install_09  

 

其它的依指示依序執行即可建立 VCenter 5.5 install on Windows Server 2012R2 with oracle database

以上是 vCenter 使用 Oracle Database 11gR2 的安裝方法

 

 

x. (選擇性) 使用指令碼建立 Oracle 資料庫結構描述

vCenter_oracleDB_install_07  

先切換到 vCenter Server 安裝套件 /installation directory/vCenter-Server/dbschema 目錄,再執行 D:\vCenter-Server\dbschema>sqlplus vpxadmin/oracle@vcdb

然後執行下列 dbschema 指令碼

1. 在 SQL*Plus 中,依序對資料庫執行下列指令碼。


@VCDB_oracle.SQL
@VCDB_views_oracle.SQL
@insert_stats_proc_oracle.sql
@load_stats_proc_oracle.sql
@purge_stat2_proc_oracle.sql
@purge_stat3_proc_oracle.sql
@purge_usage_stats_proc_oracle.sql
@stats_rollup1_proc_oracle.sql
@stats_rollup2_proc_oracle.sql
@stats_rollup3_proc_oracle.sql
@cleanup_events_oracle.sql
@delete_stats_proc_oracle.sql
@load_usage_stats_proc_oracle.sql
@TopN_DB_oracle.sql
@calc_topn1_proc_oracle.sql
@calc_topn2_proc_oracle.sql
@calc_topn3_proc_oracle.sql
@calc_topn4_proc_oracle.sql
@clear_topn1_proc_oracle.sql
@clear_topn2_proc_oracle.sql
@clear_topn3_proc_oracle.sql
@clear_topn4_proc_oracle.sql
@rule_topn1_proc_oracle.sql
@rule_topn2_proc_oracle.sql
@rule_topn3_proc_oracle.sql
@rule_topn4_proc_oracle.sql
@process_license_snapshot_oracle.sql
@l_purge_stat2_proc_oracle.sql
@l_purge_stat3_proc_oracle.sql
@l_stats_rollup1_proc_oracle.sql
@l_stats_rollup2_proc_oracle.sql
@l_stats_rollup3_proc_oracle.sql

2. (選擇性) 您也可以執行下列指令碼來啟用資料庫健全狀況監控。

@job_dbm_performance_data_oracle.sql
@process_performance_data_oracle.sql

3. 對於所有受支援的 Oracle Server 版本,執行下列指令碼可在資料庫上設定排定的工作。

@job_schedule1_oracle.sql
@job_schedule2_oracle.sql
@job_schedule3_oracle.sql
@job_cleanup_events_oracle.sql
@job_topn_past_day_oracle.sql
@job_topn_past_week_oracle.sql
@job_topn_past_month_oracle.sql
@job_topn_past_year_oracle.sql

您現在即擁有與 vCenter Server 相容的資料庫結構描述。

 

參考:

https://pubs.vmware.com/vsphere-55/index.jsp#com.vmware.vsphere.install.doc/GUID-55F7FFDB-01B8-4C18-AA89-DC28BD9B1E9F.html

 

附註:

vCenter Server 支援的資料庫的組態說明

資料庫類型

組態說明

Microsoft SQL Server 2008 R2 Express

可以用於小型部署 (最多 5 台主機和 50 台虛擬機器) 的配套資料庫。

SQL Server 定序模式:SQL_Latin1_General_CP1_CI_AS。

ODBC 系統 DSN 最低版本:SQL Native Client 10.0 (版本 2009.100.4000.00),可從 microsoft.com 下載中心免費下載。

備註

vCenter Server Appliance 不支援此資料庫。

Microsoft SQL Server 2008

請確保機器具有有效的 ODBC DSN 項目。

SQL Server 定序模式:SQL_Latin1_General_CP1_CI_AS。

ODBC 系統 DSN 最低版本:SQL Native Client 10.0 (版本 2009.100.4000.00),可從 microsoft.com 下載中心免費下載。

備註

vCenter Server Appliance 不支援此資料庫。

Microsoft SQL Server 2012 SP1

請確保機器具有有效的 ODBC DSN 項目。

Oracle 11g 和 12c

請確保機器具有有效的 ODBC DSN 項目。

完成 vCenter Server 安裝後,請採取下列步驟:

將最新的修補程式套用到 Oracle 用戶端和伺服器。

將 Oracle JDBC 驅動程式 (ojdbc14.jar 或 ojdbc5.jar) 複製到 vCenter Server 安裝目錄的 tomcat\lib 子目錄中:vCenter install location\Infrastructure\tomcat\lib

在 Windowss [系統管理工具] 控制台的 [服務] 區段中,重新啟動 VMware VirtualCenter Management Webservices 服務。

vCenter Server 安裝程式會嘗試將 Oracle JDBC 驅動程式從 Oracle 用戶端位置複製到 vCenter Server 安裝目錄。如果在 Oracle 用戶端位置中找不到 Oracle JDBC 驅動程式,則 vCenter Server 安裝程式會提示您手動複製檔案。您可以從 oracle.com 網站下載該檔案。

文章標籤

MIS 發表在 痞客邦 留言(0) 人氣()

在網頁上實作倒數計時讓使用者知道多久會被導向到另一個網站,這個功能常會用在網站改網址或者是要告知一些重要事項。作法如下:

jQuery: jquery-1.11.1.min.js

jquery.countdown: jquery.countdown.min.js

下載上面兩個 java script,然後再寫一個網頁 index.html,內容如下即可。請修改紅色標示的地方。

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<META HTTP-EQUIV="Refresh" CONTENT="15;URL=https://bpm.polinwei.com">
<title>Welcome BPM (Business Process Management, BPM) 企業流程管理系統</title>

<link href="style.css" rel="stylesheet" type="text/css">

<script src="jquery-1.11.1.min.js"></script>
<script type="text/javascript" src="jquery.countdown.min.js"></script>
<script type="text/javascript">

$(document).ready(function() {
    val = 15 * 1000;
    selectedDate = new Date().valueOf() + val;
    $('.clock').countdown(selectedDate, function(event) {
           $(this).html(event.strftime('%S'));
         });
});    

</script>

<style type="text/css">
<!--
body {
    background-color: #e1dbcd;
    margin: 0px;    
    background-repeat: repeat-x;
}
-->
</style>

</head>
<body>


<div id="content">
    <p><span class="text_black"> Attention</span></p>
    
    <span class="text_bold">eSystem New URL</span>? ?<br>
    <p><span class="text">
    esystem's URL will be changed to <a href="https://bpm.polinwei.com"> https://bpm.polinwei.com</a> in 2015/11/16 , Please noted.
    </span></p>
    <p><span class="text_bold_nounderline">This page will redirect to new page in <span class="clock"></span> sec.</p>
    <p> PS: BPM - Business Process Management </p>
    
    <br/>
    <p><span class="text_black"> 請注意 </span></p>
    <p><span class="text_bold">eSystem 網址即將變更</span>? ?</p>
    <p><span class="text">
    esystem 網址將於2015/11/16更新為 <a href="https://bpm.polinwei.com">https://bpm.polinwei.com</a>,請將該網址加到你的最愛。
    </span></p>   
    <p><span class="text_bold_nounderline">該網頁將於<span class="clock"></span>秒後自動轉址。</span></p>
    <p> 註: 企業流程管理 BPM(Business Process Management, BPM)</p>
    
</div>

</body>
</html>
文章標籤

MIS 發表在 痞客邦 留言(0) 人氣()

 

一、
從 SQL Server Management Studio
在資料庫上按右鍵->「屬性」->「選項」->「復原模式」,改成「簡單」模式
或是下指令
ALTER DATABASE 資料庫名稱 SET RECOVERY SIMPLE
MSSQL_Option_simple   
 
二、
use 資料庫名稱
GO
DBCC SHRINKFILE('LDF的邏輯名稱',2)
其中的LDF的邏輯名稱,可以下以下指令取得
select * from sys.database_files
通常都是:資料庫名稱_log
MSSQL_file_logicFile   

 

範例指令:

use Application_Registry_Service_DB_a3763f11049a4d59b45c9ee164c3e626

GO

DBCCSHRINKFILE('Application_Registry_Service_DB_a3763f11049a4d59b45c9ee164c3e626_log',2)


 
三、
將資料庫「復原模式」改回「完整」
或是下指令
ALTER DATABASE 資料庫名稱 SET RECOVERY FULL

文章標籤

MIS 發表在 痞客邦 留言(0) 人氣()

Apache 網頁伺服器 (Apache Web Server) 上要如何設定以啟用壓縮功能,將輸出的網頁或資源檔案做壓縮後再送往瀏覽器端。也就是,開啟 mod_deflate 壓縮輸出的網頁或資源檔案以節省頻寬 (一般可省 2~3 倍以上)。

以下的範例說明瀏覽器和網頁伺服器間對於支援壓縮功能是如何溝通的:

瀏覽器:在送往伺服器的 HTTP 要求中會含有一個 Accept-Encoding 欄位說明自己支援的壓縮機制有哪些 (各壓縮機制以逗號「,」分開):

Accept
text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Encoding
gzip, deflate
Accept-Language
en-US,zh-TW;q=0.8,zh;q=0.5,en;q=0.3
Connection
keep-alive
Cookie
JSESSIONID="t5mGUd87rGbXsUQX1ij9M09s.slave:slave-server-one"; LtpaToken=AAECAzU2MDBGQ0VCNTYwMTI3MUJDTj1wb2x
DNT
1
Host
eap.globeunion.com
Referer
http://eap.globeunion.com/GUSSH/
User-Agent
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:40.0) Gecko/20100101 Firefox/40.0



網頁伺服器:如果伺服器支援一個或多個瀏覽器所列的壓縮機制,則輸出的資料會被這一個或多個壓縮機制處理後送往瀏覽器,然後送出的 HTTP 回應中會含有一個 Content-Encoding 欄位說明用了資料被那些壓縮機制 (各壓縮機制以逗號「,」分開):

Cache-Control
No-Cache
Connection
Keep-Alive
Content-Encoding
gzip
Content-Length
6980
Content-Type
text/html;charset=UTF-8
Date
Tue, 22 Sep 2015 08:01:40 GMT
Expires
Thu, 01 Jan 1970 00:00:00 GMT
Keep-Alive
timeout=5, max=99
Pragma
No-Cache
Vary
Accept-Encoding
X-Powered-By
JSP/2.2


如下圖:




如何設定 Apache 網頁伺服器以啟用壓縮功能

0. 確認 Apache 網頁有安裝 deflate 模組
1. 在 httpd.conf 設定檔中確認 deflate 模組有設定載入,並且有做以下設定:
…..
LoadModule expires_module modules/mod_expires.so
LoadModule deflate_module modules/mod_deflate.so
LoadModule headers_module modules/mod_headers.so
…..
# 2015/09/22, added by polin wei
<IfModule mod_deflate.c>
DeflateCompressionLevel 9
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css application/x-javascript application/javascript application/x-httpd-php
AddOutputFilter DEFLATE js css gif

#Instead of blacklist, we use a whitelist:
BrowserMatch ^MSIE [6-9] gzip

</IfModule>

<LocationMatch ".*\.jsp$">
     ForceType text/html
</LocationMatch>



2. 重新啟動 Apache 網頁伺服器:sudo service httpd restart
在上面的設定範例中,我們用最高的壓縮等級 (CompressionLevel) 9 (可用的數值 1 ~ 9),其實到 5 左右就有不錯的壓縮比例。而對於要根據檔案類型去啟用壓縮功能的列在「AddOutputFilterByType DEFLATE」之後;而對於要根據檔案“附檔名名稱”去啟用壓縮功能的列在「AddOutputFilter DEFLATE」之後。

文章標籤

MIS 發表在 痞客邦 留言(0) 人氣()

在wildfly的standalone.xml內中
約在83行左右,確認該行<subsystem xmlns="urn:jboss:domain:logging:2.0">下是否有加入
     <use-deployment-logging-config value="false"/>
 
EAP的設定大致相同,但加入的參數不同,約在88行左右
  <subsystem xmlns="urn:jboss:domain:logging:1.5">在之下,加入
   <add-logging-api-dependencies value="false"/>

以上設定,表單即不會因多次開啟而造成死當。
https://access.redhat.com/documentation/en-US/JBoss_Enterprise_Application_Platform/6.4/pdf/Migration_Guide/JBoss_Enterprise_Application_Platform-6.4-Migration_Guide-en-US.pdf     第17頁中表示因要排除第三方(log4j)的依賴性,所以要設成false,不然會有問題,不過不曉得跟死當有什麼直接關係,
但是補上該設定,系統是可以working的。
不過還滿好奇的是wildfly的console仍會秀出,但EAP的console始終沒有秀出我們的consoel。持續查找中。

文章標籤

MIS 發表在 痞客邦 留言(0) 人氣()

為了讓 WEB APP 不因一台主機當機而影響作業,開始架構二台 JBOSS 主機,並利用 JBOSS plug in 在 Apache 的 mod_cluster-1.2.6 來作 Load Balancer

版本:

JDK:jdk-8u45-linux-x64.rpm

JBOSS EAP 6.4

Apache & mod_cluster 1.2.6.Final : http://downloads.jboss.org/mod_cluster//1.2.6.Final/linux-i686/mod_cluster-1.2.6.Final-src-ssl.tar.gz

環境:

domain Master :192.168.30.100

domain Slave:192.168.30.101

EAPDomainCluster  

一、開始安裝 JDK

Step 01: 移除 OpenJDK

[root@localhost ~]# rpm -qa | grep java
[root@localhost ~]# yum remove java*

 

Step 02:安裝 JDK

[root@localhost tmp]# rpm -ivh jdk-8u45-linux-x64.rpm

[root@bm tmp]# java -version
java version "1.8.0_45"
Java(TM) SE Runtime Environment (build 1.8.0_45-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.45-b02, mixed mode)

[root@bm tmp]# javac -version
javac 1.8.0_45

 

Step 03:編輯「/etc/profile」檔案,在最後加入

export JAVA_HOME=/usr/java/jdk1.8.0_45
export JRE_HOME=/usr/java/jdk1.8.0_45/jre
export ANT_HOME=/opt/apache-ant-1.7.0
export JBOSS_HOME=/opt/jboss-eap-6.4
export APACHE_HOME=/opt/jboss/httpd

export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH:$ANT_HOME/bin
export CLASSPATH=$CLASSPATH:.:$JAVA_HOME/lib:$JRE_HOME/lib

 

二、開始安裝 JBoss EAP 6.4

Step 01:上傳 jboss-eap-6.4.0.zip 並解壓於 /opt 下

[root@bm tmp]# unzip jboss-eap-6.4.0.zip
[root@bm tmp]# mv jboss-eap-6.4 /opt

 

Step 02:重開主機,並啟動 JBOSS Domain Mode 作測試( Master 與 Slave 作同樣的動作)

[root@bm tmp]# $JBOSS_HOME/bin/domain.sh

 

三、開始作 Domain Configuration 設定

 ■ Interface config on master(192.168.30.100)

 

Step 01:修改 vi domain/configuration/host.xml
初始值如下:

<interfaces>
    <interface name="management">
        <inet-address value="${jboss.bind.address.management:127.0.0.1}"/>
    </interface>
    <interface name="public">
       <inet-address value="${jboss.bind.address:127.0.0.1}"/>
    </interface>
    <interface name="unsecure">
        <!-- Used for IIOP sockets in the standard configuration.
             To secure JacORB you need to setup SSL -->
        <inet-address value="${jboss.bind.address.unsecure:127.0.0.1}"/>
    </interface>
</interfaces>

變更如下

<interfaces>
    <interface name="management">
        <inet-address value="${jboss.bind.address.management:192.168.30.100}"/>
    </interface>
    <interface name="public">
       <inet-address value="${jboss.bind.address:192.168.30.100}"/>
    </interface>
    <interface name="unsecure">
        <!-- Used for IIOP sockets in the standard configuration.
             To secure JacORB you need to setup SSL -->
        <inet-address value="${jboss.bind.address.unsecure:192.168.30.100}"/>
    </interface>
</interfaces>

 

Step02:建立 Domain Mode 主機間溝通用專用的帳號:domainAdmin,並取得 secret key
增加管理帳號:domainAdmin
密碼:password

[root@localhost bin]# ./add-user.sh

What type of user do you wish to add?
 a) Management User (mgmt-users.properties)
 b) Application User (application-users.properties)
(a):
Enter the details of the new user to add.
Using realm 'ManagementRealm' as discovered from the existing property files.
Username : domainAdmin
Password requirements are listed below. To modify these restrictions edit the add-user.properties configuration file.
 - The password must not be one of the following restricted values {root, admin, administrator}
 - The password must contain at least 8 characters, 1 alphabetic character(s), 1 digit(s), 1 non-alphanumeric symbol(s)
 - The password must be different from the username
Password : password
Re-enter Password : password
What groups do you want this user to belong to? (Please enter a comma separated list, or leave blank for none)[  ]:
About to add user 'domainMaster' for realm 'ManagementRealm'
Is this correct yes/no? yes
Added user 'domainMaster' to file '/opt/jboss-eap-6.3/standalone/configuration/mgmt-users.properties'
Added user 'domainMaster' to file '/opt/jboss-eap-6.3/domain/configuration/mgmt-users.properties'
Added user 'domainMaster' with groups  to file '/opt/jboss-eap-6.3/standalone/configuration/mgmt-groups.properties'
Added user 'domainMaster' with groups  to file '/opt/jboss-eap-6.3/domain/configuration/mgmt-groups.properties'
Is this new user going to be used for one AS process to connect to another AS process?
e.g. for a slave host controller connecting to the master or for a Remoting connection for server to server EJB calls.
yes/no? yes
To represent the user add the following to the server-identities definition <secret value="SkJvc3NFQVA2LjM=" />

 

Interface config on slave(192.168.30.101)

Step 01:修改 vi domain/configuration/host.xml 相關的值如下

<?xml version='1.0' encoding='UTF-8'?>
<host name="slave" xmlns="urn:jboss:domain:1.6">
    <management>
        <security-realms>
            <security-realm name="ManagementRealm">
                    <server-identities>
                       <secret value="SkJvc3NFQVA2LjM=" />
                    </server-identities>
                    <authentication>
                        <properties path="mgmt-users.properties" relative-to="jboss.domain.config.dir"/>
                    </authentication>
                <authorization map-groups-to-roles="false">
                    <properties path="mgmt-groups.properties" relative-to="jboss.domain.config.dir"/>
                </authorization>               
            </security-realm>
            <security-realm name="ApplicationRealm">
                <authentication>
                    <local default-user="$local" allowed-users="*" skip-group-loading="true" />
                    <properties path="application-users.properties" relative-to="jboss.domain.config.dir" />
                </authentication>
                <authorization>
                    <properties path="application-roles.properties" relative-to="jboss.domain.config.dir"/>
                </authorization>
            </security-realm>
        </security-realms>
        <audit-log>
            <formatters>
               <json-formatter name="json-formatter"/>
            </formatters>
            <handlers>
                <file-handler name="host-file" formatter="json-formatter" relative-to="jboss.domain.data.dir" path="audit-log.log"/>
                <file-handler name="server-file" formatter="json-formatter" relative-to="jboss.server.data.dir" path="audit-log.log"/>
            </handlers>
            <logger log-boot="true" log-read-only="false" enabled="false">
               <handlers>
                  <handler name="host-file"/>
               </handlers>
            </logger>
            <server-logger log-boot="true" log-read-only="false" enabled="false">
                <handlers>
                    <handler name="server-file"/>
                </handlers>
            </server-logger>
        </audit-log>
        <management-interfaces>
            <native-interface security-realm="ManagementRealm">
                <socket interface="management" port="${jboss.management.native.port:9999}"/>
            </native-interface>
            <http-interface security-realm="ManagementRealm">
                <socket interface="management" port="${jboss.management.http.port:9990}"/>
            </http-interface>
        </management-interfaces>
    </management>

    <domain-controller>
       <remote host="192.168.30.100" port="9999" security-realm="ManagementRealm" username="domainAdmin" />
       <!-- Alternative remote domain controller configuration with a host and port -->
       <!-- <remote host="${jboss.domain.master.address}" port="${jboss.domain.master.port:9999}" security-realm="ManagementRealm"/> -->
    </domain-controller>
    <interfaces>
        <interface name="management">
            <inet-address value="${jboss.bind.address.management:192.168.30.101}"/>
        </interface>
        <interface name="public">
           <inet-address value="${jboss.bind.address:192.168.30.101}"/>
        </interface>
        <interface name="unsecure">
            <!-- Used for IIOP sockets in the standard configuration.
                 To secure JacORB you need to setup SSL -->
            <inet-address value="${jboss.bind.address.unsecure:192.168.30.101}"/>
        </interface>
    </interfaces>
     <jvms>
        <jvm name="default">
          <heap size="64m" max-size="256m"/>
          <permgen size="256m" max-size="256m"/>
            <jvm-options>
                <option value="-server"/>
            </jvm-options>
       </jvm>
     </jvms>
    <servers>
        <server name="slave-one" group="other-server-group">
            <!-- Remote JPDA debugging for a specific server
            <jvm name="default">
              <jvm-options>
                <option value="-agentlib:jdwp=transport=dt_socket,address=8787,server=y,suspend=n"/>
              </jvm-options>
           </jvm>
           -->
        </server>
        <server name="slave-two" group="other-server-group" auto-start="true">
            <!-- server-two avoids port conflicts by incrementing the ports in
                 the default socket-group declared in the server-group -->
            <socket-bindings port-offset="150"/>
        </server>
        <server name="slave-three" group="other-server-group" auto-start="false">
            <!-- server-three avoids port conflicts by incrementing the ports in
                 the default socket-group declared in the server-group -->
            <socket-bindings port-offset="250"/>
        </server>
    </servers>
</host>

 

Step 02:Domain Mode 是聽從 Master 主機,所以將 Slave 的 domain.xml 更名為 domain.xml.move

mv $JBOSS_HOME/domain/configuration/domain.xml $JBOSS_HOME/domain/configuration/domain.xml.move

 

四、Cluster Configuration 使用 mod_cluster 1.2.6.Final

Step 01: 安裝 apache,到 http://mod-cluster.jboss.org/downloads 下載 mod_cluster-1.2.6.Final-linux2-x64-ssl.tar.gz
將 mod_cluster-1.2.6.Final-linux2-x64-ssl.tar.gz 上載到Server後解壓

[root@eap-master tmp]# tar -xzvf mod_cluster-1.2.6.Final-linux2-x64-ssl.tar.gz
[root@eap-master tmp]# cp –rp /tmp/opt/jboss /opt

 

Step 02:  分別修改 192.168.30.100 & 192.168.30.101 Apache 的 httpd.conf

修改 Master(192.168.30.100) 的 mod_cluster:vi $APACHE_HOME/httpd/conf/httpd.conf

ServerName eap-master.globeunion.com:80

<VirtualHost 192.168.30.100:80>
  <Directory />
    Order deny,allow
    Deny from all
    Allow from all
  </Directory>
  <Location /cluster_manager>
    SetHandler mod_cluster-manager
    Order deny,allow
    Deny from all
    Allow from all
  </Location>
</VirtualHost>

Listen 192.168.30.100:6666
#ManagerBalancerName mycluster   
ManagerBalancerName other-server-group
<VirtualHost 192.168.30.100:6666>
  <Directory />
    Order deny,allow
      Deny from all
      Allow from all
  </Directory>
  ServerAdvertise on http://192.168.30.100:6666
  EnableMCPMReceive
</VirtualHost>

 

修改 Slave(192.168.30.101) 的 mod_cluster:vi $APACHE_HOME/httpd/conf/httpd.conf

ServerName eap-slave.globeunion.com:80

# MOD_CLUSTER_ADDS
# Adjust to you hostname and subnet.
<IfModule manager_module>
    <VirtualHost 192.168.30.101:80>
      <Directory />
        Order deny,allow
        Deny from all
        Allow from all
      </Directory>
      <Location /cluster_manager>
        SetHandler mod_cluster-manager
        Order deny,allow
        Deny from all
        Allow from all
      </Location>
    </VirtualHost>

    Listen 192.168.30.101:6666
    #ManagerBalancerName mycluster   
    ManagerBalancerName other-server-group
    <VirtualHost 192.168.30.101:6666>
      <Directory />
        Order deny,allow
          Deny from all
          Allow from all
      </Directory>
      ServerAdvertise on http:// 192.168.30.101:6666
      EnableMCPMReceive
    </VirtualHost>
</IfModule>

 

Step 03:修改192.168.30.100-Master 的 domain.xml 裡的 profile name="full-ha":

vi domain/configuration/domain.xml 相關的值如下

<profile name="full-ha">
<subsystem xmlns="urn:jboss:domain:messaging:1.4">
    <hornetq-server>
        <cluster-user>domainAdmin</cluster-user>
        <cluster-password>password</cluster-password>
        <persistence-enabled>true</persistence-enabled>
        <journal-type>NIO</journal-type>
        <journal-min-files>2</journal-min-files>
        <connectors>
            <netty-connector name="netty" socket-binding="messaging"/>
            <netty-connector name="netty-throughput" socket-binding="messaging-throughput">
                <param key="batch-delay" value="50"/>
            </netty-connector>
            <in-vm-connector name="in-vm" server-id="0"/>
        </connectors>
 
    </hornetq-server>
</subsystem>
<subsystem xmlns="urn:jboss:domain:modcluster:1.2">
    <mod-cluster-config advertise-socket="modcluster" connector="ajp" proxy-list="192.168.30.100:6666,192.168.30.101:6666" balancer="mycluster">
        <dynamic-load-provider>
            <load-metric type="busyness"/>
        </dynamic-load-provider>
    </mod-cluster-config>
</subsystem>
<subsystem xmlns="urn:jboss:domain:web:2.2" default-virtual-server="default-host" native="false" instance-id="${jboss.node.name}">
    <connector name="http" protocol="HTTP/1.1" scheme="http" socket-binding="http"/>
    <connector name="ajp" protocol="AJP/1.3" scheme="http" socket-binding="ajp"/>
    <virtual-server name="default-host" enable-welcome-root="true">
        <alias name="localhost"/>
        <alias name="example.com"/>
    </virtual-server>
</subsystem>
</profile>

 

五、關閉防火牆

[root@bm bin]# systemctl list-unit-files | grep fire

firewalld.service enabled

[root@bm bin]# systemctl disable firewalld.service

 

六、相關服務手動啟動

#Apache Server Start/Stop

$APACHE_HOME/sbin/apachectl start/stop/status

#JBOSS EAP Server Start

$JBOSS_HOME/bin/domain.sh

#JBOSS EAP Domain 管理介面

http://192.168.30.100:9990/console

 

 

七、將 Apache Server 設定成 Service

Step 01:copy apachectl 到 /etc/init.d

[root@eap-master init.d]# cp /opt/jboss/httpd/sbin/apachectl /etc/init.d

 

Step 02: 修改 /etc/init.d/apachectl

#!/bin/sh

在第二行加入以下兩句:

# chkconfig: 2345 80 90
# description:auto_run

第一行,告訴系統使用的shell,所以的shell腳本都是這樣。
第二行,chkconfig後面有三個參數2345,80和90告 訴chkconfig程式,需要在rc2.d~rc5.d目錄下,創建名字為 S80auto_run的檔連接,連接到/etc/rc.d/init.d目錄下的的auto_run腳本。第一個字元是S,系統在啟動的時候,運行腳 本auto_run,就會添加一個start參數,告訴腳本,現在是啟動模式。同時在rc0.d和rc6.d目錄下,創建名字為K90auto_run的 檔連接,第一個字元為K,個系統在關閉系統的時候,會運行auto_run,添加一個stop,告訴腳本,現在是關閉模式。
注意上面的三行是中,第二、三行是必須的,否則在運行chkconfig --add auto_run時,會報錯。

完整如下:

#!/bin/sh
# chkconfig: 2345 80 90
# description:auto_run
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements.  See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License.  You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
#
# Apache control script designed to allow an easy command line interface
# to controlling Apache.  Written by Marc Slemko, 1997/08/23
#
# The exit codes returned are:
#   XXX this doc is no longer correct now that the interesting
#   XXX functions are handled by httpd
#    0 - operation completed successfully
#    1 -
#    2 - usage error
#    3 - httpd could not be started
#    4 - httpd could not be stopped
#    5 - httpd could not be started during a restart
#    6 - httpd could not be restarted during a restart
#    7 - httpd could not be restarted during a graceful restart
#    8 - configuration syntax error
#
# When multiple arguments are given, only the error from the _last_
# one is reported.  Run "apachectl help" for usage info
#
ARGV="$@"
#
# |||||||||||||||||||| START CONFIGURATION SECTION  ||||||||||||||||||||
# --------------------                              --------------------
#
# the path to your httpd binary, including options if necessary
HTTPD='/opt/jboss/httpd/sbin/httpd'
#
# pick up any necessary environment variables
if test -f /opt/jboss/httpd/sbin/envvars; then
  . /opt/jboss/httpd/sbin/envvars
fi
#
# a command that outputs a formatted text version of the HTML at the
# url given on the command line.  Designed for lynx, however other
# programs may work.  
LYNX="lynx -dump"
#
# the URL to your server's mod_status status page.  If you do not
# have one, then status and fullstatus will not work.
STATUSURL="http://localhost:80/server-status"
#
# Set this variable to a command that increases the maximum
# number of file descriptors allowed per child process. This is
# critical for configurations that use many file descriptors,
# such as mass vhosting, or a multithreaded server.
ULIMIT_MAX_FILES="ulimit -S -n `ulimit -H -n`"
# --------------------                              --------------------
# ||||||||||||||||||||   END CONFIGURATION SECTION  ||||||||||||||||||||

# Set the maximum number of file descriptors allowed per child process.
if [ "x$ULIMIT_MAX_FILES" != "x" ] ; then
    $ULIMIT_MAX_FILES
fi

ERROR=0
if [ "x$ARGV" = "x" ] ; then
    ARGV="-h"
fi

case $ARGV in
start|stop|restart|graceful|graceful-stop)
    $HTTPD -k $ARGV
    ERROR=$?
    ;;
startssl|sslstart|start-SSL)
    echo The startssl option is no longer supported.
    echo Please edit httpd.conf to include the SSL configuration settings
    echo and then use "apachectl start".
    ERROR=2
    ;;
configtest)
    $HTTPD -t
    ERROR=$?
    ;;
status)
    $LYNX $STATUSURL | awk ' /process$/ { print; exit } { print } '
    ;;
fullstatus)
    $LYNX $STATUSURL
    ;;
*)
    $HTTPD $ARGV
    ERROR=$?
esac

exit $ERROR

 

Step 03: 強制設成 Service

[root@eap-master init.d]# chkconfig --add apachectl

[root@eap-master init.d]# chkconfig --list apachectl

這樣 apache 除了會自動開機啟動外,還可以直接下 service apachectl start/stop 啟動

 

八、設定 建立 JBoss EAP 的 Domain 為 Service

Step 01: copy jboss-as.conf 到 /etc/jboss-as/ ;copy jboss-as-domain.sh 到 /etc/init.d/

[root@bm etc]# cp /opt/jboss-eap-6.4/bin/init.d/jboss-as.conf /etc/jboss-as/

[root@bm jboss-as]# cp /opt/jboss-eap-6.4/bin/init.d/jboss-as-domain.sh /etc/init.d/


Step 02: 修改 /etc/jboss-as/jboss-as.conf

# The username who should own the process.
#
JBOSS_USER=root

# The amount of time to wait for startup
#
STARTUP_WAIT=30

# The amount of time to wait for shutdown
#
# SHUTDOWN_WAIT=30

# Location to keep the console log
#
# JBOSS_CONSOLE_LOG=/var/log/jboss-as/console.log

 

Step 03: 修改 /etc/init.d/jboss-as-domain.sh

#!/bin/sh
#
# JBoss domain control script
#
# chkconfig: - 80 20
# description: JBoss AS Domain
# processname: domain
# pidfile: /var/run/jboss-as/jboss-as-domain.pid
# config: /etc/jboss-as/jboss-as.conf

# Source function library.
. /etc/init.d/functions

# Load Java configuration.
#[ -r /etc/java/java.conf ] && . /etc/java/java.conf
#export JAVA_HOME

# Load JBoss AS init.d configuration.
if [ -z "$JBOSS_CONF" ]; then
  JBOSS_CONF="/etc/jboss-as/jboss-as.conf"
fi

[ -r "$JBOSS_CONF" ] && . "${JBOSS_CONF}"

# Set defaults.

if [ -z "$JBOSS_HOME" ]; then
  JBOSS_HOME=/opt/jboss-eap-6.4
fi
export JBOSS_HOME

 

Step 04: 註冊 JBOSS 成 Service

[user@host init.d]$ sudo chkconfig --add jboss-as-domain.sh

[user@host init.d]$ sudo chkconfig --level 2345 jboss-as-domain.sh on #設置 jboss-as-domain.sh 在運行級別為2、3、4、5的情況下都是on(開啟)的狀態

 

 這樣子就可以兩台相互備援了.

 

附註:

■ 若同一個環境有不同的 mod_cluster, 為了不要互相引響,可以在 mod_cluster 的httpd.conf 加入 allow 作限制如下:vi $APACHE_HOME/httpd/conf/httpd.conf

## 2015/09/22 added by polin wei
<VirtualHost 192.168.30.100:80>
  <Directory />
    Order deny,allow
    Deny from all
    Allow from all
  </Directory>
  <Location /cluster_manager>
    SetHandler mod_cluster-manager
    Order deny,allow
    Deny from all
    Allow from 192.168.30.
  </Location>
</VirtualHost>

Listen 192.168.30.100:6666
#ManagerBalancerName mycluster   
ManagerBalancerName other-server-group
<VirtualHost 10.10.2.52:6666>
  <Directory />
    Order deny,allow
      Deny from all
      Allow from 192.168.30.100
      Allow from 192.168.30.101
  </Directory>
  ServerAdvertise on http://192.168.30.100:6666
  EnableMCPMReceive
</VirtualHost>

 

 

 

 

 

參考:

http://wiki.lunarpages.com/Allow_and_Deny_by_IP_Address

 

文章標籤

MIS 發表在 痞客邦 留言(0) 人氣()

PTC 的 Windchill 是一個開發圖文管理與專案管理系統,為了有效管理帳號,可以與 windows Server 的 AD 作整合密碼認證。

環境:

Windchill v10.2

windows Server AD: 2003

AD Server資訊如下:
HostName:ad.wei.com
Ldap user:pdm2adldap
Ldap pwd:pdm2adldap

作法:

step 01:開啟windchill shell,進入D:\ptc\windchill_10.2\HTTPServer\,執行下列的指令

ant -f webAppConfig.xml addAuthProvider -DappName=Windchill -DldapUrl="ldap://ad.wei.com:389/DC=wei,DC=com?SAMAccountName?sub?(objectClass=*)" -DproviderName=WeiAD -DbindDn=pdm2adldap -DbindPwd=pdm2adldap

註:若 port:389 登入認證有問題,則用 AD 的 GC port:3268

step 02:修改 D:\ptc\Windchill_10.2\HTTPServer\conf\extra\app-Windchill-Auth.xconf

在# Authenticated resources 下,在每一個 LocationMatch 中的 AuthBasicProvider 中,把 Windchill-WeiAD 放到第一個位置

winchill-ad-auth  

重新啟動Apache即可

 

文章標籤

MIS 發表在 痞客邦 留言(0) 人氣()

之前的 JBoss 的 JBoss EAP6 Domain Mode Setup 與 JBoss EAP6.x Standalone Mode Cluster Configuration 都在 Windows 平台上作測試,現在起將拋棄 微軟 擁抱 Linux,因為後續的資料庫也是使用 Oracle DataBase,因此 Linux 平台選擇 Oracle Linux,大致的安裝過程可以查看 Oracle Linux Install Using LVM

安裝檔下載:

1. Oracle Linux 的來源可從下面取得:

https://edelivery.oracle.com/linux

 

2. 下載JDK:

Oracle的官網可以下載到最新的JDK版本,官網網址如下:http://www.oracle.com/technetwork/java/javase/downloads/index.html

所有的版本:http://www.oracle.com/technetwork/java/archive-139210.html

3. 指令:

會使用到 rpm 或 yum 的安裝移除令,可以參考 yum 基本介紹和參數說明

安裝 JDK 方法一開始(建議以此方法為主):

1. 查詢 Oracle Linux 預設的 openJDK : OracleLinux7.1_x86_64 所搭配的 Java 是 openJDK ,用 rpm -qa | grep java 查詢後將它移除

[root@localhost ~]# rpm -qa | grep java
java-1.7.0-openjdk-1.7.0.75-2.5.4.2.0.1.el7_0.x86_64
python-javapackages-3.4.1-6.el7_0.noarch
javapackages-tools-3.4.1-6.el7_0.noarch
tzdata-java-2015a-1.el7.noarch
java-1.7.0-openjdk-headless-1.7.0.75-2.5.4.2.0.1.el7_0.x86_64

2. 移除 openJDK ,可以使用 yum remove java* 或者 rpm -e package_name 指令

[root@localhost ~]# yum remove java*
Loaded plugins: langpacks
Resolving Dependencies
--> Running transaction check
---> Package java-1.7.0-openjdk.x86_64 1:1.7.0.75-2.5.4.2.0.1.el7_0 will be erased
--> Processing Dependency: java-1.7.0-openjdk for package: icedtea-web-1.5.2-0.el7.x86_64
---> Package java-1.7.0-openjdk-headless.x86_64 1:1.7.0.75-2.5.4.2.0.1.el7_0 will be erased
---> Package javapackages-tools.noarch 0:3.4.1-6.el7_0 will be erased
--> Processing Dependency: jpackage-utils for package: rhino-1.7R4-5.el7.noarch
--> Processing Dependency: jpackage-utils for package: rhino-1.7R4-5.el7.noarch
--> Processing Dependency: jpackage-utils for package: tagsoup-1.2.1-8.el7.noarch
--> Processing Dependency: jpackage-utils >= 1.6 for package: tagsoup-1.2.1-8.el7.noarch
--> Processing Dependency: jpackage-utils for package: jline-1.0-8.el7.noarch
--> Running transaction check
---> Package icedtea-web.x86_64 0:1.5.2-0.el7 will be erased
---> Package jline.noarch 0:1.0-8.el7 will be erased
---> Package rhino.noarch 0:1.7R4-5.el7 will be erased
---> Package tagsoup.noarch 0:1.2.1-8.el7 will be erased
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package                Arch   Version                      Repository     Size
================================================================================
Removing:
 java-1.7.0-openjdk     x86_64 1:1.7.0.75-2.5.4.2.0.1.el7_0 @anaconda/7.1 493 k
 java-1.7.0-openjdk-headless
                        x86_64 1:1.7.0.75-2.5.4.2.0.1.el7_0 @anaconda/7.1  90 M
 javapackages-tools     noarch 3.4.1-6.el7_0                @anaconda/7.1 155 k
Removing for dependencies:
 icedtea-web            x86_64 1.5.2-0.el7                  @anaconda/7.1 1.8 M
 jline                  noarch 1.0-8.el7                    @anaconda/7.1  72 k
 rhino                  noarch 1.7R4-5.el7                  @anaconda/7.1 1.0 M
 tagsoup                noarch 1.2.1-8.el7                  @anaconda/7.1 140 k

Transaction Summary
================================================================================
Remove  3 Packages (+4 Dependent packages)

Installed size: 94 M
Is this ok [y/N]: y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Warning: RPMDB altered outside of yum.
  Erasing    : icedtea-web-1.5.2-0.el7.x86_64                               1/7
  Erasing    : rhino-1.7R4-5.el7.noarch                                     2/7
  Erasing    : jline-1.0-8.el7.noarch                                       3/7
  Erasing    : tagsoup-1.2.1-8.el7.noarch                                   4/7
  Erasing    : 1:java-1.7.0-openjdk-1.7.0.75-2.5.4.2.0.1.el7_0.x86_64       5/7
  Erasing    : 1:java-1.7.0-openjdk-headless-1.7.0.75-2.5.4.2.0.1.el7_0.x   6/7
  Erasing    : javapackages-tools-3.4.1-6.el7_0.noarch                      7/7
  Verifying  : 1:java-1.7.0-openjdk-headless-1.7.0.75-2.5.4.2.0.1.el7_0.x   1/7
  Verifying  : icedtea-web-1.5.2-0.el7.x86_64                               2/7
  Verifying  : tagsoup-1.2.1-8.el7.noarch                                   3/7
  Verifying  : rhino-1.7R4-5.el7.noarch                                     4/7
  Verifying  : 1:java-1.7.0-openjdk-1.7.0.75-2.5.4.2.0.1.el7_0.x86_64       5/7
  Verifying  : jline-1.0-8.el7.noarch                                       6/7
  Verifying  : javapackages-tools-3.4.1-6.el7_0.noarch                      7/7

Removed:
  java-1.7.0-openjdk.x86_64 1:1.7.0.75-2.5.4.2.0.1.el7_0
  java-1.7.0-openjdk-headless.x86_64 1:1.7.0.75-2.5.4.2.0.1.el7_0
  javapackages-tools.noarch 0:3.4.1-6.el7_0

Dependency Removed:
  icedtea-web.x86_64 0:1.5.2-0.el7         jline.noarch 0:1.0-8.el7
  rhino.noarch 0:1.7R4-5.el7               tagsoup.noarch 0:1.2.1-8.el7

Complete!

3. 使用 rpm 指令安裝 jdk-8u45-linux-x64.rpm

[root@localhost tmp]# rpm -ivh jdk-8u45-linux-x64.rpm
正在準備…                       ################################# [100%]
Updating / installing...
   1:jdk1.8.0_45-2000:1.8.0_45-fcs    ################################# [100%]
Unpacking JAR files...
    rt.jar...
    jsse.jar...
    charsets.jar...
    tools.jar...
    localedata.jar...
    jfxrt.jar...
    plugin.jar...
    javaws.jar...
    deploy.jar...
[root@localhost tmp]# java -version
java version "1.8.0_45"
Java(TM) SE Runtime Environment (build 1.8.0_45-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.45-b02, mixed mode)
[root@localhost tmp]# javac -version
javac 1.8.0_45

利用 rpm 安裝完的 JDK,根目錄會在 /usr/java/jdk1.8.0_45

[root@localhost java]# pwd
/usr/java
[root@localhost java]# ls -l
總計 4
lrwxrwxrwx. 1 root root   16  8月 17 16:36 default -> /usr/java/latest
drwxr-xr-x. 9 root root 4096  8月 17 16:36 jdk1.8.0_45
lrwxrwxrwx. 1 root root   21  8月 17 16:36 latest -> /usr/java/jdk1.8.0_45

4. 編輯「/etc/profile」檔案。這個profile檔案裡寫的指令在系統開機時會自動執行。

 使用「export」指令來設定Java相關的系統環境變數。要設定的變數有「JAVA_HOME」、「JRE_HOME」、「PATH」、 「CLASSPATH」。「JAVA_HOME」為JDK的目錄,就是剛剛複製到「/usr/lib」目錄中的JDK目錄,「JRE_HOME」為 JRE(Java Runtime Environment)的目錄,JDK有包含JRE,位置就在JDK目錄下的「jre」目錄。「PATH」變數為系統尋找指令(檔案)的路徑,將 「JAVA_HOME」變數和「JRE_HOME」變數加進原先的「PATH」變數前。「CLASSPATH」變數為Java尋找Java程式所使用到的 Class路徑,路徑可以是目錄也可以是.jar檔案,將目前的目錄「.」和「$JAVA_HOME/lib」與「$JAVA_HOME/jre /lib」加進變數中吧!

 範例如下:

export JAVA_HOME=/usr/java/jdk1.8.0_45
export JRE_HOME=/usr/java/jdk1.8.0_45/jre
export ANT_HOME=/opt/apache-ant-1.7.0
export JBOSS_HOME=/opt/jboss-eap-6.3

export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH:$ANT_HOME/bin
export CLASSPATH=$CLASSPATH:.:$JAVA_HOME/lib:$JRE_HOME/lib

重新關機後,就可以生效。

 

安裝 JDK 方法二開始(特殊需求時使用):

Step 01:將 jdk-8u45-linux-x64.tar.gz 解壓縮在 /opt/jdk1.8.0_45

Linux_JDK.png  

 

 Step 02:編輯「/etc/profile」檔案。這個profile檔案裡寫的指令在系統開機時會自動執行。

export ANT_HOME=/opt/apache-ant-1.7.0
export JAVA_HOME=/opt/jdk1.8.0_45_x64
export JRE_HOME=/opt/jdk1.8.0_45_x64/jre
export JBOSS_HOME=/opt/jboss-eap-6.3

export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH:$ANT_HOME/bin
export CLASSPATH=$CLASSPATH:.:$JAVA_HOME/lib:$JRE_HOME/lib

 重新關機後,就可以生效。

 

安裝 JBoss EAP 開始:

1. 到 https://access.redhat.com/downloads/ 下載 jboss-eap-6.3 的 zip 檔,並解壓縮放在 /opt/jboss-eap-6.3

2. 執行 /opt/jboss-eap-6.3/bin/add-user.sh 增加管理 JBoss EAP Server 的帳號

3. 執行 /opt/jboss-eap-6.3/bin/standalone.sh 就可以手動啟動 JBoss EAP , 並可以在本機輸入網址 http://localhost:9990/console/ 進入管理.

在 Oracle Linux 上建立 JBoss EAP 的 Service

1. 編輯 $JBOSS_HOME/bin/init.d/jboss-as.conf   ,檔案內容至要少有 JBOSS_HOME & JBOSS_USER 這兩個變數的設定。

範例如下:

# General configuration for the init.d scripts,
# not necessarily for JBoss AS itself.

# The username who should own the process.
#
JBOSS_USER=root
JBOSS_HOME=/opt/jboss-eap-6.3

2. 將 $JBOSS_HOME/bin/init.d/jboss-as.conf 複制到 /etc/jboss-as 目錄,與 $JBOSS_HOME/bin/init.d/jboss-as-standalone.sh 複制到 /etc/init.d

Copy the modified configuration file to the /etc/jboss-as directory.

[user@host init.d]$ sudo mkdir /etc/jboss-as

[user@host init.d]$ sudo cp $JBOSS_HOME/bin/init.d/jboss-as.conf /etc/jboss-as/

Copy the start-up script to the /etc/init.d directory.

[user@host init.d]$ sudo cp $JBOSS_HOME/bin/init.d/jboss-as-standalone.sh /etc/init.d

3. 修改 /etc/init.d/jboss-as-standalone.sh 內容,如紅色標注部份,因為 JAVA_HOME 已在前面有設定了, 所以不用再作判斷。

#!/bin/sh
#
# JBoss standalone control script
#
# chkconfig: - 80 20
# description: JBoss AS Standalone
# processname: standalone
# pidfile: /var/run/jboss-as/jboss-as-standalone.pid
# config: /etc/jboss-as/jboss-as.conf

# Source function library.
. /etc/init.d/functions

# Load Java configuration.
#[ -r /etc/java/java.conf ] && . /etc/java/java.conf
#export JAVA_HOME

# Load JBoss AS init.d configuration.
if [ -z "$JBOSS_CONF" ]; then
  JBOSS_CONF="/etc/jboss-as/jboss-as.conf"
fi

[ -r "$JBOSS_CONF" ] && . "${JBOSS_CONF}"

# Set defaults.

if [ -z "$JBOSS_HOME" ]; then
  JBOSS_HOME=/opt/jboss-eap-6.3
fi
export JBOSS_HOME

.

.

.

 

4. 註冊 JBoss 為 Service

[user@host init.d]$ sudo chkconfig --add jboss-as-standalone.sh

 5. 執行指令 setup 檢查 JBoss EAP 的服務是否有設為自動啟動( [*] jboss-as-standalone.sh),若沒有則按空白鍵作設定。這樣啟 OS 時,JBoss EAP 就會自動帶啟。

[root@localhost ~]# setup

linux_setup

setup_jboss_service  

4. 手動啟動/停止/重啟 JBoss

[root@localhost ~]# sudo service jboss-as-standalone start [stop] [restart] [status]

[root@localhost ~]# sudo service jboss-as-standalone
The service command supports only basic LSB actions (start, stop, restart, try-restart, reload, force-reload, status)

 

 

 

參考:

http://magiclen.org/linux-jdk/

https://docs.oracle.com/javase/7/docs/webnotes/install/linux/linux-jdk.html

http://wei-meilin.blogspot.tw/2012/10/jeap-6-red-hat-linux-service.html

https://access.redhat.com/documentation/en-US/JBoss_Enterprise_Application_Platform/6.1/html/Installation_Guide/Install_JBoss_Enterprise_Application_Platform_6_Red_Hat_Enterprise_Linux_Service.html

https://access.redhat.com/documentation/en-US/JBoss_Enterprise_Application_Platform/6.3/html/Installation_Guide/Install_JBoss_Enterprise_Application_Platform_6_Red_Hat_Enterprise_Linux_Service.html

[user@host init.d]$ sudo chkconfig --add jboss-as-standalone.sh
文章標籤

MIS 發表在 痞客邦 留言(0) 人氣()

Windows Server 2003 為 VMware 的 guset ,若要擴展 disk 空間,可以使用 diskpart 的指令來作。作業大致如下:

 

Step 01:Add Additional Space to the Virtual Hard Drive

- Using the vSphere Client, connect to vCenter server or your host.
- Once connected, select your Virtual Machine from the Hosts & Clusters or VMs & Templates view.
- Click "Edit Settings"
- Select your Virtual Disk, and increase the Provisioned Space.
- Click OK

 

Step 02:Extend the Windows Server Volume

- Access your Server (either Open Console from the vSphere Client or RDP)
- Open a Command Prompt
- Use the following commands from the Microsoft KB 325590

實作如下:

C:\>diskpart

Microsoft DiskPart 5.2.3790.3959 Copyright (C) 1999-2001 Microsoft Corporation.
On computer:

DISKPART> list volume

  磁碟區 ###  Ltr  標籤           Fs     類型        大小     狀態     資訊
  ----------  ---  -----------     -----  ----------  -------  ---------  --------
  磁碟區 0     E                    NTFS   簡單           400 GB  狀況良好

  磁碟區 1     Y   新增磁碟區  NTFS   磁碟分割       10 GB  狀況良好

  磁碟區 2     C                    NTFS   磁碟分割      30 GB  狀況良好

  磁碟區 3     D   CRMSVOL_EN   CDFS   DVD-ROM      594 MB  狀況良好


DISKPART> select volume=1

磁碟區 1 是所選擇的磁碟區。

DISKPART> extend

DiskPart 成功地延伸了磁碟區。

DISKPART>exit

PS:磁碟的型態是基本動態(如下圖)所擴展出來的空間會有不同,但在前端看到的是一樣的。

VMware-diskpart.png  

 

參考:

http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1007266

http://community.spiceworks.com/how_to/2824-extend-data-volume-on-a-windows-2003-virtual-machine-vmware-esxi

文章標籤

MIS 發表在 痞客邦 留言(0) 人氣()

環境是 VM vSphere Esxi 5.x Standard

在 vCenter 中看到,系統出現 "Virtual machine disks consolidation is needed" ,代表 vdk 檔要作 consolidation 。但在執行的過程中發生 Unable to access file since it is locked 的錯誤訊息。


 

 

 

解決的方法:

Step 01:用 SSH 連到主機端, 查看 vmware.log ,看是那一個檔被 Lock 。
# vi vmware.log

2015-06-02T09:52:50.430Z| vmx| I120: [msg.nvram.wback1] Could not create '/vmfs/volumes/50eaa6a3-bd303b99-7190-3440b5c68358/PLM/PLM.nvram': Failed to lock the file 2015-06-02T09:52:50.430Z| vmx| I120: ---------------------------------------- 2015-06-02T09:52:50.454Z| vmx| W110: NVRAMMGR: Failed to create default NVRAM file (PLM.nvram)

Step 02:使用指令 mkfstools -D 查看那台主機 lock ,
 # vmkfstools -D PLM.nvram

Lock [type 10c00001 offset 107448320 v 16455, hb offset 3289088
gen 51, mode 1, owner 5480349c-42ed69c6-xxxx-3440b5ca5488 mtime 1279740
num 0 gblnum 0 gblgen 0 gblbrk 0]
Addr <4 105="" 169="">, gen 16414, links 1, type reg, flags 0, uid 0, gid 0, mode 600
len 8684, nb 1 tbz 0, cow 0, newSinceEpoch 1, zla 1, bs 1048576

查到的 3440b5ca5488 即是 MAC 34:40:b5:ca:54:88, 然後去找那一台的 HOST 主機

示意圖:



Step 03: 兩種解決方法
 

方法一:
確定主機後, 在 vCenter 將 host 進入 maintenance mode, 此時 DRS vMotioned all VMs to another host in the cluster , 然後 restarted the hostd service.

SSH 登入主機, 下指令: /etc/init.d/hostd restart

方法二:

若覺得  maintenance mode 要將所有 guest 移到別台 Host 工程太浩大, 那就
將 guest 移到這台Host, 再作 Consolidation 也是可以.



個人是覺得第二個方法最方便. 供參考

Ref :
https://www.vmadmin.co.uk/resources/35-esxserver/411-disk-consolidation-needed-unable-to-access-file-since-it-is-locked

http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=10051

文章標籤

MIS 發表在 痞客邦 留言(0) 人氣()