Você está na página 1de 19

4435

Administrao JBoss AS 7 com


Alta Performance e Produtividade

www.4linux.com.br

Projetos na sua empresa


com a qualidade dos treinamentos

ence
Business Intelig lx8
F
u/
.m
va
http://

BPM
http://va.mu/EuiT

Servidor Java EE
http://va.mu/FlyB

PostgreSQL
http://va.mu/EuhV

Monitoramento
http://va.mu/EukN

Virtualizao
http://va.mu/Flxl

Groupware Yj
u/FN
http://va.m

Backup
http://va.mu/Flxr

Auditoria e Anlise
http://va.mu/Flxu

Segurana
http://va.mu/Flxy

Ensino Distncia
http://va.mu/Flxc

Integrao Continua
http://va.mu/FlyD

GED - ECM
http://va.mu/Flx3

Alta Disponibilidade
http://va.mu/FNbL

Infraestrutura Web
http://va.mu/Flxi

Implantao garantida
http://va.mu/GcFv

Contedo
Contedo Complementar: Instalao do RHQ Server + Banco + Agent

0.1 Instalao do banco PostgreSQL . . . . . . . . . . . . . . . . . . . . . .

0.2 Instalao do RHQ Server . . . . . . . . . . . . . . . . . . . . . . . . . .

0.2.1 Instalao e configurao do JDK . . . . . . . . . . . . . . . . .

0.2.2 Configurao das variveis de ambiente JAVA . . . . . . . . . .

0.2.3 Instalao do RHQ Server

. . . . . . . . . . . . . . . . . . . . .

0.3 Instalao do RHQ Agent . . . . . . . . . . . . . . . . . . . . . . . . . . 11

Contedo Complementar: Instalao


do RHQ Server + Banco + Agent
0.1 Instalao do banco PostgreSQL
Para instalar o PostgreSQL 9.3 execute as seguintes etapas:
Executar os comandos na mquina DB DevOps 2

1 - Configure o repositrio da distribuio

root@db - devops2 :~ # vim / etc / apt / sources . list

....

3
4

deb http :// apt . postgresql . org / pub / repos / apt precise - pgdg main

2 - Obtenha a chave pblica do repositrio dpkg e faa sua instalao:

root@db - devops2 :~ # wget -- quiet -O - https :// www . postgresql . org /


media / keys / ACCC4CF8 . asc | apt - key add -

3 - Antes de instalar, atualizar a lista de pacotes:

0.1 Instalao do banco PostgreSQL

4Linux www.4linux.com.br

root@db - devops2 :~ # aptitude update

4 - E instale o pacote do servidor PostgreSQL.

root@db - devops2 :~ # apt - get install postgresql -9.3

Em distribuies Debian preciso alterar a linha precise-pgdg para wheezypgdg.

5 - Crie o banco e usurio para o RHQ Server

root@db - devops2 :~ # su - postgres

postgres@db - devops2 :~ $ psql

psql (9.3.3)

Digite " help " para ajuda .

postgres = # CREATE DATABASE rhq ;

postgres = # CREATE ROLE rhqadmin LOGIN ;

postgres = # \ password rhqadmin

8
9
10

Digite nova senha : 4 linux


Digite -a novamente : 4 linux

11
12

postgres = # \ q

13

postgres@db - devops2 :~ $ exit

6 - Agora precisamos liberar a conexo do servidor ao banco de dados do RHQ,


para isso edite o arquivo pg_hba.conf conforme abaixo e acrescente a linha em
destaque.

Pgina 2

Administrao JBoss AS 7 com Alta Performance e Produtividade

4Linux www.4linux.com.br

0.1 Instalao do banco PostgreSQL

root@db - devops2 :~ # vim / etc / postgresql /9.3/ main / pg_hba . conf

2
3

# ## Final do arquivo

....

5
6

host

rhq

rhqadmin

192.168.100.100/32

md5

7 - Outro ponto importante que merece ateno o IP no qual o PostgreSQL est fazendo binding ports. Defina o caracter * para aceitar conexes em todas as interfaces
da mquina DB DevOps 2.

root@db - devops2 :~ # vim / etc / postgresql /9.3/ main / postgresql . conf

2
3

# ## Linha 59

4
5

....

6
7

listen_addresses = *

8 - Reinicie o banco de dados e realize o teste de conexo.

root@db - devops2 :~ # service postgresql restart

root@db - devops2 :~ # psql -h localhost -U rhqadmin rhq

psql (9.3.3)

conex o SSL ( cifra : DHE - RSA - AES256 - SHA , bits : 256)

Digite " help " para ajuda .

rhq = >\ q

9 - Conceder as permisses necessrias ao usurio

root@db - devops2 :~ # su - postgres

postgres@db - devops2 :~ $ psql rhq

Administrao JBoss AS 7 com Alta Performance e Produtividade

Pgina 3

0.2 Instalao do RHQ Server

psql (9.3.3)

Digite " help " para ajuda .

4Linux www.4linux.com.br

5
6

rhq =# GRANT SELECT , UPDATE , DELETE , INSERT ON ALL TABLES IN SCHEMA


public TO rhqadmin ;

rhq =# \q

postgres@db - devops2 :~ $ exit

0.2 Instalao do RHQ Server

0.2.1 Instalao e configurao do JDK


Executar os comandos na mquina Monitoring Server

1 - Instale o pacote openjdk-7-jdk para criar o ambiente Java

[ root@monitoramento :~ # apt - get install openjdk -7 - jdk -y

2 - Confirme a verso do Java atravs do seguinte comando:

root@monitoramento :~ # java - version

java version " 1.7.0 _55 "

OpenJDK Runtime Environment ( IcedTea 2.4.7) (7 u55 -2.4.7 -1 ubuntu1


~0.12.04.2)

OpenJDK Client VM ( build 24.51 - b03 , mixed mode , sharing )

Pgina 4

Administrao JBoss AS 7 com Alta Performance e Produtividade

4Linux www.4linux.com.br

0.2 Instalao do RHQ Server

0.2.2 Configurao das variveis de ambiente JAVA


Executar os comandos na mquina Monitoring Server

1 - Adicione no final do arquivo /etc/profile as variveis de ambiente JAVA:

root@monitoramento :~ # vim / etc / profile

2
3

....

4
5

export JAVA_HOME = " / usr / lib / jvm / java -7 - openjdk - i386 "

export PATH = $PATH : $JAVA_HOME / bin

2 - Recarregue as novas variveis e verifique o contedo da varivel JAVA_HOME

root@monitoramento :~ # source / etc / profile

2
3

root@monitoramento :~ # echo $JAVA_HOME

/ usr / lib / jvm / java -7 - openjdk - i386

0.2.3 Instalao do RHQ Server


1 - Faa o download do RHQ Server no site do Sourceforge

root@monitoramento :~ # wget http :// downloads . sourceforge . net / project /


rhq / rhq / rhq -4.12/ rhq - server -4.12.0. zip

2 - Descompacte no diretrio /opt e renomeie a pasta de destino para rhq

Administrao JBoss AS 7 com Alta Performance e Produtividade

Pgina 5

0.2 Instalao do RHQ Server

4Linux www.4linux.com.br

root@monitoramento :~ # unzip rhq - server -4.12.0. zip -d / opt

root@monitoramento :~ # mv / opt / rhq - server -4.12.0 / opt / rhq

3 - Gere o hash da senha do banco do RHQ (4linux) atravs do script rhq-encodepassword.sh.

root@monitoramento :~ # / opt / rhq / bin / rhq - encode - password . sh

16:18:09 ,162 INFO

[ org . jboss . modules ] JBoss Modules version 1.3.0.

Final - redhat -2
3

Password : 4 linux ( digite a senha para acessar o banco rhq )

16:18:13 ,329 INFO

[ org . rhq . enterprise . server . installer . Installer ]

*** Encoded password for rhq - server . properties :


5

16:18:13 ,331 INFO


***

[ org . rhq . enterprise . server . installer . Installer ]

rhq . server . database . password = -2 b765a2b785bab70

4 - Edite o arquivo de configurao do RHQ e altere as seguintes diretivas:

root@monitoramento :~ # vim / opt / rhq / bin / rhq - server . properties

2
3

....

4
5

# ## Linha 22 ( IP do servidor de Banco de dados Postgres )

rhq . server . database . connection - url = jdbc : postgresql


://192.168.100.100:5432/ rhq

7
8
9

# ## Linha 24 ( Hash da senha gerada pelo script rhq - encode - password .


sh )

10

rhq . server . database . password = -2 b765a2b785bab70

11
12
13

# ## Linha 26 ( IP do servidor de Banco de dados Postgres )

14

rhq . server . database . server - name =192.168.100.100

Pgina 6

Administrao JBoss AS 7 com Alta Performance e Produtividade

4Linux www.4linux.com.br

0.2 Instalao do RHQ Server

15
16

....

17
18

# ## Linha 83 ( IP do servidor Monitoring Server )

19

jboss . bind . address =192.168.100.200

20
21
22

# ## Linha 84 ( IP do servidor Monitoring Server )

23

jboss . bind . address . management =192.168.100.200

24
25

....

5 - Em seguida crie o diretrio para armazenar o RHQ Storage (DICA: Use um ponto
de montagem com RAID + LVM)

root@monitoramento :~ # mkdir / rhq - storage

6 - E execute o script rhqctl para instalar o RHQ Server, utilizando o diretrio /rhqstorage como Storage Data.

root@monitoramento :~ # / opt / rhq / bin / rhqctl install -- storage - data root - dir =/ rhq - storage

16:31:32 ,073 INFO

[ org . jboss . modules ] JBoss Modules version 1.3.0.

Final - redhat -2
3

16:31:32 ,282 INFO

[ org . rhq . server . control . command . Install ]

Preparing to install RHQ storage node .


4

Starting RHQ Storage Installer ...

16:31:32 ,670 INFO

[ org . jboss . modules ] JBoss Modules version 1.3.0.

Final - redhat -2
6

16:31:32 ,774 INFO

[ org . rhq . storage . installer . StorageInstaller ]

Running RHQ Storage Node installer ...


7

16:31:32 ,831 INFO

[ org . rhq . storage . installer . StorageInstaller ]

Checking perms for / rhq - storage / saved_caches

Administrao JBoss AS 7 com Alta Performance e Produtividade

Pgina 7

0.2 Instalao do RHQ Server

16:31:32 ,833 INFO

4Linux www.4linux.com.br

[ org . rhq . storage . installer . StorageInstaller ]

Checking perms for / rhq - storage / commit_log


9

16:31:32 ,834 INFO

[ org . rhq . storage . installer . StorageInstaller ]

Checking perms for / rhq - storage / data


10

16:31:32 ,838 INFO

[ org . rhq . cassandra . Deployer ] Unzipping storage

node to / opt / rhq / rhq - storage


11

16:31:33 ,132 INFO

[ org . rhq . cassandra . Deployer ] Applying

configuration changes to / opt / rhq / rhq - storage / conf / cassandra . yaml


12

16:31:33 ,158 INFO

[ org . rhq . cassandra . Deployer ] Applying

configuration changes to / opt / rhq / rhq - storage / conf / log4j - server .


properties
13

16:31:33 ,161 INFO

[ org . rhq . cassandra . Deployer ] Applying

configuration changes to / opt / rhq / rhq - storage / conf / cassandra - jvm .


properties
14

16:31:33 ,170 INFO

[ org . rhq . cassandra . Deployer ] Updating file

permissions in / opt / rhq / rhq - storage / bin


15

16:31:33 ,175 INFO

[ org . rhq . storage . installer . StorageInstaller ]

Updating rhq - server . properties ...


16

16:31:33 ,181 INFO

[ org . rhq . storage . installer . StorageInstaller ]

Installation of the storage node is complete


17

16:31:33 ,188 INFO

[ org . rhq . server . control . command . Install ] The

storage node installer has finished with an exit value of 0


18
19

INFO 16:31:34 ,159 Logging initialized


16:31:36 ,416 INFO

[ org . rhq . server . control . command . Install ] The RHQ

Server must be started to complete its installation . Starting the


RHQ server in preparation of running the server installer ...
20

Trying to start the RHQ Server ...

21

RHQ Server

( pid 1633

) is starting

22
23

....

7 - Ao final da instalao verifique as seguintes informaes:

....

2
3

======================================

Pgina 8

Administrao JBoss AS 7 com Alta Performance e Produtividade

4Linux www.4linux.com.br

ANT target [( default ) ]

Fri Aug 29 16:32:43 BRT 2014

======================================

[ header - for - install ] [ echo ]

===== RHQ AGENT INSTALL =====

Installing Agent To : / opt

0.2 Instalao do RHQ Server

10

Version : 4.12.0

11

Build Number : 4905 f6e

12

Jar File : / opt / rhq / modules / org / rhq / server - startup / main / deployments /
rhq . ear / rhq - downloads / rhq - agent / rhq - enterprise - agent -4.12.0. jar

13

[ install ] [ echo ] Extract the agent distro zip from the agent update
binary

14

[ install ] [ unjar ] Expanding : / opt / rhq / modules / org / rhq / server - startup
/ main / deployments / rhq . ear / rhq - downloads / rhq - agent / rhq - enterprise agent -4.12.0. jar into / opt / rhq

15

[ install ] [ echo ] Unzip the agent distro into the new installation
directory

16

[ install ] [ unzip ] Expanding : / opt / rhq / rhq - enterprise - agent -4.12.0.


zip into / opt

17

[ install ] [ echo ] chmod + x on executables under / opt / rhq - agent

18

[ install ] [ echo ] Remove the agent distro zip

19

[ install ] [ delete ] Deleting : / opt / rhq / rhq - enterprise - agent -4.12.0.


zip

20

[ install ] [ echo ] DONE ! Agent version 4.12.0 ( build number =4905 f6e )
has been installed to / opt

21

16:32:45 ,079 INFO

[ org . rhq . server . control . command . Install ] The

agent installer finished running with exit value 0


22

16:32:45 ,080 INFO

[ org . rhq . server . control . command . Install ]

Configuring the RHQ agent with default configuration file : / opt /


rhq - agent / conf / agent - configuration . xml
23

16:32:45 ,109 INFO

[ org . rhq . server . control . command . Install ] Finished

configuring the agent


24

Trying to stop the RHQ Server ...

25

RHQ Server ( pid =1633) is stopping ...

26

RHQ Server has stopped .

27

Stopping RHQ storage node ...

28

RHQ storage node ( pid =1437) is stopping ...

Administrao JBoss AS 7 com Alta Performance e Produtividade

Pgina 9

0.2 Instalao do RHQ Server

29

4Linux www.4linux.com.br

RHQ storage node has stopped

8 - O prximo passo iniciar o servidor RHQ Server para testar a instalao:

root@monitoramento :~ # / opt / rhq / bin / rhqctl start

16:44:58 ,604 INFO

[ org . jboss . modules ] JBoss Modules version 1.3.0.

Final - redhat -2
3

INFO 16:45:00 ,296 Logging initialized

Trying to start the RHQ Server ...

RHQ Server

Starting RHQ Agent ...

RHQ Agent ( pid 3222 ) is running

( pid 2985

) is starting

9 - Verifique se a porta para acesso grfico foi aberta no servidor

root@monitoramento :~ # netstat - putan | grep 7080

tcp

0
OU A

tcp

0 192.168.100.200:7080

0.0.0.0:*

3093/ java
0

TIME_WAIT

0 192.168.100.200:43310

192.168.100.200:7080

10 - Para terminar alterne para a mquina Help Desk Support e no navegador digite
o seguinte endereo:

http://192.168.100.200:7080

Logue com o usurio rhqadmin e senha rhqadmin.

Pgina 10

Administrao JBoss AS 7 com Alta Performance e Produtividade

4Linux www.4linux.com.br

0.3 Instalao do RHQ Agent

0.3 Instalao do RHQ Agent


Executar os comandos nas mquinas com JBoss (Exemplo JBoss03)

1 - Para comear faa o download o Agent do RHQ na pasta do /opt/jboss e altere


as permisses de acesso

root@jboss03 :~ # wget http ://192.168.100.200:7080/ agentupdate /


download -O / opt / jboss / rhq - enterprise - agent -4.12.0. jar

2
3

root@jboss03 :~ # chown juser . juser / opt / jboss / rhq - enterprise - agent


-4.12.0. jar

2 - Alterne para o usurio juser e instale o Agent do RHQ

root@jboss03 :~ # su - juser

juser@jboss03 :~ $ java - jar rhq - enterprise - agent -4.12.0. jar -- install

======================================

ANT target [( default ) ]

Fri Aug 29 17:14:58 BRT 2014

======================================

[ header - for - install ] [ echo ]

===== RHQ AGENT INSTALL =====

Installing Agent To : .

10

Version : 4.12.0

11

Build Number : 4905 f6e

12

Jar File : / opt / jboss - as -7.1.1. Final / rhq - enterprise - agent -4.12.0. jar

13

[ install ] [ echo ] Extract the agent distro zip from the agent update
binary

14

[ install ] [ unjar ] Expanding : / opt / jboss - as -7.1.1. Final / rhq enterprise - agent -4.12.0. jar into / opt / jboss - as -7.1.1. Final

15

[ install ] [ echo ] Unzip the agent distro into the new installation
directory

Administrao JBoss AS 7 com Alta Performance e Produtividade

Pgina 11

0.3 Instalao do RHQ Agent

16

4Linux www.4linux.com.br

[ install ] [ unzip ] Expanding : / opt / jboss - as -7.1.1. Final / rhq enterprise - agent -4.12.0. zip into / opt / jboss - as -7.1.1. Final

17

[ install ] [ echo ] chmod + x on executables under ./ rhq - agent

18

[ install ] [ echo ] Remove the agent distro zip

19

[ install ] [ delete ] Deleting : / opt / jboss - as -7.1.1. Final / rhq enterprise - agent -4.12.0. zip

20

[ install ] [ echo ] DONE ! Agent version 4.12.0 ( build number =4905 f6e )
has been installed to .

3 - O prximo passo configurar o Agent do RHQ atravs do script rhq-agentwrapper.sh

juser@jboss03 :~ $ rhq - agent / bin / rhq - agent - wrapper . sh config

Configure RHQ Agent ...

RHQ 4.12.0 [4905 f6e ] ( Fri Jul 11 14:26:38 BRT 2014)

** Advanced Setup **

Answer the following questions to setup this RHQ Agent instance .

This will ask for basic and secondary configuration preferences

thus allowing you to fine tune the agent via these advanced settings
.

Please refer to the help text and documentation if you are not sure

what a setting does or what are its appropriate values .

10

- After each prompt , a default value will appear in square brackets .

11

If you press the ENTER key without providing any value ,

12

the new preference value will be set to that default value .

13
14
15
16
17

- If you wish to rely on the system internal default value and


not define any preference value , enter !* .
- If you wish to stop before finishing all the questions but still
retain those preferences you already set , enter !+ .
- If you wish to cancel before finishing all the questions and
revert

18
19

all preferences back to their original values , enter ! - .


- If you need help for a particular preference , enter !? .

20
21

Agent Name [ jboss03 . dexter . com . br ] : ( Tecle Enter para confirmar )

22

Pgina 12

Administrao JBoss AS 7 com Alta Performance e Produtividade

4Linux www.4linux.com.br

23

0.3 Instalao do RHQ Agent

Agent Hostname or IP Address [!*] : 192.168.200.2 ( Digite o IP do


servidor JBoss )

24
25

Agent Port [16163] : ( Tecle Enter para confirmar )

26
27

Agent Transport Protocol [ socket ] : ( Tecle Enter para confirmar )

28
29

Agent Transport Parameters [ numAcceptThreads =1& maxPoolSize =303&


clientMaxPoolSize =304& socketTimeout =60000& enableTcpNoDelay = true &
backlog =200] : ( Tecle Enter para confirmar )

30
31

RHQ Server Hostname or IP Address [192.168.200.2] : 192.168.100.200


( Digite o IP do servidor RHQ )

32
33

RHQ Server Port [7080] : ( Tecle Enter para confirmar )

34
35

RHQ Server Transport Protocol [ servlet ] : ( Tecle Enter para


confirmar )

36
37

RHQ Server Transport Parameters [/ jboss - remoting - servlet - invoker /


ServerInvokerServlet ] : ( Tecle Enter para confirmar )

38
39

RHQ Server Alias [ rhqserver ] : ( Tecle Enter para confirmar )

40
41

The setup has been completed for the preferences at node [/ rhq - agent
/ default ].

4 - Para testar a instalao do Agent RHQ, inicie o servio atravs do script rhqagent-wrapper.sh com a opo start.

juser@jboss03 :~ $ rhq - agent / bin / rhq - agent - wrapper . sh start

Administrao JBoss AS 7 com Alta Performance e Produtividade

Pgina 13