需要咋样的主机,需要SAP的工具进行计算,如果自己采购硬件就需要考虑至少5年的数据,如果采用云端的主机,则可以不用管那么多,反正可以弹性扩展,我们选择的AWS的主机,开始也采用最小的256G主机。
1.创建EC2主机
这些步骤很简单,创建VPC,创建子网,创建intenet网关,设置路由表,创建主机,创建弹性ip地址绑定到新申请的主机。
完成这些就可以在控制台中启动主机,你可以使用证书和putty登陆主机(这个地方需要将pem证书转换为ppk),登陆默认用户为ec2-user
成功连接后的第一步更改root密码:sudo passwd root
su root --以root登陆
passwd ec2-user--修改ec2-user的密码
修改主机的名称为sapdev
vim /etc/hostname
2.硬盘规划
因为是开发用,所以硬盘不需要很大,规划的各卷大小如下:
/os 10G
/usr/sap 50g
/haha/data 300G
/hana/log 150G
/hana/shared 256G
/hana/backup 450G
--AWS中创建5个EBS卷(存放data log shared的大小最好为334g或667G),并将这些磁盘挂载到EC2主机
devapp 50G gp2
devdata1 334G gp2
devdata2 334G gp2
devdata3 334G gp2
devbackup 500G st1
--将这些卷附加到新申请的主机上;
3.磁盘分区格式化
fdisk -l
sapdevhana:/home/ec2-user # fdisk -l
Disk /dev/xvda: 10 GiB, 10737418240 bytes, 20971520 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xd17614bd
Device Boot Start End Sectors Size Id Type
/dev/xvda1 2048 616447 614400 300M 83 Linux
/dev/xvda2 616448 20971519 20355072 9.7G 83 Linux
Disk /dev/xvdf: 50 GiB, 53687091200 bytes, 104857600 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/xvdg: 334 GiB, 358629769216 bytes, 700448768 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/xvdh: 334 GiB, 358629769216 bytes, 700448768 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/xvdi: 334 GiB, 358629769216 bytes, 700448768 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/xvdj: 500 GiB, 536870912000 bytes, 1048576000 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
--格式化系统盘
sapdevhana:/home/ec2-user # mkfs.xfs -f /dev/xvdf
--LVM
sapdevhana:/home/ec2-user # lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
xvda 202:0 0 10G 0 disk
├─xvda1 202:1 0 300M 0 part /boot
└─xvda2 202:2 0 9.7G 0 part /
xvdf 202:80 0 50G 0 disk
xvdg 202:96 0 334G 0 disk
xvdh 202:112 0 334G 0 disk
xvdi 202:128 0 334G 0 disk
xvdj 202:144 0 500G 0 disk
--创建设备
sapdevhana:/home/ec2-user # pvcreate /dev/xvdg /dev/xvdh /dev/xvdj /dev/xvdi
Physical volume "/dev/xvdg" successfully created.
Physical volume "/dev/xvdh" successfully created.
Physical volume "/dev/xvdj" successfully created.
Physical volume "/dev/xvdi" successfully created.
--创建卷组(备份和数据分开,因为两种磁盘选择的类型不同)
sapdevhana:/home/ec2-user # vgcreate vghahadata /dev/xvdg /dev/xvdh /dev/xvdi
Volume group "vghahadata" successfully created
sapdevhana:/home/ec2-user # vgcreate vghanabackup /dev/xvdj
Volume group "vghanabackup" successfully created
--lvcreate 创建逻辑卷
sapdevhana:/home/ec2-user # lvcreate -n lvhanadata -L 300G vghahadata
Logical volume "lvhanadata" created.
sapdevhana:/home/ec2-user # lvcreate -n lvhanalog -L 150G vghahadata
Logical volume "lvhanalog" created.
sapdevhana:/home/ec2-user # lvcreate -n lvhanashared -L 256G vghahadata
Logical volume "lvhanashared" created.
sapdevhana:/home/ec2-user # lvcreate -n lvhanabackup -L 450G vghanabackup
Logical volume "lvhanabackup" created.
sapdevhana:/home/ec2-user #
--格式化逻辑卷
sapdevhana:/home/ec2-user # mkfs.xfs /dev/mapper/vghahadata-lvhanadata
sapdevhana:/home/ec2-user # mkfs.xfs /dev/mapper/vghahadata-lvhanalog
sapdevhana:/home/ec2-user # mkfs.xfs /dev/mapper/vghahadata-lvhanashared
sapdevhana:/home/ec2-user # mkfs.xfs /dev/mapper/vghanabackup-lvhanabackup
这个时候我们df -h还是看不到的,需要挂载
--创建目录
mkdir /hana /hana/log /hana/data /hana/shared /hana/backup /usr/sap
--创建swap
sapdevhana:/home/ec2-user # mkswap /dev/xvdk
Setting up swapspace version 1, size = 200 GiB (214748360704 bytes)
no label, UUID=01d4b696-474d-446e-9d9a-0a2b909aa698
sapdevhana:/home/ec2-user # swapon /dev/xvdk
sapdevhana:/home/ec2-user # swapon -s
Filename Type Size Used Priority
/dev/xvdk partition 209715196 0 -1
--修改fstab自动挂载
/dev/xvdf /usr/sap xfs defaults 1 1
/dev/mapper/vghahadata-lvhanadata /hana/data xfs defaults 1 1
/dev/mapper/vghahadata-lvhanalog /hana/log xfs defaults 1 1
/dev/mapper/vghahadata-lvhanashared /hana/shared xfs dets 1 1
/dev/mapper/vghanabackup-lvhanabackup /hana/backup xfs defaults 1 1
/dev/xvdk swap swap default 0 0
--挂载
sapdevhana:/mount -a
--查看结果
sapdevhana:/hana # df -h
Filesystem Size Used Avail Use% Mounted on
devtmpfs 121G 0 121G 0% /dev
tmpfs 121G 0 121G 0% /dev/shm
tmpfs 121G 18M 121G 1% /run
tmpfs 121G 0 121G 0% /sys/fs/cgroup
/dev/xvda2 9.7G 1.4G 8.4G 14% /
/dev/xvda1 297M 71M 227M 24% /boot
tmpfs 25G 0 25G 0% /run/user/1000
/dev/xvdf 50G 33M 50G 1% /usr/sap
/dev/mapper/vghahadata-lvhanadata 300G 33M 300G 1% /hana/data
/dev/mapper/vghahadata-lvhanalog 150G 33M 150G 1% /hana/log
/dev/mapper/vghahadata-lvhanashared 256G 33M 256G 1% /hana/shared
/dev/mapper/vghanabackup-lvhanabackup 450G 33M 450G 1% /hana/backup
sapdevhana:/hana # lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
xvda 202:0 0 10G 0 disk
├─xvda1 202:1 0 300M 0 part /boot
└─xvda2 202:2 0 9.7G 0 part /
xvdf 202:80 0 50G 0 disk /usr/sap
xvdg 202:96 0 334G 0 disk
└─vghahadata-lvhanadata 254:0 0 300G 0 lvm /hana/data
xvdh 202:112 0 334G 0 disk
└─vghahadata-lvhanalog 254:1 0 150G 0 lvm /hana/log
xvdi 202:128 0 334G 0 disk
└─vghahadata-lvhanashared 254:2 0 256G 0 lvm /hana/shared
xvdj 202:144 0 500G 0 disk
└─vghanabackup-lvhanabackup 254:3 0 450G 0 lvm /hana/backup
xvdk 202:160 0 200G 0 disk [SWAP]
4.系统配置
HANA主机操作系统使用的是SUSE Linux Enterprise Server 12 SP4
sapdevhana:/home/ec2-user # cat /etc/os-release
NAME="SLES"
VERSION="12-SP4"
VERSION_ID="12.4"
PRETTY_NAME="SUSE Linux Enterprise Server 12 SP4"
ID="sles"
ANSI_COLOR="0;32"
CPE_NAME="cpe:/o:suse:sles:12:sp4"
--看看是否有补丁更新
sapdevhana:/home/ec2-user # sudo zypper list-patches
Refreshing service 'cloud_update'.
Loading repository data...
Reading installed packages...
No updates found.
sudo zypper patch --category=security,recommended --severity=critical,important --dry-run
sudo zypper patch --category=security,recommended --severity=critical,important
--修改主机名
修改规划的HANA数据库主机,应用主机名,并在hosts中将ip地址和主机名的关系维护好
--假设主机和ip定义如下
192.168.0.11 sapdevapp`
192.168.0.12 sapdevhana
sapdev:/hana # vi /etc/hostname
dapdev:/hana # vi /etc/hosts
到这里SAP HANA的主机已经准备好,可以具备安装SAP HANA的条件。