SAP HANA数据库是内存型数据库,也是SAP产品使用的核心数据库。接下来在PC上安装SAP HANA数据库。

安装之前,访问 PAM(Product Availability Matrxi) 确认安装的SAP HANA数据库支持的OS版本。

目前SAP HANA数据库的最新版本应该是SPS07,后面会安装SAP HANA SPS07。

SAP HANA数据库2.0支持RHEL(RedHat Enterprise Linux Server)7,8,9。在这里选择RHEL的最新版本9.2。可以从PAM上确认到SAP HANA官方支持的OS只有RHEL和SUSE系统,选择哪个OS应该都可以。选择标准应该是是否能够熟练使用该操作系统。

这次使用的OS及SAP HANA数据库的版本如下。

环境 产品 备注
OS RedHat Enterprise Linux Server9.2 分配内存为34GB
SAP HANA数据库 版本2.0 SPS7

关于安装RHEL的方法,参照 VMware Workstation上安装RedHat8,把OS改为RHEL9.2即可。当设定RHEL时,参照了下面的RedHat和SAP Notes。

主机名

SAP HANA数据库可设定的主机名,可包换英文字母,数字以及横杠(-),长度为64字节。并推荐英文字母开始。

使用hostnamectl命令,设定主机名及FQDN。

# hostnamectl set-hostname sys-blog
# hostnamectl set-hostname sys-blog.local

设定后,确认主机名及FQDN。

# hostname -s
sys-blog
# hostname -f
sys-blog.local
# hostname -d
local

接下来,将设定的主机名和FQDN,添加到/etc/hosts文件。

# vi /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.64.156    sys-blog sys-blog.local

安装额外软件包

RHEL上安装SAP产品时,需要安装的软件。

# yum install uuidd
# yum install libnsl
# yum install tcsh
# yum install nfs-utils

RHEL上安装SAP HANA数据库时需要安装的软件。

# yum install expect
# yum install gtk2
# yum install krb5-workstation
# yum install libatomic
# yum install libcanberra-gtk2
# yum install libtool-ltdl
# yum install numactl
# yum install PackageKit-gtk3-module
# yum install xorg-x11-xauth
# yum install chkconfig
# yum install compat-openssl11

为SAP HANA配置RHEL参数,SAP推荐安装的软件包。

# yum install tuned

为了更好地支持SAP HANA数据库,SAP推荐安装的软件包。

# yum install graphviz
# yum install iptraf-ng
# yum install lm_sensors

禁用SELinux

使用 getenforce 命令确认SELinux的状态,默认是Enforcing。

# getenforce
Enforcing

修改 /etc/selinux/config 文件里的 SELINUX 参数为 disabled。

# vi /etc/selinux/config
SELINUX=disabled

reboot 命令重启系统。

Firewalld

停止及禁用Firewalld。

# systemctl status firewalld
● firewalld.service - firewalld - dynamic firewall daemon
     Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled; preset: enabled)
     Active: active (running) since Sun 2023-12-31 12:04:08 CST; 6min ago
       Docs: man:firewalld(1)
   Main PID: 1061 (firewalld)
      Tasks: 2 (limit: 250640)
     Memory: 43.7M
        CPU: 996ms
     CGroup: /system.slice/firewalld.service
             └─1061 /usr/bin/python3 -s /usr/sbin/firewalld --nofork --nopid

Dec 31 12:04:07 rhel92hdb00 systemd[1]: Starting firewalld - dynamic firewall daemon...
Dec 31 12:04:08 rhel92hdb00 systemd[1]: Started firewalld - dynamic firewall daemon.

# systemctl stop firewalld
# systemctl disable firewalld

修改内核参数

根据SAP Notes,新建 /etc/sysctl.d/sap.conf 文件,并修改内核参数。

# vi /etc/sysctl.d/sap.conf
vm.max_map_count = 2147483647
vm.max_map_count = 2147483647

sysctl 命令使设定生效。

# sysctl --system

用户进程级别限制

根据SAP Notes,将sapsys及dba组的用户,可创建的进程数设定为无限制。nproc表示每个用户可创建的最大进程数,通过该参数进行用户级别的进程数限制。

# vi /etc/security/limits.d/99-sap.conf
@sapsys    hard    nproc    unlimited
@sapsys    soft    nproc    unlimited
@dba       hard    nproc    unlimited
@dba       soft    nproc    unlimited

关于用户的指定,一般有3种方法。

  1. 用户:直接指定用户名
  2. 组: @表示后面指定的是一个组。
  3. 所有用户:”*” ,表示所有用户

soft和hard的区别是,soft是一般用户可进行变更的上限,hard是root用户(管理员)可进行变更的上限。

noproc是指定可创建的最大进程数,除最大进程数外,还可以指定下面的参数进行限制。

资源名 内容
nproc 该用户可创建的进程数
maxlogin 最大登录数
fsize 可创建的最大文件大小
as 最大内存空间
stack stack的最大内存容量
data data的最大内存容量
rss 该用户执行的进程,可使用的内存大小
priority 该用户创建的进程的优先度
nofile 用户可使用的文件描述符数量
core cora文件的大小

systemd-tmpfiles

为确保 /tmp 中的重要锁文件和套接字不会被 systemd-tmpfiles 删除,运行SAP应用程序的RHEL9中创建 /etc/tmpfiles.d/sap.conf 文件,并添加下面的内容。

# vi /etc/tmpfiles.d/sap.conf
x /tmp/.sap*
x /tmp/.trex*lock

小结

最终,tuned-profiles-sap-hana 软件包没有安装上去。虽然不是必须安装的软件(不安装的话,无法运行SAP HANA的那种),所以先跳过,有时间再去调查一下。

RHEL的默认Repository上没有没有该安装包,所以修改Repository后试了一下,但提示无法获取Repository的Meta数据。

# subscription-manager repos \
--disable="*" \
--enable="rhel-9-for-$(uname -m)-baseos-e4s-rpms" \
--enable="rhel-9-for-$(uname -m)-appstream-e4s-rpms" \
--enable="rhel-9-for-$(uname -m)-sap-solutions-e4s-rpms" \
--enable="rhel-9-for-$(uname -m)-sap-netweaver-e4s-rpms"

# dnf repolist
Updating Subscription Management repositories.
repo id                                               repo name
rhel-9-for-x86_64-appstream-e4s-rpms                  Red Hat Enterprise Linux 9 for x86_64 - AppStream - Update Services for SAP Solutions (RPMs)
rhel-9-for-x86_64-baseos-e4s-rpms                     Red Hat Enterprise Linux 9 for x86_64 - BaseOS - Update Services for SAP Solutions (RPMs)
rhel-9-for-x86_64-sap-netweaver-e4s-rpms              Red Hat Enterprise Linux 9 for x86_64 - SAP NetWeaver - Update Services for SAP Solutions (RPMs)
rhel-9-for-x86_64-sap-solutions-e4s-rpms              Red Hat Enterprise Linux 9 for x86_64 - SAP Solutions - Update Services for SAP Solutions (RPMs)

# yum install tuned-profiles-sap-hana
Updating Subscription Management repositories.
Red Hat Enterprise Linux 9 for x86_64 - SAP Solutions - Update Services for SAP Solutions (RPMs)                                    2.0  B/s |  10  B     00:05
Errors during downloading metadata for repository 'rhel-9-for-x86_64-sap-solutions-e4s-rpms':
  - Status code: 404 for https://cdn.redhat.com/content/e4s/rhel9/9/x86_64/sap-solutions/os/repodata/repomd.xml (IP: 2.18.220.251)
Error: Failed to download metadata for repo 'rhel-9-for-x86_64-sap-solutions-e4s-rpms': Cannot download repomd.xml: Cannot download repodata/repomd.xml: All mirrors were tried