[20130220]centos 6.2与hugepages.txt

[20130220]centos 6.2与hugepages.txt

1.昨天把一个刚上线的系统换成使用hugepages.做一个简单记录:

# cat hugepages_settings.sh
#!/bin/bash -x
#
# 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 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}'`

# Initialize the counter
NUM_PG=0

# Cumulative number of pages required to handle the running shared memory segments
for SEG_BYTES in `ipcs -m | awk '{print $5}' | 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

--执行以上脚本,获得如下信息:
Recommended setting: vm.nr_hugepages = 5860

2.修改 /etc/sysctl.conf文件加入如下信息: [我稍微加大一点]
vm.nr_hugepages = 6000

3.修改/etc/security/limits.conf文件加入如下,计算方法是6000*2048=1228800
* soft memlock  12288000
* hard memlock  12288000

2048的信息来源这里:
# cat /proc/meminfo | grep -i hugepagesize
Hugepagesize:       2048 kB

4.启动数据库,发现出现如下提示:
------------[ cut here ]------------
WARNING: at fs/hugetlbfs/inode.c:951 hugetlb_file_setup+0x227/0x250() (Tainted: G           ---------------- T)
Hardware name: PowerEdge R710
Using mlock ulimits for SHM_HUGETLB deprecated
--这里我编辑了一下,折行了.
Modules linked in: ip6table_filter ip6_tables ebtable_nat ebtables ipt_MASQUERADE iptable_nat nf_nat nf_conntrack_ipv4
                   nf_defrag_ipv4 xt_state nf_conntrack ipt_REJECT xt_CHECKSUM iptable_mangle iptable_filter ip_tables
                   bridge autofs4 sunrpc 8021q garp stp llc cachefiles fscache(T) ipv6 vhost_net macvtap macvlan tun
                   kvm uinput power_meter sg ses enclosure dcdbas microcode serio_raw iTCO_wdt iTCO_vendor_support
                   i7core_edac edac_core bnx2 ext4 mbcache jbd2 sr_mod cdrom sd_mod crc_t10dif pata_acpi ata_generic
                   ata_piix megaraid_sas dm_mirror dm_region_hash dm_log dm_mod [last unloaded: speedstep_lib]
Pid: 2924, comm: oracle Tainted: G           ---------------- T 2.6.32-220.17.1.el6.x86_64 #1
Call Trace:
 [] ? warn_slowpath_common+0x87/0xc0
 [] ? warn_slowpath_fmt+0x46/0x50
 [] ? user_shm_lock+0x54/0xc0
 [] ? hugetlb_file_setup+0x227/0x250
 [] ? sprintf+0x40/0x50
 [] ? newseg+0x152/0x290
 [] ? ipcget+0x1f5/0x200
 [] ? sys_shmget+0x59/0x60
 [] ? newseg+0x0/0x290
 [] ? shm_security+0x0/0x10
 [] ? shm_more_checks+0x0/0x20
 [] ? system_call_fastpath+0x16/0x1b
---[ end trace 79a13eb94b968dda ]---

不过数据库启动正常.查询进程 pid=2924不存在.从这行观察
Pid: 2924, comm: oracle Tainted: G           ---------------- T 2.6.32-220.17.1.el6.x86_64 #1
好像应该是oracle的进程.

看alert.log文件:
pga_aggregate_target     = 6719275008
PMON started with pid=2, OS id=2932
PSP0 started with pid=3, OS id=2934
--也没有OS id=2924,奇怪pid=1不存在.难道不是oracle启动出现的信息? 只好留到下次判断了.

参考这个链接: https://oss.oracle.com/el6/docs/RELEASE-NOTES-GA-en.html
              http://www.eygle.com/archives/2011/12/hugepageshugetl.html

hugepages warning messages (9861498)

    An application using hugepages may see a warning message like "Using mlock ulimits for SHM_HUGETLB deprecated." To
    avoid this warning, the application should be configured to use CAP_IPC_LOCK or the process (e.g. Oracle) should be
    added to the hugetlb_shm_group.

--BTW :我并没有出现ORA-27125错误.

# su - oracle
$ id
uid=500(oracle) gid=501(oinstall) groups=501(oinstall),502(dba)

--dba组502,按照上述执行如下:
# echo 502 >| /proc/sys/vm/hugetlb_shm_group

--为了下次启动有效,修改 /etc/sysctl.conf文件加入如下信息:
vm.hugetlb_shm_group = 502        --不确定这样修改是否影响其他程序.

--由于是生产系统现在在使用,许多问题我无法验证,留待下次启动观察.

时间: 2024-10-23 18:51:48

[20130220]centos 6.2与hugepages.txt的相关文章

[20170927]关于hugepages.txt

[20170927]关于hugepages.txt --//今天测试hugepages与内核参数nr_overcommit_hugepages,才发现HugePages_Surp表示什么? --// [20170209]理解pre_page_sga参数.txt  => http://blog.itpub.net/267265/viewspace-2145481/ --// 0927hugepages与nr_overcommit_hugepages =>http://blog.itpub.net

[20170308]再谈hugepages.txt

[20170308]再谈hugepages.txt --//节前跟别人的交流,不幸被我言中.当时是去年5月份的事前,系统迁移,我去观摩,我感觉很奇怪的是内存128G的机器,不知道为什么不 --//应用hugepages,让我吃惊对方并不知道.因为毕竟是别的系统,别人如何做我无权过问.我当时只是提醒如果连接用户数量大,按照他们 --//当时的是设置,有可能会出现内存不足的情况. --//我在链接http://blog.itpub.net/267265/viewspace-2128811/的测试中:

[20130220]快速查看连接数据库的用户数量.txt

[20130220]快速查看连接数据库的用户数量.txt 一般在linux查询连接数据库的用户数量,执行如下命令:ps -ef | grep oracle$ORACLE_SID| grep -v grep |wc --实际上以上的查询不包括后台的进程.oracle    5782     1  0  2012 ?        00:35:29 ora_pmon_orcl1oracle    5784     1  0  2012 ?        00:16:37 ora_diag_orcl1

【原创】在CentOS 5.7上通过YUM安装Erlang的坑爹经历(更新)

      想要在虚拟机上的 Linux 环境下,重新搞一下 RabbitMQ 的相关实验,所以重新折腾了下如何操作: Since RabbitMQ is written in Erlang, we need to have installed the language libraries to run the broker.       首先还是要把 Erlang 的安装搞定,最简单的方式是直接重 官网 上下载源码包或rpm包再安装,但是我是个喜欢折腾的人,所以我选择了另外一种"比较笨拙&qu

CentOS 7下配置hadoop 2.8 分布式集群

Hadoop是一个由Apache基金会所开发的分布式系统基础架构,实现分布式文件系统HDFS,用于存储大数据集,以及可以以流的形式访问(streaming access)文件系统中的数据.Hadoop的框架最核心的设计就是:HDFS和MapReduce.HDFS为海量的数据提供了存储,则MapReduce为海量的数据提供了计算.本文描述了在CentOS 7下,基于三个节点安装hadoop 2.8,供大家参考. 一.基础环境描述 OS版本 [root@namenode ~]# more /etc/

MYSQL使用心得(一) centOS or ubuntu下安装mysql5.6

官方网站 http://www.mysql.com/ 下载 downloads(GA)--> MySQL Community Edition (GPL) 安装依赖 centos yum install gcc gcc-c++ ncurses-devel zip make cmake ubuntu apt-get install gcc g++ cmake make libncurses5-dev bison zip 解压缩 tar -zxvf mysql-5.6.14.tar.gz 注意: 源码

Linux CentOS上安装Couchbase Server的过程

Couchbase 是一个开源的.分布式的.面向文档(document-oriented)的 NoSQL 数据库,并且内置了 Memcached 服务.本文分享的是自己在 Linux 上成功安装 Couchbase Server 的实际操作步骤. Linux 发行版是 CentOS. 1. 下载 Couchbase 安装包 用 wget 命令进行下载: wget http://packages.couchbase.com/releases/2.0.0/couchbase-server-enter

阿里云CentOS Linux服务器上如何用postfix搭建邮件服务器

注:本文的邮件服务器只用于发送邮件,也就是STMP服务器. 一.准备工作 1. 为邮件服务器添加DNS解析 虽然不加DNS解析也能把邮件发出去,但会被大多数邮件服务器当作垃圾邮件.根据我们的实际经验,需要添加三条DNS解析记录:A记录.MX记录.TXT记录.比如域名cnblogs.info,对应的DNS记录如下: 2. 准备存放邮件的硬盘空间 如果用的是阿里云入门级Linux服务器,有一块20G的数据盘未挂载,需要格式化并挂载(假设这里挂载的目录是/data),具体操作步骤见之前的博文阿里云云服

CentOS 5系统中编译安装LNMP的步骤详解

# 手动安装lnmp 包含 libiconv libunwind gperftools libmcrypt mhash mcrypt libpng freetype jpeg gd pcre libmemcached php_memcached(memcached.so)  eaccelerator ZendOptimizer mysql5.5 php5.3 nginx1.2.7 memcached tokyocabinet tokyotyrant #路径 程序存放      /data/ser