Artigos
Grid Computing
Por Victor Armbrust
Postado em Janeiro 2014
Indice
1. Oracle Grid Infrastructure 12cR1 - Parte 1 - Visão Geral e Novos Recursos
2. Oracle Grid Infrastructure 12cR1 - Parte 2 - Configurando o Sistema Operacional
3. Oracle Grid Infrastructure 12cR1 - Parte 3 - Pré-Requisitos do Sistema Operacional
4. Oracle Grid Infrastructure 12cR1 - Parte 4 - Configurando DNS
5. Oracle Grid Infrastructure 12cR1 - Parte 5 - Pré-Requisitos do Grid Infrastructure
6. Oracle Grid Infrastructure 12cR1 - Parte 6 - Instalando o Grid Infrastructure
7. Oracle Grid Infrastructure 12cR1 - Parte 7 - Instalando o Database Software
8. Oracle Grid Infrastructure 12cR1 - Parte 8 - Criando Diskgroups no ASM
9. Oracle Grid Infrastructure 12cR1 - Parte 9 - Criando o Database
10.Oracle Grid Infrastructure 12cR1 - Parte 10 - Validações Finais
Executar como “root”
/usr/sbin/groupadd -g 501 oinstall /usr/sbin/groupadd -g 502 dba /usr/sbin/groupadd -g 504 asmadmin /usr/sbin/groupadd -g 506 asmdba /usr/sbin/groupadd -g 507 asmoper
Executar como “root”
/usr/sbin/useradd -u 501 -g oinstall -G asmadmin,asmdba,asmoper,dba grid /usr/sbin/useradd -u 502 -g oinstall -G dba,asmdba oracle
Executar como “root”
passwd oracle Changing password for user oracle. New UNIX password: password retype new UNIX password: password passwd: all authentication tokens updated successfully. passwd grid Changing password for user oracle. New UNIX password: password retype new UNIX password: password passwd: all authentication tokens updated successfully.
Para início automatic no boot
chkconfig anacron off chkconfig atd off chkconfig cups off chkconfig cups-config-daemon off chkconfig gpm off chkconfig iptables off chkconfig kudzu off chkconfig lvm2-monitor off chkconfig microcode_ctl off chkconfig sendmail off chkconfig smartd off chkconfig auditd off chkconfig avahi-daemon off chkconfig bluetooth off chkconfig firstboot off chkconfig hidd off chkconfig ip6tables off chkconfig mcstrans off chkconfig mdmonitor off chkconfig pcscd off chkconfig rawdevices off chkconfig readahead_early off chkconfig readahead_later off chkconfig restorecond off chkconfig setroubleshoot off chkconfig yum-updatesd off chkconfig nfs off chkconfig autofs on chkconfig cpuspeed on chkconfig haldaemon on chkconfig irqbalance on chkconfig messagebus on chkconfig netfs on chkconfig nfslock on chkconfig rpcgssd on chkconfig rpcidmapd on chkconfig portmap on chkconfig pcscd on chkconfig rpcsvcgssd on
*** IMPORTANTE ***
Para ativação do HugePages, o Kernel não pode ser ”Xen” e sim kernel normal ”el5” ou ”el5uek”.
Verificar se o Huge Pages já está ativo:
grep Hugepagesize /proc/meminfo AnonHugePages: 0 kB HugePages_Total: 0 HugePages_Free: 0 HugePages_Rsvd: 0 HugePages_Surp: 0 Hugepagesize: 2048 kB
Basicamente o Huge Pages otimiza alocação de memoria para processos com grande alocação de memoria (assim como instância Oracle). O Cálculo básico para o Huge Pages é:
Huge Pages = Total da Soma de SGAs de todos os Databases em Bytes / 2048
Onde: 2048 bytes = Tamanho de Cada Página no linux
Exemplo:
SGA = 20971520 bytes Páginas Linux= 2048 bytes SGA / Páginas Linux = 10240 páginas
Logo:
vm.nr_hugepages = 10240
Existem 2 opções para cálculo do huge Pages:
1 – Utilizar a formula acima para os Databases, mesmo que estes ainda não existam.
2 – Utilizar o script a seguir para caclular (Necessita que os Databases já estejam online)
Shell Script to Calculate Values Recommended Linux HugePages / HugeTLB Configuration [ID 401749.1])
#!/bin/bash
#
# hugepages_settings.sh
#
# Linux bash script to compute values for the
# recommended HugePages/HugeTLB configuration
#
# Note: This script does calculation for all shared memory
# segments available when the script is run, no matter it
# is an Oracle RDBMS shared memory segment or not.
#
# This script is provided by Doc ID 401749.1 from My Oracle Support
# http://support.oracle.com
# Welcome text
echo "
This script is provided by Doc ID 401749.1 from My Oracle Support
(http://support.oracle.com) where it is intended to compute values for
the recommended HugePages/HugeTLB configuration for the current shared
memory segments. Before proceeding with the execution please note following:
* For ASM instance, it needs to configure ASMM instead of AMM.
* The 'pga_aggregate_target' is outside the SGA and
you should accommodate this while calculating SGA size.
* In case you changes the DB SGA size,
as the new SGA will not fit in the previous HugePages configuration,
it had better disable the whole HugePages,
start the DB with new SGA size and run the script again.
And make sure that:
* Oracle Database instance(s) are up and running
* Oracle Database 11g Automatic Memory Management (AMM) is not setup
(See Doc ID 749851.1)
* The shared memory segments can be listed by command:
# ipcs -m
Press Enter to proceed..."
read
# Check for the kernel version
KERN=`uname -r | awk -F. '{ printf("%d.%d\n",$1,$2); }'`
# Find out the HugePage size
HPG_SZ=`grep Hugepagesize /proc/meminfo | awk '{print $2}'`
if [ -z "$HPG_SZ" ];then
echo "The hugepages may not be supported in the system where the script is being executed."
exit 1
fi
# Initialize the counter
NUM_PG=0
# Cumulative number of pages required to handle the running shared memory segments
for SEG_BYTES in `ipcs -m | cut -c44-300 | awk '{print $1}' | grep "[0-9][0-9]*"`
do
MIN_PG=`echo "$SEG_BYTES/($HPG_SZ*1024)" | bc -q`
if [ $MIN_PG -gt 0 ]; then
NUM_PG=`echo "$NUM_PG+$MIN_PG+1" | bc -q`
fi
done
RES_BYTES=`echo "$NUM_PG * $HPG_SZ * 1024" | bc -q`
# An SGA less than 100MB does not make sense
# Bail out if that is the case
if [ $RES_BYTES -lt 100000000 ]; then
echo "***********"
echo "** ERROR **"
echo "***********"
echo "Sorry! There are not enough total of shared memory segments allocated for
HugePages configuration. HugePages can only be used for shared memory segments
that you can list by command:
# ipcs -m
of a size that can match an Oracle Database SGA. Please make sure that:
* Oracle Database instance is up and running
* Oracle Database 11g Automatic Memory Management (AMM) is not configured"
exit 1
fi
# Finish with results
case $KERN in
'2.4') HUGETLB_POOL=`echo "$NUM_PG*$HPG_SZ/1024" | bc -q`;
echo "Recommended setting: vm.hugetlb_pool = $HUGETLB_POOL" ;;
'2.6') echo "Recommended setting: vm.nr_hugepages = $NUM_PG" ;;
*) echo "Unrecognized kernel version $KERN. Exiting." ;;
esac
# End
Mais informações no Note:
HugePages on Linux: What it Is… and What It Is Not… (Doc ID: 361323.1)
REGRA BASICA
******************************
kernel.shmmax=(METADE DA MEMORIA TOTAL) (ALOCACAO MAXIMA)
kernel.shmmni=(MULTIPLOS DE 4) (BLOCO DE ALOCACAO MINIMA)
kernel.shmall=(1/4 da memoria total ou Memoria total / PAGESIZE (4096) )
******************************
Sistemas 64-bit com 64GB de RAM:
kernel.shmmax=34359738368 kernel.shmmni=4096 kernel.shmall=16777216
Sistemas 64-bit com 32GB de RAM:
kernel.shmmax=17179869184 kernel.shmmni=4096 kernel.shmall=8388608
Sistemas 64-bit com 16GB de RAM:
kernel.shmmax=8589934592 kernel.shmmni=4096 kernel.shmall=4194304
Sistemas 64-bit com 8GB de RAM:
kernel.shmmax=4294967295 kernel.shmmni=4096 kernel.shmall=2097152
Sistemas com 4GB de RAM:
kernel.shmmax=2147483648 kernel.shmmni=4096 kernel.shmall=1048576
Sistemas com 1GB of RAM:
kernel.shmmax=536870912 kernel.shmmni=4096 kernel.shmall=262144
Os parametros abaixo são sugeridos para um sistema 64bits com 4gb de memoria. Somente 1 SGA com 2G
vi /etc/sysctl.conf #Oracle RAC12c kernel.shmmax=2147483648 kernel.shmmni=4096 kernel.shmall=1048576 vm.nr_hugepages=1024
A Oracle recomenda que o default e o maximo do “send buffer” size (SO_SNDBUF socket option) e o default do buffer de receive (SO_RCVBUF socket option) sejam setados para 256KB. A recomendação maxima para o buffer de RECEIVE no 10gr2 é 2MB e no 11gr1 4MB. Os buffers de receive sao usados por portas TCP e UDP para manter dados recebidos enquanto uma aplicação é executada.
Vide Notes:
Health Check Alert: Set net.core.rmem_default greater than or equal to the recommended minimum value [ID 957438.1]
Oracle Database (RDBMS) on Unix AIX,HP-UX,Linux,Mac OS X,Solaris,Tru64 Unix Operating Systems Installation and Configuration Requirements Quick Reference (8.0.5 to 11.2) [ID 169706.1]
Configuração default em bytes para o socket de recebimento de buffers
sysctl -w net.core.rmem_default=262144
Configuração default em bytes para o socket de envio de buffers
sysctl -w net.core.wmem_default=262144
Maximum socket receive buffer size which may be set by using the SO_RCVBUF socket option
sysctl -w net.core.rmem_max=4194304
Maximum socket send buffer size which may be set by using the SO_SNDBUF socket option
sysctl -w net.core.wmem_max=1048576
Configuração final
net.core.rmem_default = 262144 net.core.rmem_max = 4194304 net.core.wmem_default = 262144 net.core.wmem_max = 1048576
Os parametros abaixo são sugeridos para melhorar a performance de um failover no RAC. Para maiores informacoes para seu sistema, consulte o note: 249213.1.
net.ipv4.tcp_keepalive_time=30 net.ipv4.tcp_keepalive_intvl=60 net.ipv4.tcp_keepalive_probes=9 net.ipv4.tcp_retries2=3 net.ipv4.tcp_syn_retries=2
A ordem dos valores abaixo é: SEMMSL, SEMMNS, SEMOPM, and SEMMNI.
1 – O Parametro SEMMSL deve ser configurado com o valor PROCESS mais alto do database(s) rodando no servidor + 10. Exemplo:
PROCESSES = 5000 SEMMSL = PROCESSES + 10 = 5010
2 – O Parametro SEMMNS refere-se ao numero maximo de semaforos que podem ser alocados no LINUX: or SEMMNS =(SEMMSL * SEMMNI). O Default para o parametro SEMMNI deve ser 142. Então: SEMMNS =(5010 * 142) = 711420.
3 – O parametro SEMOPM eh um semaforo que tem que manter o numero maximo de SEMMSL por semaforo e eh recomendavel setar SEMOPM igual a SEMMSL. Uma vez que SEMMSL neste caso é 5010 entao o SEMOPM tambem deve ser 5010.
kernel.sem = 5010 711420 5010 142
Tamanho máximo de arquivos que podem ser abertos pelo SO. O minimo recomendado pela Oracle é 65536. Usando o ASMLIB o numero é menor, uma vez que o ASMLIB não loca arquivos diretamente. O valor recomendado pela oracle é 512 x número de processos definidos no init.ora
fs.file-max = 6815744
Range de Portas TCP
net.ipv4.ip_local_port_range = 9000 65500
Configuração final de parâmentos -/etc/sysctl.conf
#Oracle RAC12c kernel.shmmax=2147483648 kernel.shmmni=4096 kernel.shmall=1048576 vm.nr_hugepages=1024 net.core.rmem_default = 262144 net.core.rmem_max = 4194304 net.core.wmem_default = 262144 net.core.wmem_max = 1048576 net.ipv4.tcp_keepalive_time=30 net.ipv4.tcp_keepalive_intvl=60 net.ipv4.tcp_keepalive_probes=9 net.ipv4.tcp_retries2=3 net.ipv4.tcp_syn_retries=2 kernel.sem = 250 32000 100 128 fs.file-max = 6815744 fs.aio-max-nr = 1048576 net.ipv4.ip_local_port_range = 9000 65500
NOTE: A última informação atualizada sobre parâmetros de Kernel no Linux pode se encontrada no MOS note: 169706.1.
- Atualizar configurações no KERNEL
/sbin/sysctl -p
Para melhorar a performance do Software nos sistemas Linux, é necessário aumentar os valores dos limits no Shell dos usuários ORACLE e GRID:
Os valores abaixo são recomendados pela Oracle.
NOTA:
Não é recomendado configrar o “hard” limit do nofile para o mesmo valor do parâmetro “file-max”. Se isso for feito e os usuários alocarem todos os handles do SO, o sistema ficará sem handles para gerenciar processos, causando travamento. Isso pode significar que novos logins não serão aceitos pelo SO, causando um “hang” geral no sistema.
nproc = Número máximo de processos dos usuários oracle e grid.
nofile = Número máximo de arquivos abertos pelos usuários oracle e grid.
memlock = Tamanho máximo de memória alocada por processo.
Editar /etc/security/limits.conf :
#ORACLE RAC12c grid soft nproc 2047 grid hard nproc 16384 grid soft nofile 1024 grid hard nofile 65536 oracle soft nproc 131072 oracle hard nproc 131072 oracle soft nofile 131072 oracle hard nofile 131072 oracle soft memlock 3145728 oracle hard memlock 3145728
Editar o arquivo/etc/pam.d/login :
#ORACLE RAC12c session required pam_limits.so
Editar o arquivo/etc/profile :
#ORACLE RAC12c if [ $USER = "oracle" ] || [ $USER = "grid" ]; then if [ $SHELL = "/bin/ksh" ]; then ulimit -p 16384 ulimit -n 65536 else ulimit -u 16384 -n 65536 fi umask 022 fi
# cat /etc/sysconfig/selinux # This file controls the state of SELinux on the system. # SELINUX= can take one of these three values: # enforcing - SELinux security policy is enforced. # permissive - SELinux prints warnings instead of enforcing. # disabled - SELinux is fully disabled. SELINUX=disabled # SELINUXTYPE= type of policy in use. Possible values are: # targeted - Only targeted network daemons are protected. # strict - Full SELinux protection. SELINUXTYPE=targeted
Ajustar configurações de rede (/etc/sysconfig/network)
Ajustar Node 1 e Node 2
# cat /etc/sysconfig/network NETWORKING=yes NETWORKING_IPV6=yes HOSTNAME=racnode1 NOZEROCONF=yes
Victor Armbrust é DBA há 10 anos, especialista em Banco de Dados Oracle e Bacharel em Ciências da Computação. Com sólidos conhecimentos em Banco de Dados e Sistemas operacionais, possui certificações OCP 10g/11g. Eleito Oracle ACE Member em 2013. Consultor de Banco de Dados na Oracle ACS Brasil.