Linux7(CentOS,RHEL,OEL)和Oracle RAC环境系列-8-在Linux7上安装11.2 RAC和12.1 RAC需要禁用哪些服务

安装Oracle RAC的时候,通常我们会禁用一些服务,比如:防火墙,avahi-daemon等等。
avahi-daemon是一种Linux操作系统上运行在客户机上实施查找基于网络的Zeroconf service的服务守护进程。
该服务可以为Zeroconf网络实现DNS服务发现及DNS组播规范,它可以在没有 DNS 服务的局域网里发现基于 zeroconf 协议的设备和服务。
用户程序通过Linux D-Bus信息传递接收发现到网络服务和资源的通知。
一般安装Oracle RAC,建议禁用该服务。
.
我们看一下,在Linux7(Linux5和Linux6中)以前我们一般禁用的服务列很多
例如:

chkconfig --level 2345 auditd off && service auditd stop 
chkconfig --level 2345 autofs off && service autofs stop 
chkconfig --level 2345 avahi-daemon off && service avahi-daemon stop
chkconfig --level 2345 bluetooth off && service bluetooth stop
chkconfig --level 2345 cups off && service cups stop 
chkconfig --level 2345 ip6tables off && service ip6tables stop 
chkconfig --level 2345 iptables off && service iptables stop 
chkconfig --level 2345 isdn off && service isdn stop 
chkconfig --level 2345 smartd off && service smartd stop
chkconfig --level 2345 xinet off && service xinet stop
chkconfig --level 2345 yum-updatesd off && service yum-updatesd stop

等等
然后,在linux7下,已经不适用chkconfig命令了,而且很多以前的服务名称和启动配置都变化了(参考blog中Linux7管理开机启动服务的相关文章)
那么我们现在怎么禁用服务,禁用哪些呢?
首先,看看系统中当前运行了哪些服务:

[root@lunar1 ~]# ll /etc/systemd/system/
总用量 8
drwxr-xr-x. 2 root root   30 1月  16 09:49 basic.target.wants
lrwxrwxrwx. 1 root root   44 1月  16 03:02 dbus-org.freedesktop.ModemManager1.service -> /usr/lib/systemd/system/ModemManager.service
lrwxrwxrwx. 1 root root   46 1月  16 02:55 dbus-org.freedesktop.NetworkManager.service -> /usr/lib/systemd/system/NetworkManager.service
lrwxrwxrwx. 1 root root   57 1月  16 02:55 dbus-org.freedesktop.nm-dispatcher.service -> /usr/lib/systemd/system/NetworkManager-dispatcher.service
lrwxrwxrwx. 1 root root   41 1月  16 06:28 default.target -> /usr/lib/systemd/system/multi-user.target
drwxr-xr-x. 2 root root   85 1月  16 02:52 default.target.wants
drwxr-xr-x. 2 root root   37 1月  16 03:01 dev-virtio\x2dports-org.qemu.guest_agent.0.device.wants
lrwxrwxrwx. 1 root root   35 1月  16 02:55 display-manager.service -> /usr/lib/systemd/system/gdm.service
drwxr-xr-x. 2 root root   31 1月  16 02:52 getty.target.wants
drwxr-xr-x. 2 root root   63 1月  16 02:55 graphical.target.wants
drwxr-xr-x. 2 root root 4096 1月  16 11:47 multi-user.target.wants
drwxr-xr-x. 2 root root   30 1月  16 02:56 remote-fs.target.wants
drwxr-xr-x. 2 root root   91 1月  16 11:34 sockets.target.wants
drwxr-xr-x. 2 root root   35 1月  16 03:00 spice-vdagentd.target.wants
drwxr-xr-x. 2 root root 4096 1月  16 02:57 sysinit.target.wants
drwxr-xr-x. 2 root root   43 1月  16 02:52 system-update.target.wants
[root@lunar1 ~]# 

在前面的blog中已经有了禁用防火墙的描述,这里不赘述。
安装Oracle,除了防火墙和SELINUX以外,通常还需要禁用以下服务
Linux7以前的命令:

	service NetworkManager stop
	service iptables stop
	service ip6tables stop

在Linux7中使用systemctl stop和systemctl disable:

	systemctl status firewalld.service
	systemctl stop firewalld.service
	systemctl disable firewalld.service 
	systemctl stop iptables.service
	systemctl stop ip6tables.service
	systemctl disable iptables.service
	systemctl disable ip6tables.service
	systemctl status iptables.service
	systemctl status ip6tables.service

在Linux6以前,我们使用chkconfig –list查看当前的服务,但是在Linux7中,大部分情况我们使用systemctl
如果使用chkconfig –list,则输出类似如下:

[root@lunar1 ~]# chkconfig --list

注意:该输出结果只显示 SysV 服务,并不包含原生 systemd 服务。SysV 配置数据可能被原生 systemd 配置覆盖。 
      如果您想列出 systemd 服务,请执行 'systemctl list-unit-files'。
      欲查看对特定 target 启用的服务请执行
      'systemctl list-dependencies [target]'。

netconsole      0:关    1:关    2:关    3:关    4:关    5:关    6:关
network         0:关    1:关    2:开    3:开    4:开    5:开    6:关
[root@lunar1 ~]# 

执行chkconfig的命令提示很清晰,他告诉我们,使用chkconfig将只显示SysV的服务,不包含原生 systemd服务。

我们查询一下在Linux5和6时,咱们经常禁用的服务,在Linux7中的状态:

[root@lunar1 ~]# systemctl list-units --type=service auditd.service
UNIT           LOAD   ACTIVE SUB     DESCRIPTION
auditd.service loaded active running Security Auditing Service

LOAD   = Reflects whether the unit definition was properly loaded.
ACTIVE = The high-level unit activation state, i.e. generalization of SUB.
SUB    = The low-level unit activation state, values depend on unit type.

1 loaded units listed. Pass --all to see loaded but inactive units, too.
To show all installed unit files use 'systemctl list-unit-files'.
[root@lunar1 ~]# 
[root@lunar1 ~]# systemctl list-units --type=service autofs.service
0 loaded units listed. Pass --all to see loaded but inactive units, too.
To show all installed unit files use 'systemctl list-unit-files'.
[root@lunar1 ~]# 
[root@lunar1 ~]# systemctl list-units --type=service avahi-daemon.service
0 loaded units listed. Pass --all to see loaded but inactive units, too.
To show all installed unit files use 'systemctl list-unit-files'.
[root@lunar1 ~]# systemctl list-units --type=service avahi-dnsconfd.service
0 loaded units listed. Pass --all to see loaded but inactive units, too.
To show all installed unit files use 'systemctl list-unit-files'.
[root@lunar1 ~]# 
[root@lunar1 ~]# systemctl list-units --type=service bluetooth.service
0 loaded units listed. Pass --all to see loaded but inactive units, too.
To show all installed unit files use 'systemctl list-unit-files'.
[root@lunar1 ~]# 
[root@lunar1 ~]# systemctl list-units --type=service ip6tables.service
0 loaded units listed. Pass --all to see loaded but inactive units, too.
To show all installed unit files use 'systemctl list-unit-files'.
[root@lunar1 ~]# 
[root@lunar1 ~]# systemctl list-units --type=service cups.service
UNIT         LOAD   ACTIVE SUB     DESCRIPTION
cups.service loaded active running CUPS Printing Service

LOAD   = Reflects whether the unit definition was properly loaded.
ACTIVE = The high-level unit activation state, i.e. generalization of SUB.
SUB    = The low-level unit activation state, values depend on unit type.

1 loaded units listed. Pass --all to see loaded but inactive units, too.
To show all installed unit files use 'systemctl list-unit-files'.
[root@lunar1 ~]# 
[root@lunar1 ~]# 
[root@lunar1 ~]# systemctl list-units --type=service smartd.service
UNIT           LOAD   ACTIVE SUB     DESCRIPTION
smartd.service loaded active running Self Monitoring and Reporting Technology (SMART) Daemon

LOAD   = Reflects whether the unit definition was properly loaded.
ACTIVE = The high-level unit activation state, i.e. generalization of SUB.
SUB    = The low-level unit activation state, values depend on unit type.

1 loaded units listed. Pass --all to see loaded but inactive units, too.
To show all installed unit files use 'systemctl list-unit-files'.
[root@lunar1 ~]# 

根据上面输出,可以总结出来,还需要禁用下面这些开机自动启动的服务:

systemctl disable auditd.service
systemctl disable autofs.service
systemctl disable avahi-dnsconfd.service
systemctl disable avahi-daemon.service
systemctl disable bluetooth.service
systemctl disable ip6tables.service
systemctl disable cups.service
systemctl disable smartd.service

(systemctl disable的作用类似于以前的chkconfig –level 2345 avahi-daemon off)
在前面的blog中,我们讲过systemctl disable的本质是删除下面两个目录中相应的服务配置文件:

/etc/systemd/system/multi-user.target.wants/
/etc/systemd/system/graphical.target.wants/

例如:

[root@lunar1 ~]# systemctl disable auditd.service
Removed symlink /etc/systemd/system/multi-user.target.wants/auditd.service.
[root@lunar1 ~]# systemctl disable autofs.service
[root@lunar1 ~]# systemctl disable avahi-dnsconfd.service
[root@lunar1 ~]# systemctl disable avahi-daemon.service
[root@lunar1 ~]# systemctl disable bluetooth.service
Removed symlink /etc/systemd/system/dbus-org.bluez.service.
Removed symlink /etc/systemd/system/bluetooth.target.wants/bluetooth.service.
[root@lunar1 ~]# systemctl disable ip6tables.service
[root@lunar1 ~]# systemctl disable cups.service
Removed symlink /etc/systemd/system/multi-user.target.wants/cups.path.
Removed symlink /etc/systemd/system/multi-user.target.wants/cups.service.
Removed symlink /etc/systemd/system/sockets.target.wants/cups.socket.
Removed symlink /etc/systemd/system/printer.target.wants/cups.service.
[root@lunar1 ~]# systemctl disable smartd.service
Removed symlink /etc/systemd/system/multi-user.target.wants/smartd.service.
[root@lunar1 ~]# 

禁用上述开机启动的服务后(部分没有输出的是因为没有安装相应服务),我们来检查一下服务的开机启动状态是否为disable:

[root@lunar1 ~]# systemctl status auditd.service
● auditd.service - Security Auditing Service
   Loaded: loaded (/usr/lib/systemd/system/auditd.service; disabled; vendor preset: enabled)
   Active: active (running) since 六 2016-01-16 09:46:06 CST; 1h 55min ago
 Main PID: 606 (auditd)
   CGroup: /system.slice/auditd.service
           ├─606 /sbin/auditd -n
           ├─626 /sbin/audispd
           └─654 /usr/sbin/sedispatch

1月 16 09:46:06 lunar1 augenrules[607]: pid 0
1月 16 09:46:06 lunar1 augenrules[607]: rate_limit 0
1月 16 09:46:06 lunar1 augenrules[607]: backlog_limit 320
1月 16 09:46:06 lunar1 augenrules[607]: lost 0
1月 16 09:46:06 lunar1 augenrules[607]: backlog 0
1月 16 09:46:06 lunar1 auditd[606]: Started dispatcher: /sbin/audispd pid: 626
1月 16 09:46:06 lunar1 auditd[606]: Init complete, auditd 2.4.1 listening for events (startup state enable)
1月 16 09:46:07 lunar1 audispd[626]: priority_boost_parser called with: 4
1月 16 09:46:07 lunar1 audispd[626]: max_restarts_parser called with: 10
1月 16 09:46:07 lunar1 audispd[626]: audispd initialized with q_depth=150 and 1 active plugins
[root@lunar1 ~]# 
[root@lunar1 ~]# systemctl status autofs.service
● autofs.service - Automounts filesystems on demand
   Loaded: loaded (/usr/lib/systemd/system/autofs.service; disabled; vendor preset: disabled)
   Active: inactive (dead)
[root@lunar1 ~]# 
[root@lunar1 ~]# systemctl status avahi-daemon.service
● avahi-daemon.service - Avahi mDNS/DNS-SD Stack
   Loaded: loaded (/usr/lib/systemd/system/avahi-daemon.service; disabled; vendor preset: enabled)
   Active: inactive (dead) since 六 2016-01-16 09:59:59 CST; 1h 41min ago
 Main PID: 639 (code=exited, status=0/SUCCESS)
   Status: "avahi-daemon 0.6.31 starting up."

1月 16 09:46:19 lunar1 avahi-daemon[639]: New relevant interface enp0s9.IPv4 for mDNS.
1月 16 09:46:19 lunar1 avahi-daemon[639]: Registering new address record for 192.168.209.11 on enp0s9.IPv4.
1月 16 09:46:19 lunar1 avahi-daemon[639]: Joining mDNS multicast group on interface enp0s8.IPv4 with address 192.168.60.11.
1月 16 09:46:19 lunar1 avahi-daemon[639]: New relevant interface enp0s8.IPv4 for mDNS.
1月 16 09:46:19 lunar1 avahi-daemon[639]: Registering new address record for 192.168.60.11 on enp0s8.IPv4.
1月 16 09:46:20 lunar1 avahi-daemon[639]: Registering new address record for fe80::a00:27ff:fea8:83cf on enp0s9.*.
1月 16 09:46:20 lunar1 avahi-daemon[639]: Registering new address record for fe80::a00:27ff:feee:cd8d on enp0s3.*.
1月 16 09:46:21 lunar1 avahi-daemon[639]: Registering new address record for fe80::a00:27ff:fe42:fb8 on enp0s8.*.
1月 16 09:59:59 lunar1 systemd[1]: Stopping Avahi mDNS/DNS-SD Stack...
1月 16 09:59:59 lunar1 systemd[1]: Stopped Avahi mDNS/DNS-SD Stack.
[root@lunar1 ~]# 
[root@lunar1 ~]# 
[root@lunar1 ~]# 
[root@lunar1 ~]# systemctl status bluetooth.service
● bluetooth.service - Bluetooth service
   Loaded: loaded (/usr/lib/systemd/system/bluetooth.service; disabled; vendor preset: enabled)
   Active: inactive (dead)
     Docs: man:bluetoothd(8)
[root@lunar1 ~]# 
[root@lunar1 ~]# 
[root@lunar1 ~]# systemctl status ip6tables.service
● ip6tables.service
   Loaded: not-found (Reason: No such file or directory)
   Active: inactive (dead)
[root@lunar1 ~]# 
[root@lunar1 ~]# systemctl status cups.service
● cups.service - CUPS Printing Service
   Loaded: loaded (/usr/lib/systemd/system/cups.service; disabled; vendor preset: enabled)
   Active: active (running) since 六 2016-01-16 09:46:24 CST; 1h 55min ago
 Main PID: 1409 (cupsd)
   CGroup: /system.slice/cups.service
           └─1409 /usr/sbin/cupsd -f

1月 16 09:46:24 lunar1 systemd[1]: Started CUPS Printing Service.
1月 16 09:46:24 lunar1 systemd[1]: Starting CUPS Printing Service...
[root@lunar1 ~]# 
[root@lunar1 ~]# 
[root@lunar1 ~]# 
[root@lunar1 ~]# systemctl status smartd.service
● smartd.service - Self Monitoring and Reporting Technology (SMART) Daemon
   Loaded: loaded (/usr/lib/systemd/system/smartd.service; disabled; vendor preset: enabled)
   Active: active (running) since 六 2016-01-16 09:46:12 CST; 1h 55min ago
 Main PID: 687 (smartd)
   CGroup: /system.slice/smartd.service
           └─687 /usr/sbin/smartd -n -q never

1月 16 09:46:13 lunar1 smartd[687]: Copyright (C) 2002-13, Bruce Allen, Christian Franke, www.smartmontools.org
1月 16 09:46:13 lunar1 smartd[687]: Opened configuration file /etc/smartmontools/smartd.conf
1月 16 09:46:13 lunar1 smartd[687]: Configuration file /etc/smartmontools/smartd.conf was parsed, found DEVICESCAN, scanning devices
1月 16 09:46:13 lunar1 smartd[687]: Device: /dev/sda, type changed from 'scsi' to 'sat'
1月 16 09:46:13 lunar1 smartd[687]: Device: /dev/sda [SAT], opened
1月 16 09:46:13 lunar1 smartd[687]: Device: /dev/sda [SAT], VBOX HARDDISK, S/N:VB621d76b0-24b6b79f, FW:1.0, 107 GB
1月 16 09:46:13 lunar1 smartd[687]: Device: /dev/sda [SAT], not found in smartd database.
1月 16 09:46:13 lunar1 smartd[687]: Device: /dev/sda [SAT], lacks SMART capability
1月 16 09:46:13 lunar1 smartd[687]: Device: /dev/sda [SAT], to proceed anyway, use '-T permissive' Directive.
1月 16 09:46:13 lunar1 smartd[687]: Monitoring 0 ATA and 0 SCSI devices
[root@lunar1 ~]# 

这里看到,刚才disable的服务已经设置正确了。
然后,我们reboot后再来观察:

[root@lunar1 ~]# systemctl status auditd.service
● auditd.service - Security Auditing Service
   Loaded: loaded (/usr/lib/systemd/system/auditd.service; disabled; vendor preset: enabled)
   Active: inactive (dead)
[root@lunar1 ~]# 
[root@lunar1 ~]# 
[root@lunar1 ~]# systemctl status autofs.service
● autofs.service - Automounts filesystems on demand
   Loaded: loaded (/usr/lib/systemd/system/autofs.service; disabled; vendor preset: disabled)
   Active: inactive (dead)
[root@lunar1 ~]# 
[root@lunar1 ~]# systemctl status avahi-daemon.service
● avahi-daemon.service - Avahi mDNS/DNS-SD Stack
   Loaded: loaded (/usr/lib/systemd/system/avahi-daemon.service; disabled; vendor preset: enabled)
   Active: inactive (dead)
[root@lunar1 ~]# 
[root@lunar1 ~]# 
[root@lunar1 ~]# systemctl status bluetooth.service
● bluetooth.service - Bluetooth service
   Loaded: loaded (/usr/lib/systemd/system/bluetooth.service; disabled; vendor preset: enabled)
   Active: inactive (dead)
     Docs: man:bluetoothd(8)
[root@lunar1 ~]# 
[root@lunar1 ~]# 
[root@lunar1 ~]# systemctl status cups.service
● cups.service - CUPS Printing Service
   Loaded: loaded (/usr/lib/systemd/system/cups.service; disabled; vendor preset: enabled)
   Active: inactive (dead)
[root@lunar1 ~]# 
[root@lunar1 ~]# systemctl status smartd.service
● smartd.service - Self Monitoring and Reporting Technology (SMART) Daemon
   Loaded: loaded (/usr/lib/systemd/system/smartd.service; disabled; vendor preset: enabled)
   Active: inactive (dead)
[root@lunar1 ~]# 

禁用相关服务的开机启动缺省已经生效了。
还可以使用systemctl is-active命令查询简洁明了的“inactive”,“active”和“unknown”状态:

[root@lunar1 ~]# systemctl is-active auditd.service
inactive
[root@lunar1 ~]# systemctl is-active avahi-daemon.service
inactive
[root@lunar1 ~]# systemctl is-active ip6tables.service
inactive
[root@lunar1 ~]# systemctl is-active cups.service
unknown
[root@lunar1 ~]# systemctl is-active smartd.service
unknown
[root@lunar1 ~]# 

“inactive”,表示服务当前是不活动的
“active”,表示服务当前是活动的
“unknown”,表示没有安装该服务
具体可以参考man sysemctl
.
总结:
在Linux7上安装Oracle 11.2 RAC和12c RAC需要禁用如下服务:
1,防火墙和SELINUX
2,其他服务

	systemctl disable auditd.service
	systemctl disable autofs.service
	systemctl disable avahi-dnsconfd.service
	systemctl disable avahi-daemon.service
	systemctl disable bluetooth.service
	systemctl disable ip6tables.service
	systemctl disable cups.service
	systemctl disable smartd.service

3,Redhat官网最佳实践中建议禁用的服务:

# systemctl stop avahi-dnsconfd
# systemctl stop avahi-daemon
# systemctl disable avahi-dnsconfd
# systemctl disable avahi-daemon

根据需要,可以禁用tuned.service服务(自动修改一些核心参数的服务,可以查询该文件内容来决定):

# systemctl stop tuned.service
# systemctl disable tuned.service
# systemctl status tuned.service

Linux7(CentOS,RHEL,OEL)和Oracle RAC环境系列–1-简介
Linux7(CentOS,RHEL,OEL)和Oracle RAC环境系列-2-修改主机名和hostnamectl工具的使用
Linux7(CentOS,RHEL,OEL)和Oracle RAC环境系列–3-systemd(d.bin和ohasd守护进程)
Linux7(CentOS,RHEL,OEL)和Oracle RAC环境系列–4-target(图形界面和字符界面)
Linux7(CentOS,RHEL,OEL)和Oracle RAC环境系列–5-防火墙
Linux7(CentOS,RHEL,OEL)和Oracle RAC环境系列–6-开机自动启动或者禁用服务
Linux7(CentOS,RHEL,OEL)和Oracle RAC环境系列-7-网络管理之添加网
Linux7(CentOS,RHEL,OEL)和Oracle RAC环境系列-7-网络管理之修改IP地址
Linux7(CentOS,RHEL,OEL)和Oracle RAC环境系列-7-网络管理之修改网络接口名
Linux7(CentOS,RHEL,OEL)和Oracle RAC环境系列-8-在Linux7上安装11.2 RAC和12.1 RAC需要禁用哪些服务
Linux7(CentOS,RHEL,OEL)和Oracle RAC环境系列-9-Linux 7.2上的virbr0设备

发表在 Installation and Deinstall, Linux, ORACLE 12C, RAC | 标签为 , , , , , | Comments Off on Linux7(CentOS,RHEL,OEL)和Oracle RAC环境系列-8-在Linux7上安装11.2 RAC和12.1 RAC需要禁用哪些服务

Linux7(CentOS,RHEL,OEL)和Oracle RAC环境系列-7-网络管理之修改网络接口名

由于Linux7中采用了固定的网络接口名的方式,目的是如果网卡损坏可以方便的使用类似新增网卡的方法进行替换,非常简便
但是如果由于某种原因,需要修改网络接口名就很麻烦,例如想修改为以前的eth0的名称。
Linux7中,使用nmtui修改网络连接和IP地址后,可以使用重建加载配置文件的方式使新的配置生效。
需要注意的是,网络接口名称不能通过nmtui来修改(可以修改,但是修改是无效的,会被自动还原为缺省的网络接口名)。
.
下面是通过修改网络配置文件的方法来修改网络设备接口名称的过程(注意,结论是不能用此方法修改):

[root@lunar1 ~]# cp /etc/sysconfig/network-scripts/ifcfg-enp0s9 /tmp/ifcfg-enp0s3
[root@lunar1 ~]# mv /etc/sysconfig/network-scripts/ifcfg-enp0s9 /etc/sysconfig/network-scripts/ifcfg-eth1
[root@lunar1 ~]#

修改/etc/sysconfig/network-scripts/ifcfg-eth1中的两个地方:
DEVICE=eth1 ———-设备名称(device)
NAME=eth1 ———-连接名称(connect)
修改后:

[root@lunar1 ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth1
DEVICE=enp0s9
HWADDR=08:00:27:A8:83:CF
TYPE=Ethernet
BOOTPROTO=none
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=no
IPV6_FAILURE_FATAL=no
NAME=eth1
UUID=5e43be5e-5a8c-4f33-bdd1-dfdce55cec0d
ONBOOT=yes
IPADDR=192.168.209.15
PREFIX=24
GATEWAY=192.168.209.1
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes
[root@lunar1 ~]# 
[root@lunar1 ~]# ll /etc/sysconfig/network-scripts/ifcfg*
-rw-r--r--. 1 root root 319 1月  16 03:08 /etc/sysconfig/network-scripts/ifcfg-enp0s3
-rw-r--r--. 1 root root 319 1月  16 03:08 /etc/sysconfig/network-scripts/ifcfg-enp0s8
-rw-r--r--. 1 root root 325 1月  16 08:28 /etc/sysconfig/network-scripts/ifcfg-eth1
-rw-r--r--. 1 root root 254 9月  16 19:51 /etc/sysconfig/network-scripts/ifcfg-lo
[root@lunar1 ~]# 

修改后重新加载配置文件:

[root@lunar1 ~]# nmcli con load /etc/sysconfig/network-scripts/ifcfg-eth1
[root@lunar1 ~]# 

这样只能修改连接的名称,但是不能修改设备名称:

[root@lunar1 ~]# nmcli dev show eth1

错误:没有找到设备 ‘eth1’。

[root@lunar1 ~]# nmcli dev show enp0s9
GENERAL.设备:                           enp0s9
GENERAL.类型:                           ethernet
GENERAL.硬盘:                           08:00:27:A8:83:CF
GENERAL.MTU:                            1500
GENERAL.状态:                           100 (连接的)
GENERAL.CONNECTION:                     eth1
GENERAL.CON-PATH:                       /org/freedesktop/NetworkManager/ActiveConnection/2
WIRED-PROPERTIES.容器:                  开
IP4.地址[1]:                            192.168.209.15/24
IP4.网关:                               192.168.209.1
IP6.地址[1]:                            fe80::a00:27ff:fea8:83cf/64
IP6.网关:                               
[root@lunar1 ~]# nmcli conn show
名称    UUID                                  类型            设备   
enp0s8  ba5021c5-727b-4b19-b6eb-c77892fb40b6  802-3-ethernet  enp0s8 
eth1    5e43be5e-5a8c-4f33-bdd1-dfdce55cec0d  802-3-ethernet  enp0s9 
enp0s3  3e33deb2-5f53-4850-a424-76042c27b419  802-3-ethernet  enp0s3 
[root@lunar1 ~]# 

在Linux7中修改设备名称只能禁用一致和可预测的网络设备命名规则,即,修改grub,还原到Linux6的设备命名方法:

[root@lunar1 ~]# cat /etc/default/grub
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
GRUB_DEFAULT=saved
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL_OUTPUT="console"
GRUB_CMDLINE_LINUX="crashkernel=auto rd.lvm.lv=centos/root rd.lvm.lv=centos/swap rhgb quiet"
GRUB_DISABLE_RECOVERY="true"
[root@lunar1 ~]# 

至此,我们看到,不能通过修改配置文件的方法来改变网络接口设备名称。
那么如果一定要在Linux7中将网络设备接口名修改回以前很土的eth0有方法么?
答案是:yes。
.
我们可以通过禁用可命名规则,编辑/etc/default/grub文件来实现。
在该文件的GRUB_CMDLINE_linux=”rhgb quiet”改为GRUB_CMDLINE_LINUX=”net.ifnames=0 biosdevname=0 rhgb quiet”

[root@lunar1 ~]# cp /etc/default/grub /etc/default/grub.orig
[root@lunar1 ~]# ls -lrt /etc/default/grub*
-rw-r--r--. 1 root root 279 1月  16 08:57 /etc/default/grub.orig
-rw-r--r--. 1 root root 307 1月  16 08:58 /etc/default/grub
[root@lunar1 ~]# 
[root@lunar1 ~]# cat /etc/default/grub
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
GRUB_DEFAULT=saved
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL_OUTPUT="console"
GRUB_CMDLINE_LINUX="crashkernel=auto rd.lvm.lv=centos/root rd.lvm.lv=centos/swap net.ifnames=0 biosdevname=0 rhgb quiet"
GRUB_DISABLE_RECOVERY="true"
[root@lunar1 ~]# 

运行命令grub2-mkconfig -o /boot/grub2/grub.cfg来重新生成grub配置并更新内核参数:

[root@lunar1 ~]# grub2-mkconfig -o /boot/grub2/grub.cfg
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-3.10.0-327.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-327.el7.x86_64.img
Found linux image: /boot/vmlinuz-0-rescue-11f3b15bbc73453287d186e6aa5dda16
Found initrd image: /boot/initramfs-0-rescue-11f3b15bbc73453287d186e6aa5dda16.img
done
[root@lunar1 ~]# 
[root@lunar1 ~]# ll /etc/udev/rules.d/70-persistent-ipoib.rules
-rw-r--r--. 1 root root 709 11月 20 23:59 /etc/udev/rules.d/70-persistent-ipoib.rules
[root@lunar1 ~]# 
[root@lunar1 ~]# ll /etc/udev/rules.d/70-persistent-ipoib.rules
-rw-r--r--. 1 root root 709 11月 20 23:59 /etc/udev/rules.d/70-persistent-ipoib.rules
[root@lunar1 ~]# cat /etc/udev/rules.d/70-persistent-ipoib.rules
# This is a sample udev rules file that demonstrates how to get udev to
# set the name of IPoIB interfaces to whatever you wish.  There is a
# 16 character limit on network device names though, so don't go too nuts
#
# Important items to note: ATTR{type}=="32" is IPoIB interfaces, and the
# ATTR{address} match must start with ?* and only reference the last 8
# bytes of the address or else the address might not match on any given
# start of the IPoIB stack
#
# Note: as of rhel7, udev is case sensitive on the address field match
# and all addresses need to be in lower case.
#
# ACTION=="add", SUBSYSTEM=="net", DRIVERS=="?*", ATTR{type}=="32", ATTR{address}=="?*00:02:c9:03:00:31:78:f2", NAME="mlx4_ib3"
[root@lunar1 ~]# 

这里我们看到了熟悉的类似Linux6中的UDEV绑定网络设备的方式。
然后,我们reboot后,可以看到,网络接口名已经还原到了以前的样子:

[root@lunar1 ~]# ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.56.101  netmask 255.255.255.0  broadcast 192.168.56.255
        inet6 fe80::a00:27ff:feee:cd8d  prefixlen 64  scopeid 0x20<link>
        ether 08:00:27:ee:cd:8d  txqueuelen 1000  (Ethernet)
        RX packets 56  bytes 6161 (6.0 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 59  bytes 11596 (11.3 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

eth1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        ether 08:00:27:42:0f:b8  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 50  bytes 8652 (8.4 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

eth2: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.209.15  netmask 255.255.255.0  broadcast 192.168.209.255
        inet6 fe80::a00:27ff:fea8:83cf  prefixlen 64  scopeid 0x20<link>
        ether 08:00:27:a8:83:cf  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 27  bytes 3995 (3.9 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 0  (Local Loopback)
        RX packets 328  bytes 26600 (25.9 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 328  bytes 26600 (25.9 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

[root@lunar1 ~]# 
[root@lunar1 ~]# ll /etc/sysconfig/network-scripts/ifcfg*
-rw-r--r--. 1 root root 319 1月  16 03:08 /etc/sysconfig/network-scripts/ifcfg-enp0s3
-rw-r--r--. 1 root root 319 1月  16 03:08 /etc/sysconfig/network-scripts/ifcfg-enp0s8
-rw-r--r--. 1 root root 313 1月  16 08:55 /etc/sysconfig/network-scripts/ifcfg-eth1
-rw-r--r--. 1 root root 254 9月  16 19:51 /etc/sysconfig/network-scripts/ifcfg-lo
[root@lunar1 ~]# 
[root@lunar1 ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth1
HWADDR=08:00:27:A8:83:CF
TYPE=Ethernet
BOOTPROTO=none
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=no
IPV6_FAILURE_FATAL=no
NAME=eth1
UUID=5e43be5e-5a8c-4f33-bdd1-dfdce55cec0d
ONBOOT=yes
IPADDR=192.168.209.15
PREFIX=24
GATEWAY=192.168.209.1
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes
[root@lunar1 ~]# 

现在,我们再还原回到可预测的网络设备命名网络接口的方法:

[root@lunar1 ~]# cp /etc/default/grub.orig /etc/default/grub
cp:是否覆盖"/etc/default/grub"? y
[root@lunar1 ~]# cat /etc/default/grub
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
GRUB_DEFAULT=saved
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL_OUTPUT="console"
GRUB_CMDLINE_LINUX="crashkernel=auto rd.lvm.lv=centos/root rd.lvm.lv=centos/swap rhgb quiet"
GRUB_DISABLE_RECOVERY="true"
[root@lunar1 ~]# 
[root@lunar1 ~]# grub2-mkconfig -o /boot/grub2/grub.cfg
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-3.10.0-327.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-327.el7.x86_64.img
Found linux image: /boot/vmlinuz-0-rescue-11f3b15bbc73453287d186e6aa5dda16
Found initrd image: /boot/initramfs-0-rescue-11f3b15bbc73453287d186e6aa5dda16.img
done
[root@lunar1 ~]# ll /etc/udev/rules.d/70-persistent-ipoib.rules
-rw-r--r--. 1 root root 709 11月 20 23:59 /etc/udev/rules.d/70-persistent-ipoib.rules
[root@lunar1 ~]# cat /etc/udev/rules.d/70-persistent-ipoib.rules
# This is a sample udev rules file that demonstrates how to get udev to
# set the name of IPoIB interfaces to whatever you wish.  There is a
# 16 character limit on network device names though, so don't go too nuts
#
# Important items to note: ATTR{type}=="32" is IPoIB interfaces, and the
# ATTR{address} match must start with ?* and only reference the last 8
# bytes of the address or else the address might not match on any given
# start of the IPoIB stack
#
# Note: as of rhel7, udev is case sensitive on the address field match
# and all addresses need to be in lower case.
#
# ACTION=="add", SUBSYSTEM=="net", DRIVERS=="?*", ATTR{type}=="32", ATTR{address}=="?*00:02:c9:03:00:31:78:f2", NAME="mlx4_ib3"
[root@lunar1 ~]# reboot
[root@lunar1 ~]# ifconfig
enp0s3: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.56.11  netmask 255.255.255.0  broadcast 192.168.56.255
        inet6 fe80::a00:27ff:feee:cd8d  prefixlen 64  scopeid 0x20<link>
        ether 08:00:27:ee:cd:8d  txqueuelen 1000  (Ethernet)
        RX packets 51  bytes 4801 (4.6 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 59  bytes 10958 (10.7 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

enp0s8: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.60.11  netmask 255.255.255.0  broadcast 192.168.60.255
        inet6 fe80::a00:27ff:fe42:fb8  prefixlen 64  scopeid 0x20<link>
        ether 08:00:27:42:0f:b8  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 27  bytes 3933 (3.8 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

enp0s9: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.209.15  netmask 255.255.255.0  broadcast 192.168.209.255
        inet6 fe80::a00:27ff:fea8:83cf  prefixlen 64  scopeid 0x20<link>
        ether 08:00:27:a8:83:cf  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 27  bytes 3939 (3.8 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 0  (Local Loopback)
        RX packets 336  bytes 27280 (26.6 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 336  bytes 27280 (26.6 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

[root@lunar1 ~]# 

Linux7(CentOS,RHEL,OEL)和Oracle RAC环境系列–1-简介
Linux7(CentOS,RHEL,OEL)和Oracle RAC环境系列-2-修改主机名和hostnamectl工具的使用
Linux7(CentOS,RHEL,OEL)和Oracle RAC环境系列–3-systemd(d.bin和ohasd守护进程)
Linux7(CentOS,RHEL,OEL)和Oracle RAC环境系列–4-target(图形界面和字符界面)
Linux7(CentOS,RHEL,OEL)和Oracle RAC环境系列–5-防火墙
Linux7(CentOS,RHEL,OEL)和Oracle RAC环境系列–6-开机自动启动或者禁用服务
Linux7(CentOS,RHEL,OEL)和Oracle RAC环境系列-7-网络管理之添加网
Linux7(CentOS,RHEL,OEL)和Oracle RAC环境系列-7-网络管理之修改IP地址
Linux7(CentOS,RHEL,OEL)和Oracle RAC环境系列-7-网络管理之修改网络接口名
Linux7(CentOS,RHEL,OEL)和Oracle RAC环境系列-8-在Linux7上安装11.2 RAC和12.1 RAC需要禁用哪些服务
Linux7(CentOS,RHEL,OEL)和Oracle RAC环境系列-9-Linux 7.2上的virbr0设备
Linux7(CentOS,RHEL,OEL)和Oracle RAC环境系列-10-ABRT-系统启动后自动检查和报告错误
Linux7(CentOS,RHEL,OEL)和Oracle RAC环境系列-11-配置VNC和常见问题处理

发表在 Database, Installation and Deinstall, Linux, network | 标签为 , , , , , , , , , | 留下评论

Linux7(CentOS,RHEL,OEL)和Oracle RAC环境系列-7-网络管理之修改IP地址

首先,还是确认NetworkManager服务已经启动(不启动NetworkManager也可以配置IP和connect等等):

[root@lunar1 ~]# systemctl status NetworkManager
● NetworkManager.service - Network Manager
   Loaded: loaded (/usr/lib/systemd/system/NetworkManager.service; enabled; vendor preset: enabled)
   Active: active (running) since 六 2016-01-16 06:38:43 CST; 36min ago
 Main PID: 758 (NetworkManager)
   CGroup: /system.slice/NetworkManager.service
           └─758 /usr/sbin/NetworkManager --no-daemon

1月 16 07:13:45 lunar1 NetworkManager[758]: <info>  (enp0s9): device state change: failed -> disconnected (reason 'none') [120 30 0]
1月 16 07:13:45 lunar1 NetworkManager[758]: <info>  Auto-activating connection 'enp0s9'.
1月 16 07:13:45 lunar1 NetworkManager[758]: <info>  (enp0s9): Activation: starting connection 'enp0s9' (5e43be5e-5a8c-4f33-bdd1-dfdce55cec0d)
1月 16 07:13:45 lunar1 NetworkManager[758]: <info>  (enp0s9): device state change: disconnected -> prepare (reason 'none') [30 40 0]
1月 16 07:13:45 lunar1 NetworkManager[758]: <info>  (enp0s9): device state change: prepare -> config (reason 'none') [40 50 0]
1月 16 07:13:45 lunar1 NetworkManager[758]: <info>  (enp0s9): device state change: config -> ip-config (reason 'none') [50 70 0]
1月 16 07:13:45 lunar1 NetworkManager[758]: <info>  (enp0s9): device state change: ip-config -> ip-check (reason 'none') [70 80 0]
1月 16 07:13:45 lunar1 NetworkManager[758]: <info>  (enp0s9): device state change: ip-check -> secondaries (reason 'none') [80 90 0]
1月 16 07:13:45 lunar1 NetworkManager[758]: <info>  (enp0s9): device state change: secondaries -> activated (reason 'none') [90 100 0]
1月 16 07:13:45 lunar1 NetworkManager[758]: <info>  (enp0s9): Activation: successful, device activated.
[root@lunar1 ~]#

nmtui的配置和修改会自动更新/etc/sysconfig/network-scripts/下面相关的配置文件:
比如,我们使用nmtui将enp0s9的IP地址修改为192.168.209.15
这时,我们看到,nmtui已经修改了/etc/sysconfig/network-scripts/ifcfg-enp0s9的内容:

[root@lunar1 ~]# ll /etc/sysconfig/network-scripts/ifcfg*
-rw-r--r--. 1 root root 319 1月  16 03:08 /etc/sysconfig/network-scripts/ifcfg-enp0s3
-rw-r--r--. 1 root root 319 1月  16 03:08 /etc/sysconfig/network-scripts/ifcfg-enp0s8
-rw-r--r--. 1 root root 315 1月  16 07:18 /etc/sysconfig/network-scripts/ifcfg-enp0s9
-rw-r--r--. 1 root root 254 9月  16 19:51 /etc/sysconfig/network-scripts/ifcfg-lo
[root@lunar1 ~]# cat /etc/sysconfig/network-scripts/ifcfg-enp0s9
HWADDR=08:00:27:A8:83:CF
TYPE=Ethernet
BOOTPROTO=none
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=no
IPV6_FAILURE_FATAL=no
NAME=enp0s9
UUID=5e43be5e-5a8c-4f33-bdd1-dfdce55cec0d
ONBOOT=yes
IPADDR=192.168.209.15
PREFIX=24
GATEWAY=192.168.209.1
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes
[root@lunar1 ~]#

但是,此时IP地址还没有修改:
[root@lunar1 ~]# ifconfig

enp0s3: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.56.11  netmask 255.255.255.0  broadcast 192.168.56.255
        inet6 fe80::a00:27ff:feee:cd8d  prefixlen 64  scopeid 0x20<link>
        ether 08:00:27:ee:cd:8d  txqueuelen 1000  (Ethernet)
        RX packets 928  bytes 75822 (74.0 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 573  bytes 183191 (178.8 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

enp0s8: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.60.11  netmask 255.255.255.0  broadcast 192.168.60.255
        inet6 fe80::a00:27ff:fe42:fb8  prefixlen 64  scopeid 0x20<link>
        ether 08:00:27:42:0f:b8  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 27  bytes 3989 (3.8 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

enp0s9: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.209.11  netmask 255.255.255.0  broadcast 192.168.209.255
        inet6 fe80::a00:27ff:fea8:83cf  prefixlen 64  scopeid 0x20<link>
        ether 08:00:27:a8:83:cf  txqueuelen 1000  (Ethernet)
        RX packets 6  bytes 416 (416.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 295  bytes 51719 (50.5 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 0  (Local Loopback)
        RX packets 660  bytes 53540 (52.2 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 660  bytes 53540 (52.2 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

[root@lunar1 ~]#

我们查看一下名称为enp0s9的网络设备:

[root@lunar1 ~]# nmcli dev show enp0s9
GENERAL.设备:                           enp0s9
GENERAL.类型:                           ethernet
GENERAL.硬盘:                           08:00:27:A8:83:CF
GENERAL.MTU:                            1500
GENERAL.状态:                           100 (连接的)
GENERAL.CONNECTION:                     enp0s9
GENERAL.CON-PATH:                       /org/freedesktop/NetworkManager/ActiveConnection/24
WIRED-PROPERTIES.容器:                  开
IP4.地址[1]:                            192.168.209.11/24
IP4.网关:                               192.168.209.1
IP6.地址[1]:                            fe80::a00:27ff:fea8:83cf/64
IP6.网关:                               
[root@lunar1 ~]# 

看一下当前所有的网络连接:

[root@lunar1 ~]# nmcli conn show
名称    UUID                                  类型            设备   
enp0s9  5e43be5e-5a8c-4f33-bdd1-dfdce55cec0d  802-3-ethernet  enp0s9 
enp0s8  ba5021c5-727b-4b19-b6eb-c77892fb40b6  802-3-ethernet  enp0s8 
enp0s3  3e33deb2-5f53-4850-a424-76042c27b419  802-3-ethernet  enp0s3 
[root@lunar1 ~]# 

修改IP后,要使修改后的连接生效,需要重新加载配置文件:

[root@lunar1 ~]# nmcli con load /etc/sysconfig/network-scripts/ifcfg-enp0s9
[root@lunar1 ~]#

然后重新连接设备enp0s9:

[root@lunar1 ~]# nmcli dev connect enp0s9
Device 'enp0s9' successfully activated with '5e43be5e-5a8c-4f33-bdd1-dfdce55cec0d'.
[root@lunar1 ~]# 

现在IP就修改好了,太方便了:

[root@lunar1 ~]# ifconfig enp0s9
enp0s9: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.209.15  netmask 255.255.255.0  broadcast 192.168.209.255
        inet6 fe80::a00:27ff:fea8:83cf  prefixlen 64  scopeid 0x20<link>
        ether 08:00:27:a8:83:cf  txqueuelen 1000  (Ethernet)
        RX packets 6  bytes 416 (416.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 323  bytes 55802 (54.4 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

[root@lunar1 ~]# 
[root@lunar1 ~]# ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN 
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: enp0s3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 08:00:27:ee:cd:8d brd ff:ff:ff:ff:ff:ff
    inet 192.168.56.11/24 brd 192.168.56.255 scope global enp0s3
       valid_lft forever preferred_lft forever
    inet6 fe80::a00:27ff:feee:cd8d/64 scope link 
       valid_lft forever preferred_lft forever
3: enp0s8: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 08:00:27:42:0f:b8 brd ff:ff:ff:ff:ff:ff
    inet 192.168.60.11/24 brd 192.168.60.255 scope global enp0s8
       valid_lft forever preferred_lft forever
    inet6 fe80::a00:27ff:fe42:fb8/64 scope link 
       valid_lft forever preferred_lft forever
4: enp0s9: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 08:00:27:a8:83:cf brd ff:ff:ff:ff:ff:ff
    inet 192.168.209.15/24 brd 192.168.209.255 scope global enp0s9
       valid_lft forever preferred_lft forever
    inet6 fe80::a00:27ff:fea8:83cf/64 scope link 
       valid_lft forever preferred_lft forever
[root@lunar1 ~]# 

Linux7(CentOS,RHEL,OEL)和Oracle RAC环境系列–1-简介
Linux7(CentOS,RHEL,OEL)和Oracle RAC环境系列-2-修改主机名和hostnamectl工具的使用
Linux7(CentOS,RHEL,OEL)和Oracle RAC环境系列–3-systemd(d.bin和ohasd守护进程)
Linux7(CentOS,RHEL,OEL)和Oracle RAC环境系列–4-target(图形界面和字符界面)
Linux7(CentOS,RHEL,OEL)和Oracle RAC环境系列–5-防火墙
Linux7(CentOS,RHEL,OEL)和Oracle RAC环境系列–6-开机自动启动或者禁用服务
Linux7(CentOS,RHEL,OEL)和Oracle RAC环境系列-7-网络管理之添加网
Linux7(CentOS,RHEL,OEL)和Oracle RAC环境系列-7-网络管理之修改IP地址
Linux7(CentOS,RHEL,OEL)和Oracle RAC环境系列-7-网络管理之修改网络接口名
Linux7(CentOS,RHEL,OEL)和Oracle RAC环境系列-8-在Linux7上安装11.2 RAC和12.1 RAC需要禁用哪些服务
Linux7(CentOS,RHEL,OEL)和Oracle RAC环境系列-9-Linux 7.2上的virbr0设备
Linux7(CentOS,RHEL,OEL)和Oracle RAC环境系列-10-ABRT-系统启动后自动检查和报告错误
Linux7(CentOS,RHEL,OEL)和Oracle RAC环境系列-11-配置VNC和常见问题处理

发表在 Database, Installation and Deinstall, Linux, network | 标签为 , , , , , , | 留下评论

Linux7(CentOS,RHEL,OEL)和Oracle RAC环境系列-7-网络管理之添加网卡

在Linux5和以前的版本,缺省的网络接口名为eth0 eth1 eth[012..]等网络接口名称(NIC)。
这种方法的问题是不能一目了然的知道网卡的物理特性(如 网卡的物理位置),比如这个网卡是那个PCI插槽等等。
.
从Linux6开始,引入了一致和可预测的网络设备命名网络接口的方法(Consistent Network Device Naming)。
这种一致性网络设备命名法根据网卡的物理位置,是否是集成的还是在PCI插槽中来命名,通过这名称,能够很清楚的知道网卡的物理位置
这种方法是依靠biosdevname程序来实现的,它按照一定的规则改变原来的eth[012..]网卡名。
.
这些特性可以唯一地确定网络接口的名称以使定位和区分设备更容易,并且在这样一种方式下,无论是否重启机器、过了多少时间、或者改变硬件,其名字都是持久不变的。
但是,这种命名规则并不是默认在Liunx6上开启,因此,在Linux6中,依然可以看到网络接口名称(NIC)缺省还是eth0 eth1 eth[012..]。
但是,在Linux6中,开始使用udev来绑定网卡设备:/etc/udev/rules.d/70-persistent-net.rules。
.
从Linux7开始,一致和可预测的网络设备命名网络接口的方法(Consistent Network Device Naming)已经是缺省配置。
它的优点是:
1,根据这一规则,接口名称被自动基于固件,拓扑结构和位置信息来确定。
2,即使添加或移除网络设备,接口名称仍然保持固定,而无需重新枚举,和坏掉的硬件可以无缝替换。
.
在Linux7中/etc/udev/rules.d/70-persistent-net.rules 文件没有了,新添加的网卡NetworkManager自动识别设备名称。

[root@lunar1 ~]# cat /etc/centos-release
CentOS Linux release 7.2.1511 (Core) 
[root@lunar1 ~]# 
[root@lunar1 ~]# cat /etc/os-release
NAME="CentOS Linux"
VERSION="7 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="7"
PRETTY_NAME="CentOS Linux 7 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:7"
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"

CENTOS_MANTISBT_PROJECT="CentOS-7"
CENTOS_MANTISBT_PROJECT_VERSION="7"
REDHAT_SUPPORT_PRODUCT="centos"
REDHAT_SUPPORT_PRODUCT_VERSION="7"

[root@lunar1 ~]# ll /etc/udev/rules.d/70-persistent-net.rules
ls: cannot access /etc/udev/rules.d/70-persistent-net.rules: No such file or directory
[root@lunar1 ~]# 

它采用命名的规则类似如下:
基于接口类型的两个字母前缀:

*   en -- 以太网
*   em -- 集成网卡
*   sl -- 串行线路IP (slip)
*   wl -- wlan
*   ww -- wwan

名字类型:

*   b<number>                             	-- BCMA总线和新书
*   ccw<name>                             	-- CCW总线组名
*   o<index>                              	-- 车载设备的索引号
*   s<slot>[f<function>][d<dev_port>]     	-- 热插拔插槽索引号
*   x<MAC>                                	-- MAC 地址
*   [P<domain>]p<bus>s<slot>[f<function>][d<dev_port>]    -----PCI 位置
*   [P<domain>]p<bus>s<slot>[f<function>][u<port>][..]1[i<interface>]    -- USB端口号链

例如,在Linux7中,缺省的第一块网卡名称是enp0s3,第二块是enp0s8,第3块是9……以此类推
并且这些网络接口名称缺省是不能改变的(可以使用修改内核来禁用这个新特性的方法,后续文章会陆续介绍)。

[root@lunar1 ~]# ifconfig
enp0s3: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.56.11  netmask 255.255.255.0  broadcast 192.168.56.255
        inet6 fe80::a00:27ff:feee:cd8d  prefixlen 64  scopeid 0x20<link>
        ether 08:00:27:ee:cd:8d  txqueuelen 1000  (Ethernet)
        RX packets 291  bytes 23591 (23.0 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 212  bytes 77588 (75.7 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

enp0s8: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.60.11  netmask 255.255.255.0  broadcast 192.168.60.255
        inet6 fe80::a00:27ff:fe42:fb8  prefixlen 64  scopeid 0x20<link>
        ether 08:00:27:42:0f:b8  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 27  bytes 3989 (3.8 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 0  (Local Loopback)
        RX packets 460  bytes 37308 (36.4 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 460  bytes 37308 (36.4 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

virbr0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        inet 192.168.122.1  netmask 255.255.255.0  broadcast 192.168.122.255
        ether 52:54:00:79:84:80  txqueuelen 0  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

[root@lunar1 ~]# 

这里面就是我们安装vm时,使用的两个网卡,可以看到系统自动的缺省网络设备接口名分别是enp0s3和enp0s8。
这里还有一个virbr0,也是Linux7的新特性,后面的文章会陆续介绍,这里暂不赘述。
.
从上面的解释来看,enp0s3的含义就很清晰了:

	en -- 以太网
	p0-- PCI 位置
	s3-- 热插拔插槽索引号

在Linux7中,还有很多关于网络管理命令的改变,例如,在Linux7中,使用ip和ss等命令代替了以前的ifconfig route arp netstat等等。
注意,在linux6中,已经使用ip和ss来管理了。
.
下面我们尝试添加一块新的网卡:
首先保证NetworkManager是开启的状态(不启用NetworkManager服务也可以添加,但是我感觉麻烦):

[root@lunar1 ~]# systemctl status NetworkManager
NetworkManager.service - Network Manager
   Loaded: loaded (/usr/lib/systemd/system/NetworkManager.service; enabled)
   Active: active (running) since Sun 2015-10-04 10:19:02 CST; 17min ago
 Main PID: 566 (NetworkManager)
   CGroup: /system.slice/NetworkManager.service
           └─566 /usr/sbin/NetworkManager --no-daemon

Oct 04 10:19:03 lunar1 NetworkManager[566]: <info>  parsing /etc/sysconfig/network-scripts/ifcfg-lo ...
Oct 04 10:19:03 lunar1 NetworkManager[566]: <info>  parsing /etc/sysconfig/network-scripts/ifcfg-lo ...
Oct 04 10:19:03 lunar1 NetworkManager[566]: <info>  parsing /etc/sysconfig/network-scripts/ifcfg-lo ...
Oct 04 10:19:06 lunar1 NetworkManager[566]: <info>  startup complete
Oct 04 10:19:33 lunar1 NetworkManager[566]: <info>  (enp0s3): Activation: Stage 4 of 5 (IPv6 Configure Timeout) scheduled...
Oct 04 10:19:33 lunar1 NetworkManager[566]: <info>  (enp0s8): Activation: Stage 4 of 5 (IPv6 Configure Timeout) scheduled...
Oct 04 10:19:33 lunar1 NetworkManager[566]: <info>  (enp0s3): Activation: Stage 4 of 5 (IPv6 Configure Timeout) started...
Oct 04 10:19:33 lunar1 NetworkManager[566]: <info>  (enp0s3): Activation: Stage 4 of 5 (IPv6 Configure Timeout) complete.
Oct 04 10:19:33 lunar1 NetworkManager[566]: <info>  (enp0s8): Activation: Stage 4 of 5 (IPv6 Configure Timeout) started...
Oct 04 10:19:33 lunar1 NetworkManager[566]: <info>  (enp0s8): Activation: Stage 4 of 5 (IPv6 Configure Timeout) complete.
[root@lunar1 ~]# 

然后,我们关闭OS,然后在vbox中新增加一块网卡,开机时间教平时慢了很多:

[root@lunar1 ~]# systemd-analyze
Startup finished in 653ms (kernel) + 3.425s (initrd) + 56.070s (userspace) = 1min 150ms
[root@lunar1 ~]# 

平时大概Linux7的启动速度在30秒所有,这里使用了1分钟左右,因此,我们检查一下是否有哪些单元启动失败造成的:

[root@lunar1 ~]# systemctl --failed
  UNIT                               LOAD   ACTIVE SUB    DESCRIPTION
● kdump.service                      loaded failed failed Crash recovery kernel arming
● NetworkManager-wait-online.service loaded failed failed Network Manager Wait Online
● rngd.service                       loaded failed failed Hardware RNG Entropy Gatherer Daemon

LOAD   = Reflects whether the unit definition was properly loaded.
ACTIVE = The high-level unit activation state, i.e. generalization of SUB.
SUB    = The low-level unit activation state, values depend on unit type.

3 loaded units listed. Pass --all to see loaded but inactive units, too.
To show all installed unit files use 'systemctl list-unit-files'.
[root@lunar1 ~]# 

这里我新增加了一个网卡,我们看到新增网卡的失败信息。
NetworkManager服务是用户态服务,因此起服务启动配置文件保存在/usr/lib/systemd/system/中:

[root@lunar1 ~]# ll /usr/lib/systemd/system/|grep Network
-rw-r--r--. 1 root root     353 11月 21 00:55 NetworkManager-dispatcher.service
-rw-r--r--. 1 root root     419 11月 21 00:55 NetworkManager.service
-rw-r--r--. 1 root root     284 11月 21 00:55 NetworkManager-wait-online.service
[root@lunar1 ~]# 

我们查看一下NetworkManager的依赖关系:

[root@lunar1 ~]# systemctl list-dependencies NetworkManager
NetworkManager.service
● ├─system.slice
● ├─basic.target
● │ ├─alsa-restore.service
● │ ├─alsa-state.service
● │ ├─firewalld.service
● │ ├─microcode.service
● │ ├─rhel-autorelabel-mark.service
● │ ├─rhel-autorelabel.service
● │ ├─rhel-configure.service
● │ ├─rhel-dmesg.service
● │ ├─rhel-loadmodules.service
● │ ├─paths.target
● │ ├─slices.target
● │ │ ├─-.slice
● │ │ └─system.slice
● │ ├─sockets.target
● │ │ ├─avahi-daemon.socket
● │ │ ├─cups.socket
● │ │ ├─dbus.socket
● │ │ ├─dm-event.socket
● │ │ ├─iscsid.socket
● │ │ ├─iscsiuio.socket
● │ │ ├─rpcbind.socket
● │ │ ├─systemd-initctl.socket
● │ │ ├─systemd-journald.socket
● │ │ ├─systemd-shutdownd.socket
● │ │ ├─systemd-udevd-control.socket
● │ │ └─systemd-udevd-kernel.socket
● │ ├─sysinit.target
● │ │ ├─dev-hugepages.mount
● │ │ ├─dev-mqueue.mount
● │ │ ├─dmraid-activation.service
● │ │ ├─iscsi.service
● │ │ ├─kmod-static-nodes.service
● │ │ ├─ldconfig.service
● │ │ ├─lvm2-lvmetad.socket
● │ │ ├─lvm2-lvmpolld.socket
● │ │ ├─lvm2-monitor.service
● │ │ ├─multipathd.service
● │ │ ├─plymouth-read-write.service
● │ │ ├─plymouth-start.service
● │ │ ├─proc-sys-fs-binfmt_misc.automount
● │ │ ├─sys-fs-fuse-connections.mount
● │ │ ├─sys-kernel-config.mount
● │ │ ├─sys-kernel-debug.mount
● │ │ ├─systemd-ask-password-console.path
● │ │ ├─systemd-binfmt.service
● │ │ ├─systemd-firstboot.service
● │ │ ├─systemd-hwdb-update.service
● │ │ ├─systemd-journal-catalog-update.service
● │ │ ├─systemd-journal-flush.service
● │ │ ├─systemd-journald.service
● │ │ ├─systemd-machine-id-commit.service
● │ │ ├─systemd-modules-load.service
● │ │ ├─systemd-random-seed.service
● │ │ ├─systemd-sysctl.service
● │ │ ├─systemd-tmpfiles-setup-dev.service
● │ │ ├─systemd-tmpfiles-setup.service
● │ │ ├─systemd-udev-trigger.service
● │ │ ├─systemd-udevd.service
● │ │ ├─systemd-update-done.service
● │ │ ├─systemd-update-utmp.service
● │ │ ├─systemd-vconsole-setup.service
● │ │ ├─cryptsetup.target
● │ │ ├─local-fs.target
● │ │ │ ├─-.mount
● │ │ │ ├─boot.mount
● │ │ │ ├─home.mount
● │ │ │ ├─rhel-import-state.service
● │ │ │ ├─rhel-readonly.service
● │ │ │ └─systemd-remount-fs.service
● │ │ └─swap.target
● │ │   └─dev-mapper-centos\x2dswap.swap
● │ └─timers.target
● │   └─systemd-tmpfiles-clean.timer
● └─network.target

[root@lunar1 ~]# 
1
这里我们看到Linux7开始使用enp0s3作为第一个缺省的网络接口名,类似于以前的eth0,当然,你后面可以修改这个缺省的网络接口名(修改grub的方法)。
enp0s8是第二个网络接口名,而enp0s9就是我们新添加的第三个网络接口名。
enp0s3和enp0s8我们在安装时已经配置了网络连接和IP地址,设置了启动自动连接,因此没有问题。
enp0s9需要我们手工配置。这里面还有一个virbr0,这个接口在OEL Linux7中缺省是没有的,但是在CentOS中有这个
接下来,使用nmtui给新增的网卡配置IP:
确保NetworkManager是启动的状态:

[root@lunar1 ~]# systemctl status NetworkManager
● NetworkManager.service - Network Manager
   Loaded: loaded (/usr/lib/systemd/system/NetworkManager.service; enabled; vendor preset: enabled)
   Active: active (running) since 六 2016-01-16 06:38:43 CST; 36min ago
 Main PID: 758 (NetworkManager)
   CGroup: /system.slice/NetworkManager.service
           └─758 /usr/sbin/NetworkManager --no-daemon

1月 16 07:13:45 lunar1 NetworkManager[758]: <info>  (enp0s9): device state change: failed -> disconnected (reason 'none') [120 30 0]
1月 16 07:13:45 lunar1 NetworkManager[758]: <info>  Auto-activating connection 'enp0s9'.
1月 16 07:13:45 lunar1 NetworkManager[758]: <info>  (enp0s9): Activation: starting connection 'enp0s9' (5e43be5e-5a8c-4f33-bdd1-dfdce55cec0d)
1月 16 07:13:45 lunar1 NetworkManager[758]: <info>  (enp0s9): device state change: disconnected -> prepare (reason 'none') [30 40 0]
1月 16 07:13:45 lunar1 NetworkManager[758]: <info>  (enp0s9): device state change: prepare -> config (reason 'none') [40 50 0]
1月 16 07:13:45 lunar1 NetworkManager[758]: <info>  (enp0s9): device state change: config -> ip-config (reason 'none') [50 70 0]
1月 16 07:13:45 lunar1 NetworkManager[758]: <info>  (enp0s9): device state change: ip-config -> ip-check (reason 'none') [70 80 0]
1月 16 07:13:45 lunar1 NetworkManager[758]: <info>  (enp0s9): device state change: ip-check -> secondaries (reason 'none') [80 90 0]
1月 16 07:13:45 lunar1 NetworkManager[758]: <info>  (enp0s9): device state change: secondaries -> activated (reason 'none') [90 100 0]
1月 16 07:13:45 lunar1 NetworkManager[758]: <info>  (enp0s9): Activation: successful, device activated.
[root@lunar1 ~]#

nmtui 属于curses-based text user interface(文本用户界面), 类似Linux7以前的setup工具。
从该工具的输出不难看出,nmtui可以用来编辑连接、启用/禁用连接、更改主机名:

┌┤ NetworkManag ├┐
│                │
│ 请选择一个选项 │
│                │
│ 编辑连接       │
│ 激活连接       │
│ 设定系统主机名 │
│                │
│ 退出           │
│                │
│         <确定> │
│                │
└────────────────

按照提示依次设置后,网卡连接就有了,非常简单:

[root@lunar1 ~]# ifconfig                                                                                                                                                                      
enp0s3: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.56.11  netmask 255.255.255.0  broadcast 192.168.56.255
        inet6 fe80::a00:27ff:feee:cd8d  prefixlen 64  scopeid 0x20<link>
        ether 08:00:27:ee:cd:8d  txqueuelen 1000  (Ethernet)
        RX packets 812  bytes 66438 (64.8 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 509  bytes 155445 (151.8 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

enp0s8: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.60.11  netmask 255.255.255.0  broadcast 192.168.60.255
        inet6 fe80::a00:27ff:fe42:fb8  prefixlen 64  scopeid 0x20<link>
        ether 08:00:27:42:0f:b8  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 27  bytes 3989 (3.8 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

enp0s9: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.209.11  netmask 255.255.255.0  broadcast 192.168.209.255
        inet6 fe80::a00:27ff:fea8:83cf  prefixlen 64  scopeid 0x20<link>
        ether 08:00:27:a8:83:cf  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 289  bytes 51303 (50.1 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 0  (Local Loopback)
        RX packets 660  bytes 53540 (52.2 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 660  bytes 53540 (52.2 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

[root@lunar1 ~]# 

nmtui的配置和修改会自动更新/etc/sysconfig/network-scripts/下面相关的配置文件:
下面的/etc/sysconfig/network-scripts/ifcfg-enp0s9就是使用nmtui操作后自动生成的配置文件:

[root@lunar1 ~]# ll /etc/sysconfig/network-scripts/ifcfg*
-rw-r--r--. 1 root root 319 1月  16 03:08 /etc/sysconfig/network-scripts/ifcfg-enp0s3
-rw-r--r--. 1 root root 319 1月  16 03:08 /etc/sysconfig/network-scripts/ifcfg-enp0s8
-rw-r--r--. 1 root root 315 1月  16 07:18 /etc/sysconfig/network-scripts/ifcfg-enp0s9
-rw-r--r--. 1 root root 254 9月  16 19:51 /etc/sysconfig/network-scripts/ifcfg-lo
[root@lunar1 ~]# cat /etc/sysconfig/network-scripts/ifcfg-enp0s9
HWADDR=08:00:27:A8:83:CF
TYPE=Ethernet
BOOTPROTO=none		------#启用静态IP地址
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes		------#缺省会启用IPv6,通常装Oracle,我们都禁用IPv6
IPV6_AUTOCONF=yes	------#IPv6的自动配置,建议禁用
IPV6_DEFROUTE=no	------#IPv6的的缺省路,建议禁用
IPV6_FAILURE_FATAL=no	------#IPv6的配置,建议禁用
NAME=enp0s9
UUID=5e43be5e-5a8c-4f33-bdd1-dfdce55cec0d	#这里绑定了UUID,建议不绑定UUID,让系统需要时自动识别
ONBOOT=yes		------#开启自动启用网络连接
IPADDR=192.168.209.11	------#设置IP地址
PREFIX=24		------#设置子网掩码
GATEWAY=192.168.209.1	------#设置网关
IPV6_PEERDNS=yes	------#IPv6的DNS相关配置,建议禁用
IPV6_PEERROUTES=yes	------#IPv6的路由,建议禁用
[root@lunar1 ~]#

为了安装Oracle,一般我们会禁用IPv6(尤其是ASM是不支持IPv6的),修改后的样子:

[root@lunar1 network-scripts]# cat ifcfg-enp0s9
TYPE=Ethernet
BOOTPROTO=static  
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=no
IPV6_AUTOCONF=no
IPV6_DEFROUTE=no
IPV6_FAILURE_FATAL=no
NAME=enp0s3
#UUID=3e33deb2-5f53-4850-a424-76042c27b419
DEVICE=enp0s3
ONBOOT=yes
IPADDR=192.168.209.11
PREFIX=24
GATEWAY=192.168.209.1
IPV6_PEERDNS=no
IPV6_PEERROUTES=no
IPV6_PRIVACY=no
[root@lunar1 network-scripts]# 

总结:
新增网卡时,如果NetworkManager是启动的,那么只需要使用nmtui配置新增网卡的设备名称,IP地址等信息,不需要其他任何操作。
NetworkManager会自动把以前的重新启动网络(service network restart等)工作全部自动后台完成,非常方便。


Linux7(CentOS,RHEL,OEL)和Oracle RAC环境系列–1-简介
Linux7(CentOS,RHEL,OEL)和Oracle RAC环境系列-2-修改主机名和hostnamectl工具的使用
Linux7(CentOS,RHEL,OEL)和Oracle RAC环境系列–3-systemd(d.bin和ohasd守护进程)
Linux7(CentOS,RHEL,OEL)和Oracle RAC环境系列–4-target(图形界面和字符界面)
Linux7(CentOS,RHEL,OEL)和Oracle RAC环境系列–5-防火墙
Linux7(CentOS,RHEL,OEL)和Oracle RAC环境系列–6-开机自动启动或者禁用服务
Linux7(CentOS,RHEL,OEL)和Oracle RAC环境系列-7-网络管理之添加网
Linux7(CentOS,RHEL,OEL)和Oracle RAC环境系列-7-网络管理之修改IP地址
Linux7(CentOS,RHEL,OEL)和Oracle RAC环境系列-7-网络管理之修改网络接口名
Linux7(CentOS,RHEL,OEL)和Oracle RAC环境系列-8-在Linux7上安装11.2 RAC和12.1 RAC需要禁用哪些服务
Linux7(CentOS,RHEL,OEL)和Oracle RAC环境系列-9-Linux 7.2上的virbr0设备
Linux7(CentOS,RHEL,OEL)和Oracle RAC环境系列-10-ABRT-系统启动后自动检查和报告错误
Linux7(CentOS,RHEL,OEL)和Oracle RAC环境系列-11-配置VNC和常见问题处理

发表在 Database, Installation and Deinstall, Linux, network | 标签为 , , , , , , | 留下评论

Linux7(CentOS,RHEL,OEL)和Oracle RAC环境系列–6-开机自动启动或者禁用服务

测试目的:研究一下Linux7中,如何设置服务的开机自动启动或者不自动启动
当前的OS版本:

[root@lunar1 ~]# cat /etc/centos-release
CentOS Linux release 7.2.1511 (Core) 
[root@lunar1 ~]# 
[root@lunar1 ~]# cat /etc/centos-release-upstream
Derived from Red Hat Enterprise Linux 7.2 (Source)
[root@lunar1 ~]# 
[root@lunar1 ~]# cat /etc/os-release
NAME="CentOS Linux"
VERSION="7 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="7"
PRETTY_NAME="CentOS Linux 7 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:7"
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"

CENTOS_MANTISBT_PROJECT="CentOS-7"
CENTOS_MANTISBT_PROJECT_VERSION="7"
REDHAT_SUPPORT_PRODUCT="centos"
REDHAT_SUPPORT_PRODUCT_VERSION="7"

[root@lunar1 ~]# 
[root@lunar1 ~]# cat /etc/system-release-cpe
cpe:/o:centos:centos:7
[root@lunar1 ~]#  

CRS版本:

[root@lunar1 ~]# crsctl query crs activeversion -f
Oracle Clusterware active version on the cluster is [12.1.0.2.0]. The cluster upgrade state is [NORMAL]. The cluster active patch level is [0].
[root@lunar1 ~]# 

Linux7使用systemd替换了SysV,Systemd目的是要取代Unix时代以来一直在使用的init系统,兼容SysV和LSB的启动脚本,而且够在进程启动过程并行加载必要的服务。
支持并行化任务
同时采用socket式与D-Bus总线式激活服务;
按需启动守护进程(daemon);
利用 Linux 的 cgroups 监视进程;
支持快照和系统恢复;
维护挂载点和自动挂载点;
各服务间基于依赖关系进行精密控制
.
systemd可以创建不同的状态,状态提供了灵活的机制来设置启动时的配置项。
这些状态是由多个unit文件组成的,状态又叫做启动目标(target),unit文件可以控制服务、设备、套接字和挂载点。
systemd配置文件被称为unit单元,使用man systemd可以查看这些unit(单元)的具体定义。
根据类型不同,unit以不同的扩展名结尾。
.service系统服务;
.target一组系统服务;
.automount自动挂载点;
.device能被内核识别的设备;
.mount挂载点;
.path文件系统的文件或者目录;
.scope外部创建的进程;
.slice一组分层次管理的系统进程;
.snapshot系统服务状态管理;
.socket进程间通讯套接字;
.swap定义swap文件或者设备;
.timer定义定时器。
.
所有可用的unit(单元文件)存放在下面的两个目录下:
/etc/systemd/system/ —–优先级更高(这个目录中的内容很少,一般只有十几个)
例如:

[root@localhost ~]# ll /usr/lib/systemd/system/|grep  journald
-rw-r--r--. 1 root root 1145 11月 20 12:49 systemd-journald.service
-rw-r--r--. 1 root root  833 11月 20 12:49 systemd-journald.socket
[root@localhost ~]# 

/usr/lib/systemd/system/ —这个目录是一些Unit的socket,targt等等
例如:

[root@localhost ~]# ll /usr/lib/systemd/system/|grep  runlevel
lrwxrwxrwx. 1 root root   15 1月  20 09:57 runlevel0.target -> poweroff.target
lrwxrwxrwx. 1 root root   13 1月  20 09:57 runlevel1.target -> rescue.target
drwxr-xr-x. 2 root root   49 1月  20 09:57 runlevel1.target.wants
lrwxrwxrwx. 1 root root   17 1月  20 09:57 runlevel2.target -> multi-user.target
drwxr-xr-x. 2 root root   49 1月  20 09:57 runlevel2.target.wants
lrwxrwxrwx. 1 root root   17 1月  20 09:57 runlevel3.target -> multi-user.target
drwxr-xr-x. 2 root root   49 1月  20 09:57 runlevel3.target.wants
lrwxrwxrwx. 1 root root   17 1月  20 09:57 runlevel4.target -> multi-user.target
drwxr-xr-x. 2 root root   49 1月  20 09:57 runlevel4.target.wants
lrwxrwxrwx. 1 root root   16 1月  20 09:57 runlevel5.target -> graphical.target
drwxr-xr-x. 2 root root   49 1月  20 09:57 runlevel5.target.wants
lrwxrwxrwx. 1 root root   13 1月  20 09:57 runlevel6.target -> reboot.target
-rw-r--r--. 1 root root  761 11月 20 12:49 systemd-update-utmp-runlevel.service
[root@localhost ~]# 

当前系统已经安装了Oracle 12.1 GI,查看当前开机自动启动的服务:

[root@lunar1 ~]# ls -lrt /etc/systemd/system/multi-user.target.wants/|grep oracle
lrwxrwxrwx  1 root root 38 Jan 19 17:16 oracle-tfa.service -> /etc/systemd/system/oracle-tfa.service
lrwxrwxrwx  1 root root 40 Jan 19 17:18 oracle-ohasd.service -> /etc/systemd/system/oracle-ohasd.service
[root@lunar1 ~]# 
[root@lunar1 ~]# ls /etc/systemd/system/multi-user.target.wants/|wc -l
35
[root@lunar1 ~]# 
[root@lunar1 ~]# ls /etc/systemd/system/multi-user.target.wants/
abrt-ccpp.service    atd.service         irqbalance.service      libvirtd.service        oracle-ohasd.service  rsyslog.service          vboxadd-x11.service
abrtd.service        chronyd.service     kdump.service           mdmonitor.service       oracle-tfa.service    sshd.service             vmtoolsd.service
abrt-oops.service    crond.service       ksm.service             ModemManager.service    postfix.service       sysstat.service          vncserver@:1.service
abrt-vmcore.service  hypervkvpd.service  ksmtuned.service        NetworkManager.service  remote-fs.target      vboxadd.service          vncserver@:2.service
abrt-xorg.service    hypervvssd.service  libstoragemgmt.service  nfs-client.target       rngd.service          vboxadd-service.service  vncserver@:3.service
[root@lunar1 ~]# 

OEL 7.2和CentOS 7.2中,如果选择了GUI服务器,添加开发包和兼容库后,一般来说,没有安装Oracle时,只需要32个自动启动的服务:

[root@localhost ~]# ls /etc/systemd/system/multi-user.target.wants/|wc -l
32
[root@localhost ~]# ls /etc/systemd/system/multi-user.target.wants/
abrt-ccpp.service    abrt-xorg.service     chronyd.service  hypervkvpd.service  ksmtuned.service        ModemManager.service    remote-fs.target  sshd.service
abrtd.service        atd.service           crond.service    hypervvssd.service  libstoragemgmt.service  NetworkManager.service  rngd.service      sysstat.service
abrt-oops.service    auditd.service        cups.path        irqbalance.service  libvirtd.service        nfs-client.target       rsyslog.service   tuned.service
abrt-vmcore.service  avahi-daemon.service  cups.service     ksm.service         mdmonitor.service       postfix.service         smartd.service    vmtoolsd.service
[root@localhost ~]# 

以irqbalance.service为例,该服务的作用大致是用于优化中断分配,它会自动收集系统数据以分析使用模式
并依据系统负载状况将工作状态置于 Performance mode 或 Power-save mode.
处于 Performance mode 时,irqbalance 会将中断尽可能均匀地分发给各个 CPU core,以充分利用 CPU 多核,提升性能.
处于 Power-save mode 时,irqbalance 会将中断集中分配给第一个 CPU,以保证其它空闲 CPU 的睡眠时间,降低能耗.
(详见:http://www.irqbalance.org/documentation.php)
IRP的github项目地址:https://github.com/Irqbalance/irqbalance
.
Oracle官方文档中建议:
When Should Not To Use
In most of time, irqbalance service is enabled and should be used unless:
Manually pinning apps/IRQ’s to specific cores for a very good reason (low latency, realtime requirements, etc.)Virtual Guests.
It does not really make sense because unless you are pinning the guest to specific CPUs and IRQs and dedicated net/storage hardware, you will likely not see the benefits you would on bare metal.
.
在Exadata的低版本中,需要禁用该服务,否则容易出现系统问题,参见:
Exadata 11.2.3.2.1 release and patch (14522699) for Exadata 11.1.3.3, 11.2.1.2.x, 11.2.2.2.x, 11.2.2.3.x, 11.2.2.4.x, 11.2.3.1.x, 11.2.3.2.x (Doc ID 1485475.1)
Stop and disable irqbalance service on Exadata V2 database and storage servers (X4275) to prevent unexpected reboots caused by Linux bug 15835941
相关bug:
BUG:15835941 – V2 EXADATA REBOOTED FREQUENTLY AFTER UPGRADE: NO IRQ HANDLER FOR VECTOR
BUG:17165350 – BL460 G6 NIC’S GO OFFLINE “DO_IRQ: 10.136 NO IRQ HANDLER FOR VECTOR (IRQ -1)”
.
现在,查看一下该服务当前的状态:

[root@lunar1 system]# systemctl status irqbalance.service
● irqbalance.service - irqbalance daemon
   Loaded: loaded (/usr/lib/systemd/system/irqbalance.service; enabled; vendor preset: enabled)
   Active: active (running) since Wed 2016-01-20 07:58:38 CST; 1h 0min ago
 Main PID: 743 (irqbalance)
   CGroup: /system.slice/irqbalance.service
           └─743 /usr/sbin/irqbalance --foreground

Jan 20 07:58:38 lunar1.oracle.com systemd[1]: Started irqbalance daemon.
Jan 20 07:58:38 lunar1.oracle.com systemd[1]: Starting irqbalance daemon...
[root@lunar1 system]# 

我们看到当前irqbalance服务runing的状态,它加载的配置文件是/usr/lib/systemd/system/irqbalance.service
启动日期是:Wed 2016-01-20 07:58:38 CST; 1h 0min ago
进程号是743
现在我们停止这个服务:

[root@lunar1 system]# systemctl stop irqbalance.service
[root@lunar1 system]# systemctl status irqbalance.service
● irqbalance.service - irqbalance daemon
   Loaded: loaded (/usr/lib/systemd/system/irqbalance.service; enabled; vendor preset: enabled)
   Active: inactive (dead) since Wed 2016-01-20 09:00:07 CST; 5s ago
  Process: 743 ExecStart=/usr/sbin/irqbalance --foreground $IRQBALANCE_ARGS (code=exited, status=0/SUCCESS)
 Main PID: 743 (code=exited, status=0/SUCCESS)

Jan 20 07:58:38 lunar1.oracle.com systemd[1]: Started irqbalance daemon.
Jan 20 07:58:38 lunar1.oracle.com systemd[1]: Starting irqbalance daemon...
Jan 20 09:00:07 lunar1.oracle.com systemd[1]: Stopping irqbalance daemon...
Jan 20 09:00:07 lunar1.oracle.com systemd[1]: Stopped irqbalance daemon.
[root@lunar1 system]# 

根据上面的信息,我们知道该服务是开机自动启动的服务,当前的状态是没有启动的(Active: inactive (dead) )
查看一下该服务的定义:

[root@localhost ~]# cat /usr/lib/systemd/system/irqbalance.service
[Unit]
Description=irqbalance daemon
After=syslog.target

[Service]
EnvironmentFile=/etc/sysconfig/irqbalance
ExecStart=/usr/sbin/irqbalance --foreground $IRQBALANCE_ARGS

[Install]
WantedBy=multi-user.target
[root@localhost ~]# 

这里我们看到该服务是在After=syslog.target之后启动的服务,也就是它依赖于syslog这个服务。
然后我们设置禁止irqbalance.service开机自动启动:

[root@lunar1 system]# systemctl disable irqbalance.service
Removed symlink /etc/systemd/system/multi-user.target.wants/irqbalance.service.
[root@lunar1 system]# 

这里我们看到,禁止开机自动启动的本质就是:
Removed symlink /etc/systemd/system/multi-user.target.wants/irqbalance.service.
也就是我们前面说的,开机自动启动的实质是删除了/etc/systemd/system/下的link文件:

[root@lunar1 system]# ll /etc/systemd/system/multi-user.target.wants/irqbalance.service
ls: cannot access /etc/systemd/system/multi-user.target.wants/irqbalance.service: No such file or directory
[root@lunar1 system]# 

具体删除那个target下的link文件呢?
由于该服务定义文件中的[Install]部分写明了“WantedBy=multi-user.target”
因此就需要删除/etc/systemd/system/multi-user.target.wants/irqbalance.service文件。
.
再次查看,irqbalance.service服务已经是开机不自动重启了“/irqbalance.service; disabled;”:

[root@lunar1 system]# systemctl status irqbalance.service
● irqbalance.service - irqbalance daemon
   Loaded: loaded (/usr/lib/systemd/system/irqbalance.service; disabled; vendor preset: enabled)
   Active: inactive (dead)

Jan 20 07:58:38 lunar1.oracle.com systemd[1]: Started irqbalance daemon.
Jan 20 07:58:38 lunar1.oracle.com systemd[1]: Starting irqbalance daemon...
Jan 20 09:00:07 lunar1.oracle.com systemd[1]: Stopping irqbalance daemon...
Jan 20 09:00:07 lunar1.oracle.com systemd[1]: Stopped irqbalance daemon.
[root@lunar1 system]# 

再来看一下开机自动启动的服务在Linux7中如何实现的:

[root@lunar1 system]# systemctl enable irqbalance.service
Created symlink from /etc/systemd/system/multi-user.target.wants/irqbalance.service to /usr/lib/systemd/system/irqbalance.service.
[root@lunar1 system]# ll /etc/systemd/system/multi-user.target.wants/irqbalance.service
lrwxrwxrwx 1 root root 42 Jan 20 09:08 /etc/systemd/system/multi-user.target.wants/irqbalance.service -> /usr/lib/systemd/system/irqbalance.service
[root@lunar1 system]# 

这里我们看到,设置开机自动重启的本质就是在/etc/systemd/system/multi-user.target.wants/下面创建一个指向/usr/lib/systemd/system/同名service定义的软link
为什么在/etc/systemd/system/的multi-user.target.wants目录下创建呢?
还记得定义文件中的[Install]部分怎么写的么:
WantedBy=multi-user.target
因此,就是创建在multi-user.target.wants目录下了。
.
如果使用service命令是什么效果:

[root@localhost ~]# systemctl status irqbalance.service
● irqbalance.service - irqbalance daemon
   Loaded: loaded (/usr/lib/systemd/system/irqbalance.service; enabled; vendor preset: enabled)
   Active: active (running) since 三 2016-01-20 10:49:37 CST; 2h 32min ago
 Main PID: 630 (irqbalance)
   CGroup: /system.slice/irqbalance.service
           └─630 /usr/sbin/irqbalance --foreground

1月 20 10:49:37 localhost.localdomain systemd[1]: Started irqbalance daemon.
1月 20 10:49:37 localhost.localdomain systemd[1]: Starting irqbalance daemon...
[root@localhost ~]# 
[root@localhost ~]# 

重启服务:

[root@localhost ~]# service irqbalance restart 
Redirecting to /bin/systemctl restart  irqbalance.service
[root@localhost ~]# 

这里看到,如果使用service启动服务,本质是重定向到了systemctl命令:/bin/systemctl restart irqbalance.service
再次查看状态:

[root@localhost ~]# systemctl status irqbalance.service
● irqbalance.service - irqbalance daemon
   Loaded: loaded (/usr/lib/systemd/system/irqbalance.service; enabled; vendor preset: enabled)
   Active: active (running) since 三 2016-01-20 13:22:36 CST; 11s ago
 Main PID: 14954 (irqbalance)
   CGroup: /system.slice/irqbalance.service
           └─14954 /usr/sbin/irqbalance --foreground

1月 20 13:22:36 localhost.localdomain systemd[1]: Started irqbalance daemon.
1月 20 13:22:36 localhost.localdomain systemd[1]: Starting irqbalance daemon...
[root@localhost ~]# 

注意服务启动时间从“ 三 2016-01-20 10:49:37 CST; 2h 32min ago”改变为“ 三 2016-01-20 10:49:37 CST; 2h 32min ago”了。
证明service确实可以重启服务,不过我感觉这个是systemd为了向下兼容的。
.
再来看一下Oracle的GIohasd.service服务:

[root@lunar1 ~]# ps -ef|grep ohasd
root      1462     1  0 12:45 ?        00:00:00 /bin/sh /etc/init.d/init.ohasd run >/dev/null 2>&1 </dev/null
root     12192 27423  0 15:31 pts/1    00:00:00 grep --color=auto ohasd
root     27770     1  1 15:02 ?        00:00:18 /u01/app/12.1.0.2/grid/bin/ohasd.bin reboot
[root@lunar1 ~]# 
[root@lunar1 ~]# systemctl status ohasd.service
● ohasd.service - Oracle High Availability Services
   Loaded: loaded (/etc/systemd/system/ohasd.service; enabled; vendor preset: disabled)
   Active: inactive (dead)
[root@lunar1 ~]#

从上面的输出可以看到,已经安装了ohasd.service服务,并且启动进程正在运行
从systemctl status的输出可以看到,目前系统已经加载了/etc/systemd/system/ohasd.service文件,并且设置为开机自动启动的模式了。
但是后面的Active: inactive (dead),不知道是为什么,怀疑是12.1 GI的bug。
注意:
Linux 7.2上Oracle 12.1和12.2beta版本的GI软件有bug,执行root.sh的时候没有正确安装该服务。
现在看到的这个ohasd.service服务是我自己手工安装的。

[root@lunar1 ~]# crsctl query crs autostart 
'Autostart delay':       0
'Autostart servercount': 1
[root@lunar1 ~]# 

CRS状态:

[root@lunar1 ~]# crsctl status res -t
--------------------------------------------------------------------------------
Name           Target  State        Server                   State details       
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.CRSDG.dg
               ONLINE  ONLINE       lunar1                   STABLE
               ONLINE  ONLINE       lunar2                   STABLE
ora.DATADG1.dg
               ONLINE  ONLINE       lunar1                   STABLE
               ONLINE  ONLINE       lunar2                   STABLE
ora.LISTENER.lsnr
               ONLINE  ONLINE       lunar1                   STABLE
               ONLINE  ONLINE       lunar2                   STABLE
ora.asm
               ONLINE  ONLINE       lunar1                   Started,STABLE
               ONLINE  ONLINE       lunar2                   Started,STABLE
ora.net1.network
               ONLINE  ONLINE       lunar1                   STABLE
               ONLINE  ONLINE       lunar2                   STABLE
ora.ons
               ONLINE  ONLINE       lunar1                   STABLE
               ONLINE  ONLINE       lunar2                   STABLE
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.LISTENER_SCAN1.lsnr
      1        ONLINE  ONLINE       lunar1                   STABLE
ora.MGMTLSNR
      1        ONLINE  ONLINE       lunar1                   169.254.128.253,STAB
                                                             LE
ora.cvu
      1        ONLINE  ONLINE       lunar1                   STABLE
ora.lunar1.vip
      1        ONLINE  ONLINE       lunar1                   STABLE
ora.lunar2.vip
      1        ONLINE  ONLINE       lunar2                   STABLE
ora.lunardb.db
      1        ONLINE  ONLINE       lunar1                   Open,STABLE
      2        ONLINE  ONLINE       lunar2                   Open,STABLE
ora.mgmtdb
      1        OFFLINE OFFLINE                               STABLE
ora.oc4j
      1        ONLINE  ONLINE       lunar1                   STABLE
ora.scan1.vip
      1        ONLINE  ONLINE       lunar1                   STABLE
--------------------------------------------------------------------------------
[root@lunar1 ~]# 

这里看到MGMTDB没有启动,这个是有玄机的,后面慢慢说,O(∩_∩)O哈哈~


Linux7(CentOS,RHEL,OEL)和Oracle RAC环境系列–1-简介
Linux7(CentOS,RHEL,OEL)和Oracle RAC环境系列-2-修改主机名和hostnamectl工具的使用
Linux7(CentOS,RHEL,OEL)和Oracle RAC环境系列–3-systemd(d.bin和ohasd守护进程)
Linux7(CentOS,RHEL,OEL)和Oracle RAC环境系列–4-target(图形界面和字符界面)
Linux7(CentOS,RHEL,OEL)和Oracle RAC环境系列–5-防火墙
Linux7(CentOS,RHEL,OEL)和Oracle RAC环境系列–6-开机自动启动或者禁用服务
Linux7(CentOS,RHEL,OEL)和Oracle RAC环境系列-7-网络管理之添加网
Linux7(CentOS,RHEL,OEL)和Oracle RAC环境系列-7-网络管理之修改IP地址
Linux7(CentOS,RHEL,OEL)和Oracle RAC环境系列-7-网络管理之修改网络接口名
Linux7(CentOS,RHEL,OEL)和Oracle RAC环境系列-8-在Linux7上安装11.2 RAC和12.1 RAC需要禁用哪些服务
Linux7(CentOS,RHEL,OEL)和Oracle RAC环境系列-9-Linux 7.2上的virbr0设备
Linux7(CentOS,RHEL,OEL)和Oracle RAC环境系列-10-ABRT-系统启动后自动检查和报告错误
Linux7(CentOS,RHEL,OEL)和Oracle RAC环境系列-11-配置VNC和常见问题处理

发表在 Installation and Deinstall, Linux, ORACLE 12C | 标签为 , , , , , | Comments Off on Linux7(CentOS,RHEL,OEL)和Oracle RAC环境系列–6-开机自动启动或者禁用服务

Linux7(CentOS,RHEL,OEL)和Oracle RAC环境系列–5-防火墙

一般安装Oracle,我们会禁用防火墙和SELINUX等一些列服务,并设置开机不自动启动(disable这些服务)。
比如,防火墙,在Linux7以前的命令:
service NetworkManager stop
service iptables stop
service ip6tables stop

从Linux7开始使用sytemd管理deamon,因此我们看看使用新的systemctl如何来禁用一些服务和防火墙。
.
我这里安装后缺省是开启防火墙,且没有安装iptables和ip6tables的.
检查防火墙状态:
1
[root@lunar1 ~]# firewall-cmd --state
running
[root@lunar1 ~]# 

还可以使用systemctl查看防火墙服务:

[root@lunar1 ~]# systemctl status firewalld.service
● firewalld.service - firewalld - dynamic firewall daemon
   Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled; vendor preset: enabled)
   Active: active (running) since 六 2016-01-16 09:46:16 CST; 1min 39s ago
 Main PID: 686 (firewalld)
   CGroup: /system.slice/firewalld.service
           └─686 /usr/bin/python -Es /usr/sbin/firewalld --nofork --nopid

1月 16 09:46:12 lunar1 systemd[1]: Starting firewalld - dynamic firewall daemon...
1月 16 09:46:16 lunar1 systemd[1]: Started firewalld - dynamic firewall daemon.
[root@lunar1 ~]# 

当前防火墙的服务是开启的,并且开机自动启动,开机自动启动时读取/usr/lib/systemd/system/firewalld.service定义文件。
关闭防火墙:

[root@lunar1 ~]# systemctl stop firewalld.service
[root@lunar1 ~]# 

设置开机不自动启动防火墙服务:

[root@lunar1 ~]# systemctl disable firewalld.service 
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
Removed symlink /etc/systemd/system/basic.target.wants/firewalld.service.
[root@lunar1 ~]# ll /etc/systemd/system/basic.target.wants/|grep firewalld
[root@lunar1 ~]# 

这里看到开机不自动启动的本质是在/etc/systemd/system/中删除防火墙服务的定义文件

再次查看防火墙状态:

[root@lunar1 ~]# firewall-cmd --state
not running
[root@lunar1 ~]# systemctl status firewalld.service
● firewalld.service - firewalld - dynamic firewall daemon
   Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
   Active: inactive (dead)

1月 16 09:46:12 lunar1 systemd[1]: Starting firewalld - dynamic firewall daemon...
1月 16 09:46:16 lunar1 systemd[1]: Started firewalld - dynamic firewall daemon.
1月 16 09:49:13 lunar1 systemd[1]: Stopping firewalld - dynamic firewall daemon...
1月 16 09:49:17 lunar1 systemd[1]: Stopped firewalld - dynamic firewall daemon.
[root@lunar1 ~]# 

上述说明防火墙服务已经被安装了,但是没有设置为自动启动。

可以看到,在Linux7中,systemctl disable一个服务,其本质是将该服务的配置文件的link删除。
然后,将该服务实际的配置文件内容修改为开机不启动进程:

[root@lunar1 ~]# ll /usr/lib/systemd/system/firewalld.service
-rw-r--r--. 1 root root 577 11月 20 20:34 /usr/lib/systemd/system/firewalld.service
[root@lunar1 ~]# cat /usr/lib/systemd/system/firewalld.service
[Unit]
Description=firewalld - dynamic firewall daemon
Before=network.target
Before=libvirtd.service
Before=NetworkManager.service
Conflicts=iptables.service ip6tables.service ebtables.service

[Service]
EnvironmentFile=-/etc/sysconfig/firewalld
ExecStart=/usr/sbin/firewalld --nofork --nopid $FIREWALLD_ARGS
ExecReload=/bin/kill -HUP $MAINPID
# supress to log debug and error output also to /var/log/messages
StandardOutput=null
StandardError=null
Type=dbus
BusName=org.fedoraproject.FirewallD1

[Install]
WantedBy=basic.target
Alias=dbus-org.fedoraproject.FirewallD1.service
[root@lunar1 ~]# 

其中:

	Before=network.target
	Before=libvirtd.service
	Before=NetworkManager.service

这个表示firewalld.service要先于上面3个服务启动:
下面的设置表示不fork进程,没有pid:

ExecStart=/usr/sbin/firewalld --nofork --nopid $FIREWALLD_ARGS

检查iptables和ip6tables:

[root@lunar1 ~]# systemctl status iptables.service
● iptables.service
   Loaded: not-found (Reason: No such file or directory)
   Active: inactive (dead)
[root@lunar1 ~]# systemctl status ip6tables.service
● ip6tables.service
   Loaded: not-found (Reason: No such file or directory)
   Active: inactive (dead)
[root@lunar1 ~]# 

可以看到当前服务没有启动,且没有安装这个服务:

  Loaded: not-found (Reason: No such file or directory)

如果安装的服务会有类似下面的信息:

   Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)

Linux7(CentOS,RHEL,OEL)和Oracle RAC环境系列–1-简介
Linux7(CentOS,RHEL,OEL)和Oracle RAC环境系列-2-修改主机名和hostnamectl工具的使用
Linux7(CentOS,RHEL,OEL)和Oracle RAC环境系列–3-systemd(d.bin和ohasd守护进程)
Linux7(CentOS,RHEL,OEL)和Oracle RAC环境系列–4-target(图形界面和字符界面)
Linux7(CentOS,RHEL,OEL)和Oracle RAC环境系列–5-防火墙
Linux7(CentOS,RHEL,OEL)和Oracle RAC环境系列–6-开机自动启动或者禁用服务
Linux7(CentOS,RHEL,OEL)和Oracle RAC环境系列-7-网络管理之添加网
Linux7(CentOS,RHEL,OEL)和Oracle RAC环境系列-7-网络管理之修改IP地址
Linux7(CentOS,RHEL,OEL)和Oracle RAC环境系列-7-网络管理之修改网络接口名
Linux7(CentOS,RHEL,OEL)和Oracle RAC环境系列-8-在Linux7上安装11.2 RAC和12.1 RAC需要禁用哪些服务
Linux7(CentOS,RHEL,OEL)和Oracle RAC环境系列-9-Linux 7.2上的virbr0设备
Linux7(CentOS,RHEL,OEL)和Oracle RAC环境系列-10-ABRT-系统启动后自动检查和报告错误
Linux7(CentOS,RHEL,OEL)和Oracle RAC环境系列-11-配置VNC和常见问题处理

发表在 Installation and Deinstall, Linux, ORACLE 12C, RAC | 标签为 , , , , , | 留下评论

Linux7(CentOS,RHEL,OEL)和Oracle RAC环境系列–4-target(图形界面和字符界面)

systemd可以创建不同的状态,状态提供了灵活的机制来设置启动时的配置项。这些状态是由多个unit文件组成的,状态又叫做启动目标(target)。
unit文件可以控制服务、设备、套接字和挂载点,这些文件存放在下面的两个目录下:
/etc/systemd/system/
/usr/lib/systemd/system/

其中/etc/systemd/system/的优先级更高。
如果需要创建自己的unit,可以修改第一个目录中的文件来进行自定义配置,而第二个目录中的文件是package安装时保存的备份。
比如在Linux7.2(CentOS,RHEL,OEL)12.1.0.2和12.2beta版本的Oracle GI程序就需要自己手工创建ohasd的服务(这是bug),后续文章陆续会讲解到。
目录/etc/systemd/system/目录中只有很少的配置文件,在这里面配置的服务优先级高于配置在/usr/lib/systemd/system/中的服务:

[root@lunar system]# ll /etc/systemd/system/|grep ohasd
-rw-r--r--  1 root root  361 Oct  9 12:29 oracle-ohasd.service
[root@lunar system]# 
[root@lunar system]# ll /etc/systemd/system/
total 16
drwxr-xr-x. 2 root root   30 Oct  8 07:17 basic.target.wants
drwxr-xr-x. 2 root root   30 Oct  7 23:08 bluetooth.target.wants
lrwxrwxrwx. 1 root root   41 Oct  7 23:08 dbus-org.bluez.service -> /usr/lib/systemd/system/bluetooth.service
lrwxrwxrwx. 1 root root   44 Oct  7 23:10 dbus-org.freedesktop.ModemManager1.service -> /usr/lib/systemd/system/ModemManager.service
lrwxrwxrwx. 1 root root   46 Oct  7 23:04 dbus-org.freedesktop.NetworkManager.service -> /usr/lib/systemd/system/NetworkManager.service
lrwxrwxrwx. 1 root root   57 Oct  7 23:04 dbus-org.freedesktop.nm-dispatcher.service -> /usr/lib/systemd/system/NetworkManager-dispatcher.service
lrwxrwxrwx  1 root root   41 Oct  8 16:51 default.target -> /usr/lib/systemd/system/multi-user.target
drwxr-xr-x. 2 root root   85 Oct  7 23:02 default.target.wants
lrwxrwxrwx. 1 root root   35 Oct  7 23:08 display-manager.service -> /usr/lib/systemd/system/gdm.service
drwxr-xr-x. 2 root root   31 Oct  7 23:02 getty.target.wants
drwxr-xr-x. 2 root root   90 Oct  9 12:29 graphical.target.wants
drwxr-xr-x. 2 root root 4096 Oct  9 12:29 multi-user.target.wants
lrwxrwxrwx. 1 root root   38 Oct  7 23:04 mysql.service -> /usr/lib/systemd/system/mysqld.service
-rw-r--r--  1 root root  361 Oct  9 12:29 oracle-ohasd.service
drwxr-xr-x. 2 root root   25 Oct  7 23:05 printer.target.wants
drwxr-xr-x. 2 root root 4096 Oct  8 07:32 sockets.target.wants
drwxr-xr-x. 2 root root   35 Oct  7 23:10 spice-vdagentd.target.wants
drwxr-xr-x. 2 root root 4096 Oct  8 22:19 sysinit.target.wants
drwxr-xr-x. 2 root root   83 Oct  7 23:05 system-update.target.wants
[root@lunar system]# 

基本target中,只有微码服务:

[root@lunar1 ~]# ll /etc/systemd/system/basic.target.wants
总用量 0
lrwxrwxrwx. 1 root root 41 1月  16 03:00 microcode.service -> /usr/lib/systemd/system/microcode.service
[root@lunar1 ~]# 

sysinit的目标:

[root@lunar1 ~]# ll /etc/systemd/system/sysinit.target.wants
总用量 0
lrwxrwxrwx. 1 root root 49 1月  16 02:57 dmraid-activation.service -> /usr/lib/systemd/system/dmraid-activation.service
lrwxrwxrwx. 1 root root 37 1月  16 02:53 iscsi.service -> /usr/lib/systemd/system/iscsi.service
lrwxrwxrwx. 1 root root 43 1月  16 02:54 lvm2-lvmetad.socket -> /usr/lib/systemd/system/lvm2-lvmetad.socket
lrwxrwxrwx. 1 root root 44 1月  16 02:54 lvm2-lvmpolld.socket -> /usr/lib/systemd/system/lvm2-lvmpolld.socket
lrwxrwxrwx. 1 root root 44 1月  16 02:54 lvm2-monitor.service -> /usr/lib/systemd/system/lvm2-monitor.service
lrwxrwxrwx. 1 root root 42 1月  16 02:56 multipathd.service -> /usr/lib/systemd/system/multipathd.service
[root@lunar1 ~]# 

缺省目标:

[root@lunar1 ~]# ll /etc/systemd/system/default.target.wants
总用量 0
lrwxrwxrwx. 1 root root 57 1月  16 02:52 systemd-readahead-collect.service -> /usr/lib/systemd/system/systemd-readahead-collect.service
lrwxrwxrwx. 1 root root 56 1月  16 02:52 systemd-readahead-replay.service -> /usr/lib/systemd/system/systemd-readahead-replay.service
[root@lunar1 ~]# 

多用户字符界面的目标(runlevel 3):

[root@lunar1 ~]# ll /etc/systemd/system/multi-user.target.wants/
总用量 0
lrwxrwxrwx. 1 root root 41 1月  16 02:54 abrt-ccpp.service -> /usr/lib/systemd/system/abrt-ccpp.service
lrwxrwxrwx. 1 root root 37 1月  16 02:53 abrtd.service -> /usr/lib/systemd/system/abrtd.service
lrwxrwxrwx. 1 root root 41 1月  16 02:53 abrt-oops.service -> /usr/lib/systemd/system/abrt-oops.service
lrwxrwxrwx. 1 root root 43 1月  16 02:54 abrt-vmcore.service -> /usr/lib/systemd/system/abrt-vmcore.service
lrwxrwxrwx. 1 root root 41 1月  16 02:53 abrt-xorg.service -> /usr/lib/systemd/system/abrt-xorg.service
lrwxrwxrwx. 1 root root 35 1月  16 03:01 atd.service -> /usr/lib/systemd/system/atd.service
lrwxrwxrwx. 1 root root 39 1月  16 02:56 chronyd.service -> /usr/lib/systemd/system/chronyd.service
lrwxrwxrwx. 1 root root 37 1月  16 02:53 crond.service -> /usr/lib/systemd/system/crond.service
lrwxrwxrwx. 1 root root 42 1月  16 02:55 hypervkvpd.service -> /usr/lib/systemd/system/hypervkvpd.service
lrwxrwxrwx. 1 root root 42 1月  16 02:55 hypervvssd.service -> /usr/lib/systemd/system/hypervvssd.service
lrwxrwxrwx. 1 root root 42 1月  16 03:01 irqbalance.service -> /usr/lib/systemd/system/irqbalance.service
lrwxrwxrwx. 1 root root 37 1月  16 02:54 kdump.service -> /usr/lib/systemd/system/kdump.service
lrwxrwxrwx. 1 root root 35 1月  16 02:56 ksm.service -> /usr/lib/systemd/system/ksm.service
lrwxrwxrwx. 1 root root 40 1月  16 02:56 ksmtuned.service -> /usr/lib/systemd/system/ksmtuned.service
lrwxrwxrwx. 1 root root 46 1月  16 02:54 libstoragemgmt.service -> /usr/lib/systemd/system/libstoragemgmt.service
lrwxrwxrwx. 1 root root 40 1月  16 02:54 libvirtd.service -> /usr/lib/systemd/system/libvirtd.service
lrwxrwxrwx. 1 root root 41 1月  16 02:53 mdmonitor.service -> /usr/lib/systemd/system/mdmonitor.service
lrwxrwxrwx. 1 root root 44 1月  16 03:02 ModemManager.service -> /usr/lib/systemd/system/ModemManager.service
lrwxrwxrwx. 1 root root 46 1月  16 02:55 NetworkManager.service -> /usr/lib/systemd/system/NetworkManager.service
lrwxrwxrwx. 1 root root 41 1月  16 02:56 nfs-client.target -> /usr/lib/systemd/system/nfs-client.target
lrwxrwxrwx. 1 root root 39 1月  16 02:55 postfix.service -> /usr/lib/systemd/system/postfix.service
lrwxrwxrwx. 1 root root 40 1月  16 02:52 remote-fs.target -> /usr/lib/systemd/system/remote-fs.target
lrwxrwxrwx. 1 root root 36 1月  16 03:01 rngd.service -> /usr/lib/systemd/system/rngd.service
lrwxrwxrwx. 1 root root 39 1月  16 02:56 rsyslog.service -> /usr/lib/systemd/system/rsyslog.service
lrwxrwxrwx. 1 root root 36 1月  16 03:01 sshd.service -> /usr/lib/systemd/system/sshd.service
lrwxrwxrwx. 1 root root 39 1月  16 02:54 sysstat.service -> /usr/lib/systemd/system/sysstat.service
lrwxrwxrwx. 1 root root 40 1月  16 02:53 vmtoolsd.service -> /usr/lib/systemd/system/vmtoolsd.service
[root@lunar1 ~]# 

而/usr/lib/systemd/system下面定义的unit就太多了:

[root@lunar1 ~]# ls -lrt /usr/lib/systemd/system/|wc -l
404
[root@lunar1 ~]# ls -lrt /usr/lib/systemd/system|grep -v grep|grep graphical
-rw-r--r--. 1 root root     469 3月   3 2014 firstboot-graphical.service
-rw-r--r--. 1 root root     558 11月 20 12:49 graphical.target
lrwxrwxrwx. 1 root root      16 1月  16 02:52 default.target -> graphical.target
drwxr-xr-x. 2 root root      49 1月  16 02:52 graphical.target.wants
lrwxrwxrwx. 1 root root      16 1月  16 02:52 runlevel5.target -> graphical.target
[root@lunar1 ~]# ls -lrt /usr/lib/systemd/system|grep -v grep|grep multi
-rw-r--r--. 1 root root     492 11月 20 12:49 multi-user.target
-rw-r--r--. 1 root root     597 11月 20 23:34 multipathd.service
lrwxrwxrwx. 1 root root      17 1月  16 02:52 runlevel2.target -> multi-user.target
lrwxrwxrwx. 1 root root      17 1月  16 02:52 runlevel3.target -> multi-user.target
lrwxrwxrwx. 1 root root      17 1月  16 02:52 runlevel4.target -> multi-user.target
drwxr-xr-x. 2 root root    4096 1月  16 02:53 multi-user.target.wants
[root@lunar1 ~]# ls -lrt /usr/lib/systemd/system|grep -v grep|grep runlevel
-rw-r--r--. 1 root root     761 11月 20 12:49 systemd-update-utmp-runlevel.service
lrwxrwxrwx. 1 root root      17 1月  16 02:52 runlevel2.target -> multi-user.target
drwxr-xr-x. 2 root root      49 1月  16 02:52 runlevel1.target.wants
lrwxrwxrwx. 1 root root      13 1月  16 02:52 runlevel1.target -> rescue.target
lrwxrwxrwx. 1 root root      15 1月  16 02:52 runlevel0.target -> poweroff.target
lrwxrwxrwx. 1 root root      17 1月  16 02:52 runlevel3.target -> multi-user.target
drwxr-xr-x. 2 root root      49 1月  16 02:52 runlevel2.target.wants
drwxr-xr-x. 2 root root      49 1月  16 02:52 runlevel4.target.wants
lrwxrwxrwx. 1 root root      17 1月  16 02:52 runlevel4.target -> multi-user.target
drwxr-xr-x. 2 root root      49 1月  16 02:52 runlevel3.target.wants
lrwxrwxrwx. 1 root root      13 1月  16 02:52 runlevel6.target -> reboot.target
drwxr-xr-x. 2 root root      49 1月  16 02:52 runlevel5.target.wants
lrwxrwxrwx. 1 root root      16 1月  16 02:52 runlevel5.target -> graphical.target
[root@lunar1 ~]# 
[root@lunar1 ~]# ls -lrt /usr/lib/systemd/system|grep -v grep|grep NetworkManager
-rw-r--r--. 1 root root     284 11月 21 00:55 NetworkManager-wait-online.service
-rw-r--r--. 1 root root     419 11月 21 00:55 NetworkManager.service
-rw-r--r--. 1 root root     353 11月 21 00:55 NetworkManager-dispatcher.service
[root@lunar1 ~]# ls -lrt /usr/lib/systemd/system|grep -v grep|grep network
-rw-r--r--. 1 root root     585 11月 20 12:49 systemd-networkd.socket
-rw-r--r--. 1 root root     480 11月 20 12:49 network.target
-rw-r--r--. 1 root root     461 11月 20 12:49 network-pre.target
-rw-r--r--. 1 root root     464 11月 20 12:49 network-online.target
lrwxrwxrwx. 1 root root      24 1月  16 02:52 dbus-org.freedesktop.network1.service -> systemd-networkd.service
drwxr-xr-x. 2 root root      47 1月  16 02:55 network-online.target.wants
[root@lunar1 ~]# ls -lrt /usr/lib/systemd/system|grep -v grep|grep rsyslog
-rw-r--r--. 1 root root     288 11月 20 19:34 rsyslog.service
[root@lunar1 ~]# ls -lrt /usr/lib/systemd/system|grep -v grep|grep udev
-rw-r--r--. 1 root root     751 11月 20 12:49 systemd-udev-trigger.service
-rw-r--r--. 1 root root     827 11月 20 12:49 systemd-udev-settle.service
-rw-r--r--. 1 root root     829 11月 20 12:49 systemd-udevd.service
-rw-r--r--. 1 root root     570 11月 20 12:49 systemd-udevd-kernel.socket
-rw-r--r--. 1 root root     578 11月 20 12:49 systemd-udevd-control.socket
-rw-r--r--. 1 root root     668 11月 20 12:49 initrd-udevadm-cleanup-db.service
lrwxrwxrwx. 1 root root      56 1月  16 02:52 dracut-pre-udev.service -> ../../dracut/modules.d/98systemd/dracut-pre-udev.service
[root@lunar1 ~]# 

从Linux7开始,不使用inittab作为启动配置文件,其内容仅仅是个说明:

[root@lunar1 ~]# cat /etc/inittab
# inittab is no longer used when using systemd.
#
# ADDING CONFIGURATION HERE WILL HAVE NO EFFECT ON YOUR SYSTEM.
#
# Ctrl-Alt-Delete is handled by /usr/lib/systemd/system/ctrl-alt-del.target
#
# systemd uses 'targets' instead of runlevels. By default, there are two main targets:
#
# multi-user.target: analogous to runlevel 3
# graphical.target: analogous to runlevel 5
#
# To view current default target, run:
# systemctl get-default
#
# To set a default target, run:
# systemctl set-default TARGET.target
#
[root@lunar1 ~]# 

从上面的说明不难看出,systemd不使用inittab作为配置文件,因此在这里添加的服务将不会生效
systemd使用’targets’代替了runlevels,我们常用的两个targets(启动到图形界面和启动到字符界面):

# multi-user.target: analogous to runlevel 3
# graphical.target: analogous to runlevel 5

其中,multi-user.target类似于以前的runlevel 3,也就是字符界面的多用户模式
graphical.target就是以前的runlevel 5,即图形界面模式。
可以使用systemctl get-default来查看缺省的target,也可以使用systemctl set-default来设置缺省的target。
.
查看当前正处在哪个target中:

[root@lunar1 ~]# systemctl list-units --type=target
UNIT                  LOAD   ACTIVE SUB    DESCRIPTION
basic.target          loaded active active Basic System
cryptsetup.target     loaded active active Encrypted Volumes
getty.target          loaded active active Login Prompts
local-fs-pre.target   loaded active active Local File Systems (Pre)
local-fs.target       loaded active active Local File Systems
multi-user.target     loaded active active Multi-User System
network-online.target loaded active active Network is Online
network.target        loaded active active Network
nfs-client.target     loaded active active NFS client services
paths.target          loaded active active Paths
remote-fs-pre.target  loaded active active Remote File Systems (Pre)
remote-fs.target      loaded active active Remote File Systems
slices.target         loaded active active Slices
sockets.target        loaded active active Sockets
swap.target           loaded active active Swap
sysinit.target        loaded active active System Initialization
timers.target         loaded active active Timers

LOAD   = Reflects whether the unit definition was properly loaded.
ACTIVE = The high-level unit activation state, i.e. generalization of SUB.
SUB    = The low-level unit activation state, values depend on unit type.

17 loaded units listed. Pass --all to see loaded but inactive units, too.
To show all installed unit files use 'systemctl list-unit-files'.
[root@lunar1 ~]# 

查看默认target:

[root@lunar1 ~]# systemctl get-default
multi-user.target
[root@lunar1 ~]# 

也就是当前运行在多用户字符集面的模式。
查看当前所有的运行级别的定义:

[root@lunar1 ~]# ll /usr/lib/systemd/system/runlevel*
lrwxrwxrwx. 1 root root 15 1月  16 02:52 /usr/lib/systemd/system/runlevel0.target -> poweroff.target
lrwxrwxrwx. 1 root root 13 1月  16 02:52 /usr/lib/systemd/system/runlevel1.target -> rescue.target
lrwxrwxrwx. 1 root root 17 1月  16 02:52 /usr/lib/systemd/system/runlevel2.target -> multi-user.target
lrwxrwxrwx. 1 root root 17 1月  16 02:52 /usr/lib/systemd/system/runlevel3.target -> multi-user.target
lrwxrwxrwx. 1 root root 17 1月  16 02:52 /usr/lib/systemd/system/runlevel4.target -> multi-user.target
lrwxrwxrwx. 1 root root 16 1月  16 02:52 /usr/lib/systemd/system/runlevel5.target -> graphical.target
lrwxrwxrwx. 1 root root 13 1月  16 02:52 /usr/lib/systemd/system/runlevel6.target -> reboot.target

/usr/lib/systemd/system/runlevel1.target.wants:
总用量 0
lrwxrwxrwx. 1 root root 39 1月  16 02:52 systemd-update-utmp-runlevel.service -> ../systemd-update-utmp-runlevel.service

/usr/lib/systemd/system/runlevel2.target.wants:
总用量 0
lrwxrwxrwx. 1 root root 39 1月  16 02:52 systemd-update-utmp-runlevel.service -> ../systemd-update-utmp-runlevel.service

/usr/lib/systemd/system/runlevel3.target.wants:
总用量 0
lrwxrwxrwx. 1 root root 39 1月  16 02:52 systemd-update-utmp-runlevel.service -> ../systemd-update-utmp-runlevel.service

/usr/lib/systemd/system/runlevel4.target.wants:
总用量 0
lrwxrwxrwx. 1 root root 39 1月  16 02:52 systemd-update-utmp-runlevel.service -> ../systemd-update-utmp-runlevel.service

/usr/lib/systemd/system/runlevel5.target.wants:
总用量 0
lrwxrwxrwx. 1 root root 39 1月  16 02:52 systemd-update-utmp-runlevel.service -> ../systemd-update-utmp-runlevel.service
[root@lunar1 ~]# 

这里我们看到了熟悉的 运行级别的身影:

runlevel0.target -> poweroff.target	---关机
runlevel1.target -> rescue.target	----营救模式
runlevel2.target -> multi-user.target	
runlevel3.target -> multi-user.target	----多用户的字符界面
runlevel4.target -> multi-user.target
runlevel5.target -> graphical.target	----图形界面
runlevel6.target -> reboot.target	----reboot主机

查看当前的正处在哪个target中:

[root@lunar system]# systemctl list-units --type=target
UNIT                 LOAD   ACTIVE SUB    DESCRIPTION
basic.target         loaded active active Basic System
cryptsetup.target    loaded active active Encrypted Volumes
getty.target         loaded active active Login Prompts
local-fs-pre.target  loaded active active Local File Systems (Pre)
local-fs.target      loaded active active Local File Systems
multi-user.target    loaded active active Multi-User System
network.target       loaded active active Network
paths.target         loaded active active Paths
remote-fs-pre.target loaded active active Remote File Systems (Pre)
remote-fs.target     loaded active active Remote File Systems
slices.target        loaded active active Slices
sockets.target       loaded active active Sockets
swap.target          loaded active active Swap
sysinit.target       loaded active active System Initialization
timers.target        loaded active active Timers

LOAD   = Reflects whether the unit definition was properly loaded.
ACTIVE = The high-level unit activation state, i.e. generalization of SUB.
SUB    = The low-level unit activation state, values depend on unit type.

15 loaded units listed. Pass --all to see loaded but inactive units, too.
To show all installed unit files use 'systemctl list-unit-files'.
[root@lunar system]# 
[root@lunar system]# systemctl list-units --type=target|grep graphical
[root@lunar system]# 

可以看到当前处在runlevel的运行界别类似于以前的level 3 ,即字符界面启动的
我们切换到图形界面启动的运行级别(类似于以前的runlevel 5):

[root@lunar system]# systemctl isolate graphical.target
[root@lunar system]# systemctl list-units --type=target
UNIT                 LOAD   ACTIVE SUB    DESCRIPTION
basic.target         loaded active active Basic System
cryptsetup.target    loaded active active Encrypted Volumes
getty.target         loaded active active Login Prompts
graphical.target     loaded active active Graphical Interface
local-fs-pre.target  loaded active active Local File Systems (Pre)
local-fs.target      loaded active active Local File Systems
multi-user.target    loaded active active Multi-User System
network.target       loaded active active Network
paths.target         loaded active active Paths
remote-fs-pre.target loaded active active Remote File Systems (Pre)
remote-fs.target     loaded active active Remote File Systems
slices.target        loaded active active Slices
sockets.target       loaded active active Sockets
swap.target          loaded active active Swap
sysinit.target       loaded active active System Initialization
timers.target        loaded active active Timers

LOAD   = Reflects whether the unit definition was properly loaded.
ACTIVE = The high-level unit activation state, i.e. generalization of SUB.
SUB    = The low-level unit activation state, values depend on unit type.

16 loaded units listed. Pass --all to see loaded but inactive units, too.
To show all installed unit files use 'systemctl list-unit-files'.
[root@lunar system]# 
[root@lunar system]# systemctl list-units --type=target|grep graphical
graphical.target     loaded active active Graphical Interface
[root@lunar system]# 

这时候我们可以看到关键字:graphical.target

查看当前缺省的运行级别:

[root@lunar system]# systemctl get-default
multi-user.target
[root@lunar system]# 

查看unit名为ohasd.serviced的依赖关系:

[root@lunar system]# systemctl list-dependencies ohasd.service
ohasd.service
├─system.slice
└─basic.target
  ├─alsa-restore.service
  ├─alsa-state.service
  ├─microcode.service
  ├─rhel-autorelabel-mark.service
  ├─rhel-autorelabel.service
  ├─rhel-configure.service
  ├─rhel-dmesg.service
  ├─rhel-loadmodules.service
  ├─paths.target
  ├─slices.target
  │ ├─-.slice
  │ └─system.slice
  ├─sockets.target
  │ ├─cups.socket
  │ ├─dbus.socket
  │ ├─dm-event.socket
  │ ├─iscsid.socket
  │ ├─iscsiuio.socket
  │ ├─rpcbind.socket
  │ ├─systemd-initctl.socket
  │ ├─systemd-journald.socket
  │ ├─systemd-shutdownd.socket
  │ ├─systemd-udevd-control.socket
  │ └─systemd-udevd-kernel.socket
  ├─sysinit.target
  │ ├─dev-hugepages.mount
  │ ├─dev-mqueue.mount
  │ ├─dmraid-activation.service
  │ ├─iscsi.service
  │ ├─kmod-static-nodes.service
  │ ├─lvm2-lvmetad.socket
  │ ├─lvm2-monitor.service
  │ ├─plymouth-read-write.service
  │ ├─plymouth-start.service
  │ ├─proc-sys-fs-binfmt_misc.automount
  │ ├─sys-fs-fuse-connections.mount
  │ ├─sys-kernel-config.mount
  │ ├─sys-kernel-debug.mount
  │ ├─systemd-ask-password-console.path
  │ ├─systemd-binfmt.service
  │ ├─systemd-journal-flush.service
  │ ├─systemd-journald.service
  │ ├─systemd-modules-load.service
  │ ├─systemd-random-seed.service
  │ ├─systemd-sysctl.service
  │ ├─systemd-tmpfiles-setup-dev.service
  │ ├─systemd-tmpfiles-setup.service
  │ ├─systemd-udev-trigger.service
  │ ├─systemd-udevd.service
  │ ├─systemd-update-utmp.service
  │ ├─systemd-vconsole-setup.service
  │ ├─cryptsetup.target
  │ ├─local-fs.target
  │ │ ├─-.mount
  │ │ ├─boot.mount
  │ │ ├─rhel-import-state.service
  │ │ ├─rhel-readonly.service
  │ │ └─systemd-remount-fs.service
  │ └─swap.target
  │   ├─dev-disk-by\x2did-dm\x2dname\x2dol\x2dswap.swap
  │   ├─dev-disk-by\x2did-dm\x2duuid\x2dLVM\x2dwmmUMFgSImFgksKwxBbGxaioeKcqTyRQ88RtxS76T3TS3XEM247vheZm8SQ77Xgw.swap
  │   ├─dev-disk-by\x2duuid-1a736d5d\x2de52a\x2d430c\x2dbe02\x2dff81252749db.swap
  │   ├─dev-dm\x2d1.swap
  │   ├─dev-mapper-ol\x2dswap.swap
  │   ├─dev-mapper-ol\x2dswap.swap
  │   └─dev-ol-swap.swap
  └─timers.target
    └─systemd-tmpfiles-clean.timer

[root@lunar system]# 

Linux7(CentOS,RHEL,OEL)和Oracle RAC环境系列–1-简介
Linux7(CentOS,RHEL,OEL)和Oracle RAC环境系列-2-修改主机名和hostnamectl工具的使用
Linux7(CentOS,RHEL,OEL)和Oracle RAC环境系列–3-systemd(d.bin和ohasd守护进程)
Linux7(CentOS,RHEL,OEL)和Oracle RAC环境系列–4-target(图形界面和字符界面)
Linux7(CentOS,RHEL,OEL)和Oracle RAC环境系列–5-防火墙
Linux7(CentOS,RHEL,OEL)和Oracle RAC环境系列–6-开机自动启动或者禁用服务
Linux7(CentOS,RHEL,OEL)和Oracle RAC环境系列-7-网络管理之添加网
Linux7(CentOS,RHEL,OEL)和Oracle RAC环境系列-7-网络管理之修改IP地址
Linux7(CentOS,RHEL,OEL)和Oracle RAC环境系列-7-网络管理之修改网络接口名
Linux7(CentOS,RHEL,OEL)和Oracle RAC环境系列-8-在Linux7上安装11.2 RAC和12.1 RAC需要禁用哪些服务
Linux7(CentOS,RHEL,OEL)和Oracle RAC环境系列-9-Linux 7.2上的virbr0设备
Linux7(CentOS,RHEL,OEL)和Oracle RAC环境系列-10-ABRT-系统启动后自动检查和报告错误
Linux7(CentOS,RHEL,OEL)和Oracle RAC环境系列-11-配置VNC和常见问题处理

发表在 Installation and Deinstall, Linux, ORACLE 12C, RAC | 标签为 , , , , , | 留下评论

Linux7(CentOS,RHEL,OEL)和Oracle RAC环境系列–3-systemd(d.bin和ohasd守护进程)

Linux的系统启动大致有3种主要模式:
(1)Linux5和以前的版本:SystemV style的runlevel式启动
(2)Linux6中:以upstart(例如,在ubuntu中)代表的event-based启动方式
(3)Linux7中:以systemd模式并行启动的模式
.
前面两种启动模式的大致都有如下过程:
1,内核引导(内核被载入内存并运行,初始化所有的设备驱动程序和数据结构等)
2,启动/sbin/init,它是一个由内核启动的用户级进程
3,由/sbin/init启动其他用户级的进程或服务(这些进程大多数是各种daemon进程,即各种服务进程),最终完成系统启动的全部过程
所以,init始终是第一个进程,其PID始终为1,它是系统所有进程的父进程.
.
第三种方式就是Linux7中采用的sytemd的方式,systemd不通过init脚本来启动,而是采用一种并行启动服务的机制(用缓存机制解决服务的依赖关系)。
这种方式的特点是与 sysvinit 完全兼容、更清晰的服务依赖关系、开机系统初始化服务并行启动、更少的shell开销。
systemd使用 socket 和 D-Bus 来开启服务,提供基于守护进程的按需启动策略
每个服务就是一个 unit,对应于运行级别,systemd有一个 target (multi-user.target)。
.
在Linux4和5中:

[root@lunar1 init.d]# ps -ef|grep init|grep -v grep
root         1     0  0 08:24 ?        00:00:00 init [3]                             
root      3549     1  0 08:28 ?        00:00:00 /bin/sh /etc/init.d/init.evmd run
root      3550     1  0 08:28 ?        00:00:01 /bin/sh /etc/init.d/init.cssd fatal
root      3731     1  0 08:28 ?        00:00:00 /bin/sh /etc/init.d/init.crsd run
root      4827  3550  0 08:28 ?        00:00:00 /bin/sh /etc/init.d/init.cssd oprocd
root      4853  3550  0 08:28 ?        00:00:00 /bin/sh /etc/init.d/init.cssd oclsomon
root      4877  3550  0 08:28 ?        00:00:00 /bin/sh /etc/init.d/init.cssd daemon
[root@lunar1 init.d]# 

在Linux6中:

[root@lunarnew1 grid]# ps -ef|grep init|grep -v grep
root         1     0  0 Jan14 ?        00:00:00 init [5]                                                                 
root      2987     1  0 Jan14 ?        00:00:00 /bin/sh /etc/init.d/init.ohasd run
[root@lunarnew1 grid]# 
[root@lunarnew1 grid]# which init
/sbin/init
[root@lunarnew1 grid]# 

在Linux7中已经不适用init进程启动了:

[root@lunar ~]# ps -ef|grep init|grep -v grep
root       734     1  0 04:26 ?        00:00:00 /usr/sbin/alsactl -s -n 19 -c -E ALSA_CONFIG_PATH=/etc/alsa/alsactl.conf --initfile=/lib/alsa/init/00main rdaemon
root      1132     1  0 04:26 ?        00:00:00 /bin/sh /etc/init.d/init.ohasd run >/dev/null 2>&1 </dev/null
grid      2107  1621  0 04:26 ?        00:00:00 /usr/bin/ssh-agent /etc/X11/xinit/Xclients
root      2108  1626  0 04:26 ?        00:00:00 /usr/bin/ssh-agent /etc/X11/xinit/Xclients
oracle    2109  1622  0 04:26 ?        00:00:00 /usr/bin/ssh-agent /etc/X11/xinit/Xclients
[root@lunar ~]# 

这里面的3个“/usr/bin/ssh-agent /etc/X11”进程是Linux7中配置了自动启动VNC。
.
这3种模式的不同在于:
1,SystemV style的runlevel式启动
在Linux5和以前的版本,init进程会读取/etc/inittab的内容,/etc/inittab中包含了很多启动其他用户进程和服务的指令。
因此,/etc/inittab的内容就决定系统进入哪一个runlevel,然后去/etc/rcN.d/(N代表runlevel的数字表示)去找相应的启动脚本。
即: /sbin/init => /etc/inittab => runlevel rc script [/etc/rcN.d]
这么设计的原因是服务之间有依赖关系,先启动哪些需要设置好,否则会造成所依赖的服务没启动导致的服务本身不能启动的问题。
不难看出,这是一种脚本式的串行的启动方式,因此启动效率很低。
例如:

[root@lunar1 init.d]# cat /etc/inittab
#
# inittab       This file describes how the INIT process should set up
#               the system in a certain run-level.
#
# Author:       Miquel van Smoorenburg, <miquels@drinkel.nl.mugnet.org>
#               Modified for RHS Linux by Marc Ewing and Donnie Barnes
#

# Default runlevel. The runlevels used by RHS are:
#   0 - halt (Do NOT set initdefault to this)
#   1 - Single user mode
#   2 - Multiuser, without NFS (The same as 3, if you do not have networking)
#   3 - Full multiuser mode
#   4 - unused
#   5 - X11
#   6 - reboot (Do NOT set initdefault to this)
# 
id:3:initdefault:

# System initialization.
si::sysinit:/etc/rc.d/rc.sysinit

l0:0:wait:/etc/rc.d/rc 0
l1:1:wait:/etc/rc.d/rc 1
l2:2:wait:/etc/rc.d/rc 2
l3:3:wait:/etc/rc.d/rc 3
l4:4:wait:/etc/rc.d/rc 4
l5:5:wait:/etc/rc.d/rc 5
l6:6:wait:/etc/rc.d/rc 6
。。。。。。。。。(省略部分)
# Run xdm in runlevel 5
x:5:respawn:/etc/X11/prefdm -nodaemon
h1:35:respawn:/etc/init.d/init.evmd run >/dev/null 2>&1 </dev/null
h2:35:respawn:/etc/init.d/init.cssd fatal >/dev/null 2>&1 </dev/null
h3:35:respawn:/etc/init.d/init.crsd run >/dev/null 2>&1 </dev/null
[root@lunar1 init.d]# 

这里看到,最上面的注释就解释了所有的运行界别(runlevel),比如我们常用的3是字符多用户界面,5是图形界面,0是关机,6是重启,1是单用户(我们有时候也成为救援模式)等等
然后接下来就执行rc.sysinit,然后一次执行/etc/rc.d/rc 0~/etc/rc.d/rc 6:
也就是去相应的/etc/rc.d//etc/rc[N].d/目录中运行相应的脚本:
Linux4,5和6中,由于都是通过init来引导的,因此/etc/rc.d/目录内容基本也都一样。
(Linux6和以前的版本,主要是inittab的内容和具体启动配置脚本不同)

[root@lunar1 init.d]# ll /etc/rc.d/
total 108
drwxr-xr-x  2 root root  4096 Oct 24 20:25 init.d
-rwxr-xr-x  1 root root  2352 Mar 17  2004 rc
drwxr-xr-x  2 root root  4096 Oct 26 07:47 rc0.d
drwxr-xr-x  2 root root  4096 Oct 26 07:47 rc1.d
drwxr-xr-x  2 root root  4096 Oct 26 07:47 rc2.d
drwxr-xr-x  2 root root  4096 Oct 26 07:47 rc3.d
drwxr-xr-x  2 root root  4096 Oct 26 07:47 rc4.d
drwxr-xr-x  2 root root  4096 Oct 26 07:47 rc5.d
drwxr-xr-x  2 root root  4096 Oct 26 07:47 rc6.d
-rwxr-xr-x  1 root root   341 Apr 21  2007 rc.local
-rwxr-xr-x  1 root root 27799 Dec 16  2005 rc.sysinit
[root@lunar1 init.d]# 

.
2,event-based启动方式
随着各种新技术和新硬件的发展,这种启动方式已经不能满足要求了,比如 越来越多的各种热插拔设备的出现等,系统启动时间太长等问题。
因此,从Linux6开始就出现了采用一种event-based的init启动方式,这种启动方式致力于改进两个方面的东西:
(1) 更多的开机启动程序是并行启动的(即改进以前的依赖大量shell脚本的串行启动方式,例如 SysV init);
(2)开机自动启动的程序尽量少,尽快进入工作模式
(3)自动处理开机启动服务间的各种依赖关系
在Linux6中,init进程也会读取/etc/inittab,但是该脚本内容缺省只有1行,即启动到字符集面还是图形界面:

[root@lunarlib rootwork]# ll /etc/inittab*
-rw-r-----. 1 root root 884 Apr  6  2015 /etc/inittab
[root@lunarlib rootwork]# 
[root@lunarlib rootwork]# tail /etc/inittab
# Default runlevel. The runlevels used are:
#   0 - halt (Do NOT set initdefault to this)
#   1 - Single user mode
#   2 - Multiuser, without NFS (The same as 3, if you do not have networking)
#   3 - Full multiuser mode
#   4 - unused
#   5 - X11
#   6 - reboot (Do NOT set initdefault to this)
# 
id:3:initdefault:
[root@lunarlib rootwork]# 

正如这里看到的,Linux6的init只负责读取配置文件,处理各种服务和应用程序的依赖关系,根据事件来启动这些功能和服务,并动态的进行管理。
而事件在Linux6中是由“事件管理器”来管理,并使用initctl工具来控制,initctl的作用类似于Linux5中的chkconfig工具:

[root@lunarlib rootwork]# /sbin/initctl list |grep oracle-ohasd
oracle-ohasd start/running, process 2897
[root@lunarlib rootwork]# 
[root@lunarlib rootwork]# ps -ef|grep ohasd
root      2897     1  0 06:05 ?        00:00:01 /bin/sh /etc/init.d/init.ohasd run
root      6651  6336  0 07:52 pts/0    00:00:00 grep ohasd
[root@lunarlib rootwork]# 

init进程读取的配置文件为/etc/init目录下的内容:
(注意:/etc/init仅仅在Linux6中有,可以称之为Liunx独有的特点了)

[root@lunarlib rootwork]# ll /etc/init
total 72
-rw-r--r--. 1 root root  412 Jul 22  2014 control-alt-delete.conf
-rw-r--r--. 1 root root  130 Mar 12  2014 init-system-dbus.conf
-rw-r--r--. 1 root root  463 Jul 22  2014 kexec-disable.conf
-rw-r--r--  1 root root  220 Oct 11 01:30 oracle-ohasd.conf
-rw-r--r--. 1 root root  560 Jul 22  2014 plymouth-shutdown.conf
-rw-r--r--. 1 root root  357 Jul 22  2014 prefdm.conf
-rw-r--r--. 1 root root  505 Jul 22  2014 quit-plymouth.conf
-rw-r--r--. 1 root root  417 Jul 22  2014 rc.conf
-rw-r--r--. 1 root root 1046 Jul 22  2014 rcS.conf
-rw-r--r--. 1 root root  430 Jul 22  2014 rcS-emergency.conf
-rw-r--r--. 1 root root  725 Jul 22  2014 rcS-sulogin.conf
-rw-r--r--. 1 root root 2915 Nov 21  2013 readahead-collector.conf
-rw-r--r--. 1 root root 1559 Nov 21  2013 readahead.conf
-rw-r--r--. 1 root root  726 Nov 21  2013 readahead-disable-services.conf
-rw-r--r--. 1 root root 1302 Jul 22  2014 serial.conf
-rw-r--r--. 1 root root  791 Jul 22  2014 splash-manager.conf
-rw-r--r--. 1 root root  473 Jul 22  2014 start-ttys.conf
-rw-r--r--. 1 root root  335 Jul 22  2014 tty.conf
[root@lunarlib rootwork]# 

因此,在Linux6上安装11.2 GI时,oracle会为/etc/init.d/init.ohasd引导进程配置一个相应的配置文件,也就是/etc/init/oracle-ohasd.conf
这个就是Oracle顺应Linux的发展,根据系统启动时的引导和启动服务的机制在Linux中不同版本的变化而变化
因此,/etc/init.d/init.ohasd在Linux6中使用/etc/init/oracle-ohasd.conf配置文件启动取代了Linux5中的配置使用/etc/inittab启动的方式。
.
3,systemd模式并行启动的模式
使用 socket 和 D-Bus 来开启服务,提供基于守护进程的按需启动策略。
服务配置文件放在 /lib/systemd/system/ 目录下,以 *.service命名。没有运行级别的概念,但是完全兼容sysvinit。
Linux7中,因为启动机制不同,因此/etc/rc.d/目录缺少了rc,rc.sysinit和rc.local文件:

[root@lunar ~]# ll /etc/rc.d/
total 8
drwxr-xr-x. 2 root root 4096 Oct  9 12:29 init.d
drwxr-xr-x. 2 root root   73 Oct  9 12:29 rc0.d
drwxr-xr-x. 2 root root   73 Oct  9 12:29 rc1.d
drwxr-xr-x. 2 root root   73 Oct  9 12:29 rc2.d
drwxr-xr-x. 2 root root   73 Oct  9 12:29 rc3.d
drwxr-xr-x. 2 root root   73 Oct  9 12:29 rc4.d
drwxr-xr-x. 2 root root   73 Oct  9 12:29 rc5.d
drwxr-xr-x. 2 root root   73 Oct  9 12:29 rc6.d
-rw-r--r--. 1 root root  473 Mar  7  2015 rc.local
[root@lunar ~]# 

不过具体的启动脚本都还在,比如,在10.2中,CRS开机自动启动的脚本:

[root@lunar1 init.d]# ll /etc/rc.d/rc*.d/*crs*
lrwxrwxrwx  1 root root 20 Oct 26 07:47 /etc/rc.d/rc0.d/K19init.crs -> /etc/init.d/init.crs
lrwxrwxrwx  1 root root 20 Oct 26 07:47 /etc/rc.d/rc1.d/K19init.crs -> /etc/init.d/init.crs
lrwxrwxrwx  1 root root 20 Oct 26 07:47 /etc/rc.d/rc2.d/K19init.crs -> /etc/init.d/init.crs
lrwxrwxrwx  1 root root 20 Oct 26 07:47 /etc/rc.d/rc3.d/S96init.crs -> /etc/init.d/init.crs
lrwxrwxrwx  1 root root 20 Oct 26 07:47 /etc/rc.d/rc4.d/K19init.crs -> /etc/init.d/init.crs
lrwxrwxrwx  1 root root 20 Oct 26 07:47 /etc/rc.d/rc5.d/S96init.crs -> /etc/init.d/init.crs
lrwxrwxrwx  1 root root 20 Oct 26 07:47 /etc/rc.d/rc6.d/K19init.crs -> /etc/init.d/init.crs
[root@lunar1 init.d]# 

在11.2和12.1中,CRS开机自动启动的脚本(Linux6和Linux7中都显示类似如下):

[root@lunarlib crsconfig]# ll /etc/rc.d/rc*.d/*ohasd
lrwxrwxrwx 1 root root 17 Jan 11 17:11 /etc/rc.d/rc0.d/K15ohasd -> /etc/init.d/ohasd
lrwxrwxrwx 1 root root 17 Jan 11 17:11 /etc/rc.d/rc1.d/K15ohasd -> /etc/init.d/ohasd
lrwxrwxrwx 1 root root 17 Jan 11 17:11 /etc/rc.d/rc2.d/K15ohasd -> /etc/init.d/ohasd
lrwxrwxrwx 1 root root 17 Jan 11 17:11 /etc/rc.d/rc3.d/S96ohasd -> /etc/init.d/ohasd
lrwxrwxrwx 1 root root 17 Jan 11 17:11 /etc/rc.d/rc4.d/K15ohasd -> /etc/init.d/ohasd
lrwxrwxrwx 1 root root 17 Jan 11 17:11 /etc/rc.d/rc5.d/S96ohasd -> /etc/init.d/ohasd
lrwxrwxrwx 1 root root 17 Jan 11 17:11 /etc/rc.d/rc6.d/K15ohasd -> /etc/init.d/ohasd
[root@lunarlib crsconfig]# 

在Linux7中,系统启动加载的单元配置如下:

[root@lunar system]# ll /etc/systemd/system/|grep ohasd
-rw-r--r--  1 root root  361 Oct  9 12:29 oracle-ohasd.service
[root@lunar system]# 
[root@lunar system]# ll /etc/systemd/system/
total 16
drwxr-xr-x. 2 root root   30 Oct  8 07:17 basic.target.wants
drwxr-xr-x. 2 root root   30 Oct  7 23:08 bluetooth.target.wants
lrwxrwxrwx. 1 root root   41 Oct  7 23:08 dbus-org.bluez.service -> /usr/lib/systemd/system/bluetooth.service
lrwxrwxrwx. 1 root root   44 Oct  7 23:10 dbus-org.freedesktop.ModemManager1.service -> /usr/lib/systemd/system/ModemManager.service
lrwxrwxrwx. 1 root root   46 Oct  7 23:04 dbus-org.freedesktop.NetworkManager.service -> /usr/lib/systemd/system/NetworkManager.service
lrwxrwxrwx. 1 root root   57 Oct  7 23:04 dbus-org.freedesktop.nm-dispatcher.service -> /usr/lib/systemd/system/NetworkManager-dispatcher.service
lrwxrwxrwx  1 root root   41 Oct  8 16:51 default.target -> /usr/lib/systemd/system/multi-user.target
drwxr-xr-x. 2 root root   85 Oct  7 23:02 default.target.wants
lrwxrwxrwx. 1 root root   35 Oct  7 23:08 display-manager.service -> /usr/lib/systemd/system/gdm.service
drwxr-xr-x. 2 root root   31 Oct  7 23:02 getty.target.wants
drwxr-xr-x. 2 root root   90 Oct  9 12:29 graphical.target.wants
drwxr-xr-x. 2 root root 4096 Oct  9 12:29 multi-user.target.wants
lrwxrwxrwx. 1 root root   38 Oct  7 23:04 mysql.service -> /usr/lib/systemd/system/mysqld.service
-rw-r--r--  1 root root  361 Oct  9 12:29 oracle-ohasd.service
drwxr-xr-x. 2 root root   25 Oct  7 23:05 printer.target.wants
drwxr-xr-x. 2 root root 4096 Oct  8 07:32 sockets.target.wants
drwxr-xr-x. 2 root root   35 Oct  7 23:10 spice-vdagentd.target.wants
drwxr-xr-x. 2 root root 4096 Oct  8 22:19 sysinit.target.wants
drwxr-xr-x. 2 root root   83 Oct  7 23:05 system-update.target.wants
[root@lunar system]# 

查看当前加载的单元:

root@lunar system]# systemctl list-units -t service|grep ohasd
ohasd.service                      loaded active exited  ohasd.service
oracle-ohasd.service               loaded active running Oracle High Availability Services
[root@lunar system]# 

具体看下服务定义文件的格式:

[root@lunar system]# cat /etc/systemd/system/oracle-ohasd.service
# Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
#
# Oracle OHASD startup

[Unit]
Description=Oracle High Availability Services
After=syslog.target network.target remote-fs.target

[Service]
ExecStart=/etc/init.d/init.ohasd run >/dev/null 2>&1 </dev/null
Type=simple
Restart=always

[Install]
WantedBy=multi-user.target graphical.target
[root@lunar system]# 

systemd的单元定义中,如果指定了“After=”,那么就表示这个服务依赖于After指定的服务。如果没有After,就表示这个服务可以跟其他的并行启动。
这里定义了oracle-ohasd.service在syslog.target network.target remote-fs.target这三个单元启动后开始启动
执行命令为:/etc/init.d/init.ohasd run >/dev/null 2>&1 [root@lunar system]# man systemd.service 。。。。。。。。 Type= Configures the process start-up type for this service unit. One of simple, forking, oneshot, dbus, notify or idle. If set to simple (the default value if neither Type= nor BusName= are specified), it is expected that the process configured with ExecStart= is the main process of the service. In this mode, if the process offers functionality to other processes on the system, its communication channels should be installed before the daemon is started up (e.g. sockets set up by systemd, via socket activation), as systemd will immediately proceed starting follow-up units. 。。。。。。。。 [root@lunar system]#

没看太明白,大概意思是采用socket方式启动(非fork进程的方式),并且立即启动。
查看一下该进程:

[root@lunar system]# ps -ef|grep ohasd
root      1132     1  0 04:26 ?        00:00:00 /bin/sh /etc/init.d/init.ohasd run >/dev/null 2>&1 </dev/null
grid      4017     1  0 04:27 ?        00:00:59 /u01/app/12.1.0.2/grid/bin/ohasd.bin reboot
root     11362  8874  0 09:50 pts/1    00:00:00 grep --color=auto ohasd
[root@lunar system]# 

Linux7(CentOS,RHEL,OEL)和Oracle RAC环境系列–1-简介
Linux7(CentOS,RHEL,OEL)和Oracle RAC环境系列-2-修改主机名和hostnamectl工具的使用
Linux7(CentOS,RHEL,OEL)和Oracle RAC环境系列–3-systemd(d.bin和ohasd守护进程)
Linux7(CentOS,RHEL,OEL)和Oracle RAC环境系列–4-target(图形界面和字符界面)
Linux7(CentOS,RHEL,OEL)和Oracle RAC环境系列–5-防火墙
Linux7(CentOS,RHEL,OEL)和Oracle RAC环境系列–6-开机自动启动或者禁用服务
Linux7(CentOS,RHEL,OEL)和Oracle RAC环境系列-7-网络管理之添加网
Linux7(CentOS,RHEL,OEL)和Oracle RAC环境系列-7-网络管理之修改IP地址
Linux7(CentOS,RHEL,OEL)和Oracle RAC环境系列-7-网络管理之修改网络接口名
Linux7(CentOS,RHEL,OEL)和Oracle RAC环境系列-8-在Linux7上安装11.2 RAC和12.1 RAC需要禁用哪些服务
Linux7(CentOS,RHEL,OEL)和Oracle RAC环境系列-9-Linux 7.2上的virbr0设备
Linux7(CentOS,RHEL,OEL)和Oracle RAC环境系列-10-ABRT-系统启动后自动检查和报告错误
Linux7(CentOS,RHEL,OEL)和Oracle RAC环境系列-11-配置VNC和常见问题处理

发表在 Installation and Deinstall, Linux, ORACLE 12C, RAC | 标签为 , , , , , | 留下评论

Linux7(CentOS,RHEL,OEL)和Oracle RAC环境系列-2-修改主机名和hostnamectl工具的使用

测试目的:
熟悉Linux7中修改主机名的机制和hostnamectl工具的使用

测试环境:CentOS Linux release 7.2.1511 (Core)

[root@lunar bin]# uname -a
Linux lunar.oracle.com 3.10.0-327.el7.x86_64 #1 SMP Thu Nov 19 22:10:57 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
[root@lunar bin]# ll /etc/*releas*
-rw-r--r--. 1 root root  38 Dec  9 17:59 /etc/centos-release
-rw-r--r--. 1 root root  51 Dec  9 17:59 /etc/centos-release-upstream
-rw-r--r--. 1 root root 393 Dec  9 17:59 /etc/os-release
lrwxrwxrwx. 1 root root  14 Jan 16 02:48 /etc/redhat-release -> centos-release
lrwxrwxrwx. 1 root root  14 Jan 16 02:48 /etc/system-release -> centos-release
-rw-r--r--. 1 root root  23 Dec  9 17:59 /etc/system-release-cpe
[root@lunar bin]# cat /etc/centos-release
CentOS Linux release 7.2.1511 (Core) 
[root@lunar bin]# 

主机名的配置,在Linux7以下的版本主机名一般是看:
1,配置文件/etc/sysconfig/network
2,命令hosntame
但在Linux7中(这里是CentOS 7.2)中,很多系统管理工具都被替换了,包括主机名的配置。
.
Linux7中采用新的配置文件/etc/hostname,替代了Linux7以前(Linux2~Linux6)中使用的/etc/sysconfig/network文件
不过,/etc/sysconfig/network文件还在,只是其内容只剩下一行标注为Linux安装管理程序的“# Created by anaconda”:

[root@localhost ~]# ll /etc/sysconfig/network
-rw-r--r--. 1 root root 22 1月  16 03:08 /etc/sysconfig/network
[root@localhost ~]# cat /etc/sysconfig/network
# Created by anaconda
[root@localhost ~]# 

这里看到的Anaconda是RedHat、CentOS、Fedora等Linux的安装管理程序的名字,其大部分模块用Python编写,有少许的载入模块用C编写。
.
从Linux7开始使用/etc/hostname来管理主机名的配置信息:

[root@localhost ~]# ll /etc/hostname
-rw-r--r--. 1 root root 22 1月  16 03:08 /etc/hostname
[root@localhost ~]# cat /etc/hostname
localhost.localdomain
[root@localhost ~]# 

在Linux中,有三种定义的主机名:
静态的(static),“静态”主机名也称为内核主机名,是系统在启动时从/etc/hostname自动初始化的主机名。
瞬态的(transient),“瞬态”主机名是在系统运行时临时分配的主机名,例如,通过DHCP或mDNS服务器分配。
灵活的(pretty)。“灵活”主机名则允许使用自由形式(包括特殊/空白字符)的主机名,以展示给终端用户(如Dan’s Computer)。
静态主机名和瞬态主机名都遵从作为互联网域名同样的字符限制规则。
.
只查看静态、瞬态或灵活主机名,分别使用“–static”,“–transient”或“–pretty”选项。
例如:

[root@localhost ~]# hostnamectl status --static
localhost.localdomain
[root@localhost ~]# hostnamectl status --transient
localhost.localdomain
[root@localhost ~]# hostnamectl status --pretty

但是在Linux7中,有个叫hostnamectl的命令行工具,它允许你查看或修改与主机名相关的配置。

[root@localhost ~]# cat /etc/hostname
localhost.localdomain
[root@localhost ~]# hostnamectl			
   Static hostname: localhost.localdomain	--------缺省只有静态主机名:localhost.localdomain
         Icon name: computer-vm
           Chassis: vm
        Machine ID: 11f3b15bbc73453287d186e6aa5dda16
           Boot ID: 09514e0b4f1c458eacea8790d4e3412a
    Virtualization: kvm
  Operating System: CentOS Linux 7 (Core)
       CPE OS Name: cpe:/o:centos:centos:7
            Kernel: Linux 3.10.0-327.el7.x86_64
      Architecture: x86-64
[root@localhost ~]# 

我们看一下hostnamectl的帮助信息:

[root@localhost ~]# hostnamectl --help
hostnamectl [OPTIONS...] COMMAND ...

Query or change system hostname.

  -h --help              Show this help
     --version           Show package version
     --no-ask-password   Do not prompt for password
  -H --host=[USER@]HOST  Operate on remote host
  -M --machine=CONTAINER Operate on local container
     --transient         Only set transient hostname
     --static            Only set static hostname
     --pretty            Only set pretty hostname

Commands:
  status                 Show current hostname settings
  set-hostname NAME      Set system hostname
  set-icon-name NAME     Set icon name for host
  set-chassis NAME       Set chassis type for host
  set-deployment NAME    Set deployment environment for host
  set-location NAME      Set location for host
[root@localhost ~]# 

修改配置文件/etc/hostname,注释掉缺省的第一行,添加我们以前习惯的不带域名的主机名lunar:

[root@localhost ~]# cat /etc/hostname 
#localhost.localdomain
lunar1
[root@localhost ~]# 

[root@localhost ~]#
再次查看:

[root@localhost ~]# hostnamectl status
   Static hostname: #localhost.localdomain	-------Static hostname以前的“localhost.localdomain”变成注释的,也就是/etc/hostname中被注释的一行
Transient hostname: #localhost.localdomain	-------Transient hostname以前没有,这里出现了/etc/hostname中的两行内容
lunar1
         Icon name: computer-vm
           Chassis: vm
        Machine ID: 11f3b15bbc73453287d186e6aa5dda16
           Boot ID: 09514e0b4f1c458eacea8790d4e3412a
    Virtualization: kvm
  Operating System: CentOS Linux 7 (Core)
       CPE OS Name: cpe:/o:centos:centos:7
            Kernel: Linux 3.10.0-327.el7.x86_64
      Architecture: x86-64
[root@localhost ~]#

修改完配置文件/etc/hostname后,这里看到我们修改后的信息:
Static hostname以前的“localhost.localdomain”变成注释的,也就是/etc/hostname中被注释的一行
Transient hostname以前没有,这里出现了/etc/hostname中的两行内容
.
当我们把/etc/hostname中的内容都注释掉后,再次检查发现:

[root@localhost ~]# cat /etc/hostname
#localhost.localdomain
[root@localhost ~]#
[root@localhost ~]# hostnamectl status
   Static hostname: #localhost.localdomain	-------Static hostname的信息没有变化,仍然是/etc/hostname中被注释的一行
         Icon name: computer-vm			-------而Transient hostname的信息没有了
           Chassis: vm
        Machine ID: 11f3b15bbc73453287d186e6aa5dda16
           Boot ID: 09514e0b4f1c458eacea8790d4e3412a
    Virtualization: kvm
  Operating System: CentOS Linux 7 (Core)
       CPE OS Name: cpe:/o:centos:centos:7
            Kernel: Linux 3.10.0-327.el7.x86_64
      Architecture: x86-64
[root@localhost ~]# 

而我们输入Linux7以前常用的命令hostname,发现hostname命令的作用相当于读取/etc/hostname:

[root@lunar1 ~]# hostname
#localhost.localdomain
lunar1
[root@lunar1 ~]# 

这里我们看到hostname的作用类似于cat /etc/hostname
再次查看:

[root@lunar1 ~]# hostnamectl status --static
#localhost.localdomain
[root@lunar1 ~]# hostnamectl status --transient
#localhost.localdomain
lunar1
[root@lunar1 ~]# hostnamectl status --pretty

[root@lunar1 ~]# 

可见,hostname命令还可以使用,但是起作用是读取/etc/hostname的内容和设置瞬态的hostname:

[root@lunar1 ~]# hostname lunar2	-
[root@lunar1 ~]# hostname
lunar2
[root@lunar1 ~]# 

此时并没有改变/etc/hostname的内容

[root@lunar1 ~]# cat /etc/hostname
#localhost.localdomain
lunar1
[root@lunar1 ~]# hostnamectl status
   Static hostname: #localhost.localdomain	---------Static hostname仍然显示为/etc/hostname中的第一行内容
Transient hostname: lunar2			----------Transient hostname已经显示为我们设置的lunar2
         Icon name: computer-vm
           Chassis: vm
        Machine ID: 11f3b15bbc73453287d186e6aa5dda16
           Boot ID: 09514e0b4f1c458eacea8790d4e3412a
    Virtualization: kvm
  Operating System: CentOS Linux 7 (Core)
       CPE OS Name: cpe:/o:centos:centos:7
            Kernel: Linux 3.10.0-327.el7.x86_64
      Architecture: x86-64
[root@lunar1 ~]# 

修改/etc/hostname的内容,再次查看:

[root@lunar2 ~]# cat /etc/hostname
lunar1
[root@lunar2 ~]# 
[root@lunar2 ~]# hostnamectl status
   Static hostname: lunar1		---------------Static hostname应该变为/etc/hostname中的设置
         Icon name: computer-vm		
           Chassis: vm
        Machine ID: 11f3b15bbc73453287d186e6aa5dda16
           Boot ID: 09514e0b4f1c458eacea8790d4e3412a
    Virtualization: kvm
  Operating System: CentOS Linux 7 (Core)
       CPE OS Name: cpe:/o:centos:centos:7
            Kernel: Linux 3.10.0-327.el7.x86_64
      Architecture: x86-64
[root@lunar2 ~]# 
[root@lunar2 ~]# hostname
lunar1
[root@lunar2 ~]# 
[root@lunar2 ~]# hostnamectl status --static
lunar1
[root@lunar2 ~]# hostnamectl status --transient
lunar1
[root@lunar2 ~]# hostnamectl status --pretty

[root@lunar2 ~]# 

同时修改所有三个主机名:静态、瞬态和灵活主机名:

[root@lunar1 ~]# hostnamectl set-hostname lunar2
[root@lunar1 ~]# hostnamectl status --static
lunar2
[root@lunar1 ~]# hostnamectl status --transient
lunar2
[root@lunar1 ~]# hostnamectl status --pretty

[root@lunar1 ~]# hostname
lunar2
[root@lunar1 ~]# cat /etc/hostname
lunar2
[root@lunar1 ~]# hostnamectl status
   Static hostname: lunar2
         Icon name: computer-vm
           Chassis: vm
        Machine ID: 11f3b15bbc73453287d186e6aa5dda16
           Boot ID: 09514e0b4f1c458eacea8790d4e3412a
    Virtualization: kvm
  Operating System: CentOS Linux 7 (Core)
       CPE OS Name: cpe:/o:centos:centos:7
            Kernel: Linux 3.10.0-327.el7.x86_64
      Architecture: x86-64
[root@lunar1 ~]# hostnamectl
   Static hostname: lunar2
         Icon name: computer-vm
           Chassis: vm
        Machine ID: 11f3b15bbc73453287d186e6aa5dda16
           Boot ID: 09514e0b4f1c458eacea8790d4e3412a
    Virtualization: kvm
  Operating System: CentOS Linux 7 (Core)
       CPE OS Name: cpe:/o:centos:centos:7
            Kernel: Linux 3.10.0-327.el7.x86_64
      Architecture: x86-64
[root@lunar1 ~]# 
[root@lunar1 ~]# exit
登出

Last login: Sat Jan 16 05:06:26 2016 from 192.168.56.1
[root@lunar2 ~]# 

这是我们看到,修改配置文件影响hostnamectl的结果(需要重新登录才能看到)
而使用hostnamectl set-hostname修改主机名(主要是修改了静态主机名)同样会自动更新/etc/hostname配置文件。
这个在Linux7和以前的Linux2~Linux6的不同之处,后面会看到,网卡等其他的配置信息也都是类似道理。
.
如果只想修改特定的主机名(静态,瞬态或灵活),可以使用“–static”,“–transient”或“–pretty”选项。
例如,修改静态主机名:

[root@localhost media]# hostnamectl --static set-hostname lunar1
[root@localhost media]# hostnamectl status
   Static hostname: lunar1
         Icon name: computer
           Chassis: n/a
        Machine ID: 7d3a3130ee07444c9142069b0dc0ec13
           Boot ID: 017583256da7406d9329f8bb1c9d914b
    Virtualization: kvm
  Operating System: Oracle Linux Server 7.1
       CPE OS Name: cpe:/o:oracle:linux:7:1
            Kernel: Linux 3.8.13-55.1.6.el7uek.x86_64
      Architecture: x86_64
[root@localhost media]# 

注意:
1,不必重启机器以激活永久主机名修改,上面的命令会立即修改内核主机名
2,通常我们用注销并重新登入的方法观察命令行的提示来观察新的静态主机名。
.
现在,我们测试大写主机名:
我们将主机名修改为大写的LUNAR2:

[root@lunar1 ~]# cat /etc/hostname
LUNAR2
[root@lunar1 ~]# hostnamectl
   Static hostname: LUNAR2
         Icon name: computer-vm
           Chassis: vm
        Machine ID: 11f3b15bbc73453287d186e6aa5dda16
           Boot ID: 09514e0b4f1c458eacea8790d4e3412a
    Virtualization: kvm
  Operating System: CentOS Linux 7 (Core)
       CPE OS Name: cpe:/o:centos:centos:7
            Kernel: Linux 3.10.0-327.el7.x86_64
      Architecture: x86-64
[root@lunar1 ~]# hostname
LUNAR2
[root@lunar1 ~]# 
[root@lunar1 ~]# exit
登出

Last login: Sat Jan 16 04:51:04 2016 from 192.168.56.1
[root@LUNAR2 ~]# 

我们查看一下相关日志,Linux7中systemd使用journald来管理日志系统,替换了sysVinit中的syslog,可以使用命令journalctl用来读取日志。
通常,应用程序和服务可以通过将相关信息按照需要的格式传递给 systemd journald 服务,然后由来journald来生成项目(在日志中记录相关信息)。
我们查看一下hostnamectl.service的相关日志:

[root@lunar1 ~]# journalctl _SYSTEMD_UNIT=hostnamectl.service
-- Logs begin at 六 2016-01-16 03:15:00 CST, end at 六 2016-01-16 05:40:01 CST. --
[root@lunar1 ~]#

这里看到,该服务只有一个启动的信息,没有其他修改信息。
那么时谁将上述修改信息记录到日志中呢?
这里我们看到主机名修改的信息,实际上由NetworkManager.service服务来管理,并计入了日志:

[root@lunar1 ~]# journalctl _SYSTEMD_UNIT=NetworkManager.service _PID=818
-- Logs begin at 六 2016-01-16 03:15:00 CST, end at 六 2016-01-16 05:40:01 CST. --
1月 16 03:15:37 localhost.localdomain NetworkManager[818]: <info>  NetworkManager (version 1.0.6-27.el7) is starting...
1月 16 03:15:37 localhost.localdomain NetworkManager[818]: <info>  Read config: /etc/NetworkManager/NetworkManager.conf and conf.d: 10-ibft-plugin.conf
1月 16 03:15:37 localhost.localdomain NetworkManager[818]: <info>  VPN: loaded org.freedesktop.NetworkManager.libreswan
1月 16 03:15:37 localhost.localdomain NetworkManager[818]: <info>  Loaded settings plugin ifcfg-rh: (c) 2007 - 2015 Red Hat, Inc.  To report bugs please use the NetworkManager mailing list. (/
。。。。。。。。。。。。。。。。
1月 16 04:07:00 #localhost.localdomain
lunar1 NetworkManager[818]: <info>  Setting system hostname to '#localhost.localdomain
                                                                    lunar1' (from system configuration)
1月 16 04:08:35 #localhost.localdomain NetworkManager[818]: <info>  Setting system hostname to '#localhost.localdomain' (from system configuration)
1月 16 04:09:03 lunar1 NetworkManager[818]: <info>  Setting system hostname to 'lunar1' (from address lookup)
1月 16 04:11:58 #localhost.localdomain
lunar1 NetworkManager[818]: <info>  Setting system hostname to '#localhost.localdomain
                                                                    lunar1' (from system configuration)
1月 16 04:33:52 lunar1 NetworkManager[818]: <info>  Setting system hostname to 'lunar1' (from system configuration)
1月 16 05:03:50 LUNAR2 NetworkManager[818]: <info>  Setting system hostname to 'LUNAR2' (from system configuration)
1月 16 05:05:57 lunar1 NetworkManager[818]: <info>  Setting system hostname to 'lunar1' (from system configuration)

[root@lunar1 ~]#

在/var/log/messages 中有如下记录:

Jan 16 04:07:00 localhost NetworkManager[818]: <info>  Setting system hostname to '#localhost.localdomain#012lunar1' (from system configuration)
Jan 16 04:07:00 localhost dbus-daemon: dbus[653]: [system] Activating via systemd: service name='org.freedesktop.nm_dispatcher' unit='dbus-org.freedesktop.nm-dispatcher.service'
Jan 16 04:07:00 localhost dbus[653]: [system] Activating via systemd: service name='org.freedesktop.nm_dispatcher' unit='dbus-org.freedesktop.nm-dispatcher.service'
Jan 16 04:07:00 localhost systemd: Starting Network Manager Script Dispatcher Service...
Jan 16 04:07:00 localhost dbus[653]: [system] Successfully activated service 'org.freedesktop.nm_dispatcher'
Jan 16 04:07:00 localhost systemd: Started Network Manager Script Dispatcher Service.
Jan 16 04:07:00 localhost dbus-daemon: dbus[653]: [system] Successfully activated service 'org.freedesktop.nm_dispatcher'
Jan 16 04:07:00 localhost nm-dispatcher: Dispatching action 'hostname'
Jan 16 04:08:02 localhost dbus-daemon: dbus[653]: [system] Activating via systemd: service name='org.freedesktop.hostname1' unit='dbus-org.freedesktop.hostname1.service'
Jan 16 04:08:02 localhost dbus[653]: [system] Activating via systemd: service name='org.freedesktop.hostname1' unit='dbus-org.freedesktop.hostname1.service'
Jan 16 04:08:02 localhost systemd: Starting Hostname Service...
Jan 16 04:08:02 localhost dbus[653]: [system] Successfully activated service 'org.freedesktop.hostname1'
Jan 16 04:08:02 localhost dbus-daemon: dbus[653]: [system] Successfully activated service 'org.freedesktop.hostname1'
Jan 16 04:08:02 localhost systemd: Started Hostname Service.
Jan 16 04:08:35 localhost NetworkManager[818]: <info>  Setting system hostname to '#localhost.localdomain' (from system configuration)
Jan 16 04:08:35 localhost dbus[653]: [system] Activating via systemd: service name='org.freedesktop.nm_dispatcher' unit='dbus-org.freedesktop.nm-dispatcher.service'
Jan 16 04:08:35 localhost dbus-daemon: dbus[653]: [system] Activating via systemd: service name='org.freedesktop.nm_dispatcher' unit='dbus-org.freedesktop.nm-dispatcher.service'
Jan 16 04:08:35 localhost systemd: Starting Network Manager Script Dispatcher Service...
Jan 16 04:08:35 localhost dbus[653]: [system] Successfully activated service 'org.freedesktop.nm_dispatcher'
Jan 16 04:08:35 localhost nm-dispatcher: Dispatching action 'hostname'
Jan 16 04:08:35 localhost dbus-daemon: dbus[653]: [system] Successfully activated service 'org.freedesktop.nm_dispatcher'
Jan 16 04:08:35 localhost systemd: Started Network Manager Script Dispatcher Service.
Jan 16 04:08:36 localhost dbus[653]: [system] Activating via systemd: service name='org.freedesktop.hostname1' unit='dbus-org.freedesktop.hostname1.service'
Jan 16 04:08:36 localhost dbus-daemon: dbus[653]: [system] Activating via systemd: service name='org.freedesktop.hostname1' unit='dbus-org.freedesktop.hostname1.service'
Jan 16 04:08:36 localhost systemd: Starting Hostname Service...
Jan 16 04:08:36 localhost dbus[653]: [system] Successfully activated service 'org.freedesktop.hostname1'
Jan 16 04:08:36 localhost dbus-daemon: dbus[653]: [system] Successfully activated service 'org.freedesktop.hostname1'
Jan 16 04:08:36 localhost systemd: Started Hostname Service.
Jan 16 04:09:03 localhost NetworkManager[818]: <info>  Setting system hostname to 'lunar1' (from address lookup)
Jan 16 04:09:03 localhost dbus[653]: [system] Activating via systemd: service name='org.freedesktop.nm_dispatcher' unit='dbus-org.freedesktop.nm-dispatcher.service'
Jan 16 04:09:03 localhost dbus-daemon: dbus[653]: [system] Activating via systemd: service name='org.freedesktop.nm_dispatcher' unit='dbus-org.freedesktop.nm-dispatcher.service'
Jan 16 04:09:03 localhost systemd: Starting Network Manager Script Dispatcher Service...
Jan 16 04:09:03 localhost dbus[653]: [system] Successfully activated service 'org.freedesktop.nm_dispatcher'
Jan 16 04:09:03 localhost dbus-daemon: dbus[653]: [system] Successfully activated service 'org.freedesktop.nm_dispatcher'
Jan 16 04:09:03 localhost nm-dispatcher: Dispatching action 'hostname'

还记得文档中systemd的特点么:
支持并行化任务
同时采用socket式与D-Bus(总线式激活服务);
按需启动守护进程(daemon);
利用 Linux 的 cgroups 监视进程;
支持快照和系统恢复;
维护挂载点和自动挂载点;
各服务间基于依赖关系进行精密控制。

这里我们看到的dbus就是D-Bus(总线式激活服务),因此这里的系统日志是Linux7特有的,由dbus进程记录:

[root@lunar2 ~]# ps -ef|grep 653
dbus       653     1  0 03:15 ?        00:00:01 /bin/dbus-daemon --system --address=systemd: --nofork --nopidfile --systemd-activation
root     28748 28671  0 06:01 pts/1    00:00:00 grep --color=auto 653
[root@lunar2 ~]# 
[root@lunar2 ~]# 
[root@lunar2 ~]# ps -ef|grep dbus
dbus       653     1  0 03:15 ?        00:00:01 /bin/dbus-daemon --system --address=systemd: --nofork --nopidfile --systemd-activation
root     12158     1  0 03:20 ?        00:00:00 dbus-launch --sh-syntax --exit-with-session
root     12159     1  0 03:20 ?        00:00:00 /bin/dbus-daemon --fork --print-pid 4 --print-address 6 --session
root     12323 12319  0 03:20 ?        00:00:00 /bin/dbus-daemon --config-file=/etc/at-spi2/accessibility.conf --nofork --print-address 3
root     28687     1  0 06:00 ?        00:00:00 /usr/sbin/abrt-dbus -t133
root     28750 28671  0 06:01 pts/1    00:00:00 grep --color=auto dbus
[root@lunar2 ~]# 

上面我们通过journal日志,还清晰的看到了修改过程:

Jan 16 04:09:03 localhost NetworkManager[818]: <info>  Setting system hostname to 'lunar1' (from address lookup)
Jan 16 04:09:03 localhost dbus[653]: [system] Activating via systemd: service name='org.freedesktop.nm_dispatcher' unit='dbus-org.freedesktop.nm-dispatcher.service'
Jan 16 04:09:03 localhost dbus-daemon: dbus[653]: [system] Activating via systemd: service name='org.freedesktop.nm_dispatcher' unit='dbus-org.freedesktop.nm-dispatcher.service'
Jan 16 04:09:03 localhost systemd: Starting Network Manager Script Dispatcher Service...
Jan 16 04:09:03 localhost dbus[653]: [system] Successfully activated service 'org.freedesktop.nm_dispatcher'
Jan 16 04:09:03 localhost dbus-daemon: dbus[653]: [system] Successfully activated service 'org.freedesktop.nm_dispatcher'
Jan 16 04:09:03 localhost nm-dispatcher: Dispatching action 'hostname'

也就是,如果NetworkManager.service是开启的,那么实际上修改主机名的工作由NetworkManager完成。
那么如果关闭NetworkManager.service服务,会是什么样子?

[root@lunar1 ~]# systemctl stop NetworkManager
[root@lunar1 ~]# systemctl status NetworkManager
● NetworkManager.service - Network Manager
   Loaded: loaded (/usr/lib/systemd/system/NetworkManager.service; enabled; vendor preset: enabled)
   Active: inactive (dead) since 六 2016-01-16 05:54:55 CST; 5s ago
 Main PID: 818 (code=exited, status=0/SUCCESS)

1月 16 04:11:58 #localhost.localdomain
lunar1 NetworkManager[818]: <info>  Setting system hostname to '#localhost.localdomain
                                                                    lunar1' (from system configuration)
1月 16 04:33:52 lunar1 NetworkManager[818]: <info>  Setting system hostname to 'lunar1' (from system configuration)
1月 16 05:03:50 LUNAR2 NetworkManager[818]: <info>  Setting system hostname to 'LUNAR2' (from system configuration)
1月 16 05:05:57 lunar1 NetworkManager[818]: <info>  Setting system hostname to 'lunar1' (from system configuration)
1月 16 05:54:54 lunar1 systemd[1]: Stopping Network Manager...
1月 16 05:54:54 lunar1 NetworkManager[818]: <info>  caught SIGTERM, shutting down normally.
1月 16 05:54:54 lunar1 NetworkManager[818]: <info>  (virbr0): bridge port virbr0-nic was detached
1月 16 05:54:54 lunar1 NetworkManager[818]: <info>  (virbr0-nic): released from master virbr0
1月 16 05:54:54 lunar1 NetworkManager[818]: <info>  exiting (success)
1月 16 05:54:55 lunar1 systemd[1]: Stopped Network Manager.
[root@lunar1 ~]# 
[root@lunar1 ~]# 
[root@lunar1 ~]# hostname
lunar1
[root@lunar1 ~]# hostnamectl set-hostname lunar2
[root@lunar1 ~]# hostname
lunar2
[root@lunar1 ~]# hostnamectl
   Static hostname: lunar2
         Icon name: computer-vm
           Chassis: vm
        Machine ID: 11f3b15bbc73453287d186e6aa5dda16
           Boot ID: 09514e0b4f1c458eacea8790d4e3412a
    Virtualization: kvm
  Operating System: CentOS Linux 7 (Core)
       CPE OS Name: cpe:/o:centos:centos:7
            Kernel: Linux 3.10.0-327.el7.x86_64
      Architecture: x86-64
[root@lunar1 ~]# cat /etc/hostname
lunar2
[root@lunar1 ~]# exit
登出

Last login: Sat Jan 16 05:11:39 2016 from 192.168.56.1
[root@lunar2 ~]# 

然后我们查看日志:

[root@lunar2 ~]# journalctl _SYSTEMD_UNIT=NetworkManager.service|tail
1月 16 04:11:58 #localhost.localdomain
lunar1 NetworkManager[818]: <info>  Setting system hostname to '#localhost.localdomain
                                                                    lunar1' (from system configuration)
1月 16 04:33:52 lunar1 NetworkManager[818]: <info>  Setting system hostname to 'lunar1' (from system configuration)
1月 16 05:03:50 LUNAR2 NetworkManager[818]: <info>  Setting system hostname to 'LUNAR2' (from system configuration)
1月 16 05:05:57 lunar1 NetworkManager[818]: <info>  Setting system hostname to 'lunar1' (from system configuration)
1月 16 05:54:54 lunar1 NetworkManager[818]: <info>  caught SIGTERM, shutting down normally.
1月 16 05:54:54 lunar1 NetworkManager[818]: <info>  (virbr0): bridge port virbr0-nic was detached
1月 16 05:54:54 lunar1 NetworkManager[818]: <info>  (virbr0-nic): released from master virbr0
1月 16 05:54:54 lunar1 NetworkManager[818]: <info>  exiting (success)
[root@lunar2 ~]# 

这里显示NetworkManager服务最后的日志信息是关闭NetworkManager服务的。
查看/var/log/messages,我们发现,关闭NetworkManager.service以后,修改主机名的工作由systemd来完成:

Jan 16 05:54:55 localhost systemd: Stopped Network Manager.
Jan 16 05:55:01 localhost systemd: Created slice user-989.slice.
Jan 16 05:55:01 localhost systemd: Starting user-989.slice.
Jan 16 05:55:01 localhost systemd: Started Session 38 of user pcp.
Jan 16 05:55:01 localhost systemd: Starting Session 38 of user pcp.
Jan 16 05:55:01 localhost systemd: Removed slice user-989.slice.
Jan 16 05:55:01 localhost systemd: Stopping user-989.slice.
Jan 16 05:55:35 localhost dbus[653]: [system] Activating via systemd: service name='org.freedesktop.hostname1' unit='dbus-org.freedesktop.hostname1.service'
Jan 16 05:55:35 localhost dbus-daemon: dbus[653]: [system] Activating via systemd: service name='org.freedesktop.hostname1' unit='dbus-org.freedesktop.hostname1.service'
Jan 16 05:55:35 localhost systemd: Starting Hostname Service...
Jan 16 05:55:35 localhost dbus[653]: [system] Successfully activated service 'org.freedesktop.hostname1'
Jan 16 05:55:35 localhost dbus-daemon: dbus[653]: [system] Successfully activated service 'org.freedesktop.hostname1'
Jan 16 05:55:35 localhost systemd: Started Hostname Service.
Jan 16 05:55:35 localhost systemd-hostnamed: Changed static host name to 'lunar2'
Jan 16 05:55:35 localhost systemd-hostnamed: Changed host name to 'lunar2'
Jan 16 05:55:54 localhost systemd-logind: Removed session 31.
Jan 16 05:55:56 localhost systemd: Started Session 39 of user root.
Jan 16 05:55:56 localhost systemd-logind: New session 39 of user root.
Jan 16 05:55:56 localhost systemd: Starting Session 39 of user root.
Jan 16 05:55:56 localhost dbus-daemon: dbus[653]: [system] Activating service name='org.freedesktop.problems' (using servicehelper)
Jan 16 05:55:56 localhost dbus[653]: [system] Activating service name='org.freedesktop.problems' (using servicehelper)
Jan 16 05:55:56 localhost dbus-daemon: dbus[653]: [system] Successfully activated service 'org.freedesktop.problems'
Jan 16 05:55:56 localhost dbus[653]: [system] Successfully activated service 'org.freedesktop.problems'
Jan 16 05:58:01 localhost systemd: Created slice user-989.slice.
Jan 16 05:58:01 localhost systemd: Starting user-989.slice.
Jan 16 05:58:01 localhost systemd: Started Session 40 of user pcp.
Jan 16 05:58:01 localhost systemd: Starting Session 40 of user pcp.
Jan 16 05:58:02 localhost systemd: Removed slice user-989.slice.
Jan 16 05:58:02 localhost systemd: Stopping user-989.slice.


===================================================================
总结Linux7中关于主机名管理的改变:
===================================================================
1,主机名配置文件更改为/etc/hostname(Linux7以前是/etc/sysconfig/network)
2,主机名管理命令hostnamectl,Linux7以前的hostname仅用于读取主机名配置文件/etc/hostname或者设置瞬态主机名(transient)
3,修改/etc/hostname和使用hostnamectl更改主机名会相互同步。
例如,修改/etc/hostname的内容,则使用hostnamectl会观察到相应的变化
而使用hostnamectl修改主机名,可以看到/etc/hostname被相应的自动更新
4,查看主机名使用hostnamectl或者hostnamectl status
查看静态,瞬态和灵活主机名分别用:
hostnamectl status –static
hostnamectl status –transient
hostnamectl status –pretty
其中,hostnamectl status –static读取/etc/hostname的第一行内容
hostnamectl status –transient读取/etc/hostname的全部内容
5,修改主机名后,无需重启主机,只需要重新登录即可
简单的说:
Linux7上修改主机名,从以前的hostname命令更改为“hostnamectl set-hostname lunar1”,然后重新登录就可以了
查看当前的主机名,从以前的hostname命令更改为“hostnamectl”或者“hostnamectl status”就可以了
6,/etc/hosts文件需要手工修改,没有自动同步机制(合情合理)
7, Linux11.2 on Linux6和Linux7上的最佳实践,建议hostname使用全名称,即 hostname.domainname
===================================================================


Linux7(CentOS,RHEL,OEL)和Oracle RAC环境系列–1-简介
Linux7(CentOS,RHEL,OEL)和Oracle RAC环境系列-2-修改主机名和hostnamectl工具的使用
Linux7(CentOS,RHEL,OEL)和Oracle RAC环境系列–3-systemd(d.bin和ohasd守护进程)
Linux7(CentOS,RHEL,OEL)和Oracle RAC环境系列–4-target(图形界面和字符界面)
Linux7(CentOS,RHEL,OEL)和Oracle RAC环境系列–5-防火墙
Linux7(CentOS,RHEL,OEL)和Oracle RAC环境系列–6-开机自动启动或者禁用服务
Linux7(CentOS,RHEL,OEL)和Oracle RAC环境系列-7-网络管理之添加网
Linux7(CentOS,RHEL,OEL)和Oracle RAC环境系列-7-网络管理之修改IP地址
Linux7(CentOS,RHEL,OEL)和Oracle RAC环境系列-7-网络管理之修改网络接口名
Linux7(CentOS,RHEL,OEL)和Oracle RAC环境系列-8-在Linux7上安装11.2 RAC和12.1 RAC需要禁用哪些服务
Linux7(CentOS,RHEL,OEL)和Oracle RAC环境系列-9-Linux 7.2上的virbr0设备
Linux7(CentOS,RHEL,OEL)和Oracle RAC环境系列-10-ABRT-系统启动后自动检查和报告错误
Linux7(CentOS,RHEL,OEL)和Oracle RAC环境系列-11-配置VNC和常见问题处理

发表在 Installation and Deinstall, Linux, ORACLE 12C, RAC | 标签为 , , , , , , | 留下评论

Linux7(CentOS,RHEL,OEL)和Oracle RAC环境系列–1-简介

去年开始测试Linux7.1的相关功能,包括CentOS Linux7的安装和OEL的安装
在Linux7.1(8月份已经release的是Linux7.2)上安装Oracle 11.2.0.4 RAC, Oracle 12.1 RAC,Oracle 12.2 beta Standalone等等大量测试。
由于Linux7在架构上改变较Linux6有很大改变,包括系统服务的架构,管理命令集等等
感觉上是几乎是重新学习了一下Linux的一些常用管理方法,就如同Oracle 10.2 RAC到11.2 Grid Infrastructure 的改变一样。
由于比较懒,之前没有总结,一段时间不玩,发现很多生疏了,记忆力不好是硬伤……因此,开始打算逐步总结一下,免得以后用的时候忘记了 :)
.
Linux7总体感觉启动很快,这个可能跟Linux7采用systemd的管理方式有关系
之前的Linux版本中,使用SysVinit一次一个的串行地启动服务。
系统启动按照/etc/inittab中定义的脚本顺序启动,这种启动服务的方式靠脚本控制,考虑服务之间的依赖关系,因此是顺序执行的
从Linux7开始,采用Systemd并行地启动系统服务进程,系统启动时并行启动多个预先配置的Unit
不同Unit之间的依赖关系使用缓冲的方法,将有依赖关系的服务请求放入队列
待被依赖的服务启动后,该服务继续获取执行,因此可以做到并行执行服务来快速启动。
而且Systemd最初仅启动确实被依赖的那些服务,极大地减少了系统引导的时间。
可以用下面的命令看到系统引导用时:

[root@lunar system]# systemd-analyze
Startup finished in 569ms (kernel) + 8.883s (initrd) + 22.474s (userspace) = 31.926s
[root@lunar system]# 

这里看到,开机时间是31秒左右,可见开机速度之快(关机也同样快)!
.
systemd命令非常丰富,通过查看help就可以看出来。
比如列出所有正在运行的单元:

[root@lunar system]# systemctl|grep ohasd
ohasd.service                                                                                loaded active exited    ohasd.service
oracle-ohasd.service                                                                         loaded active running   Oracle High Availability Services
[root@lunar system]# 

.
作为一个DBA,从安装开始熟悉一个新成品,然后通过逐步测试官方文档中的各种功能来熟悉产品已经成为习惯。
这就从安装RAC开始说起。
首先是OS的安装,因为考虑后面是为了跑Oracle,因此我选择OEL Linux7.
安装时如果后面不考虑静默安装RAC或者静默安装数据库,那么需要选择“带图形的服务器”(Server with GUI)
其他的没什么特别的,界面风格跟以前不同,但本质差不太多。
.
查看系统当前的版本号:
目前,我一般使用的是OEL7.1和CentOS7.2为测试系统:

[root@lunar bin]# uname -a
Linux lunar.oracle.com 3.10.0-327.el7.x86_64 #1 SMP Thu Nov 19 22:10:57 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
[root@lunar bin]# cat /etc/*releas*
CentOS Linux release 7.2.1511 (Core) 
Derived from Red Hat Enterprise Linux 7.2 (Source)
NAME="CentOS Linux"
VERSION="7 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="7"
PRETTY_NAME="CentOS Linux 7 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:7"
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"

CENTOS_MANTISBT_PROJECT="CentOS-7"
CENTOS_MANTISBT_PROJECT_VERSION="7"
REDHAT_SUPPORT_PRODUCT="centos"
REDHAT_SUPPORT_PRODUCT_VERSION="7"

CentOS Linux release 7.2.1511 (Core) 
CentOS Linux release 7.2.1511 (Core) 
cpe:/o:centos:centos:7
[root@lunar bin]# 
[root@lunar bin]# 

安装之后准备安装12.1 RAC的预安装检查:
查看系统CPU 内存 版本等信息

检查cpu:
[root@localhost ~]# more /proc/cpuinfo | grep "model name"
model name      : Intel(R) Core(TM) i5-4210M CPU @ 2.60GHz
model name      : Intel(R) Core(TM) i5-4210M CPU @ 2.60GHz
[root@localhost ~]# grep "model name" /proc/cpuinfo | cut -f2 -d:
 Intel(R) Core(TM) i5-4210M CPU @ 2.60GHz
 Intel(R) Core(TM) i5-4210M CPU @ 2.60GHz
[root@localhost ~]# 
检查物理内存:
[root@localhost ~]# grep MemTotal /proc/meminfo
MemTotal:        2505184 kB
[root@localhost ~]# 
[root@localhost ~]# free -m
              total        used        free      shared  buff/cache   available
Mem:           2446         361        1406           8         678        2016
Swap:          2559           0        2559
[root@localhost ~]# 
检查OS是否64位:
[root@localhost ~]# getconf LONG_BIT
64
[root@localhost ~]# echo $HOSTTYPE
x86_64
[root@localhost ~]# uname -a
Linux lunar1 3.8.13-55.1.6.el7uek.x86_64 #2 SMP Wed Feb 11 14:18:22 PST 2015 x86_64 x86_64 x86_64 GNU/Linux
[root@localhost ~]# 

[root@localhost ~]# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 7.1 (Maipo)
[root@localhost ~]# cat /etc/oracle-release 
Oracle Linux Server release 7.1
[root@localhost ~]# 

检查网卡接口和IP信息:

[root@localhost ~]# ip link show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT 
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: enp0s3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT qlen 1000
    link/ether 08:00:27:1d:12:18 brd ff:ff:ff:ff:ff:ff
3: enp0s8: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT qlen 1000
    link/ether 08:00:27:97:78:21 brd ff:ff:ff:ff:ff:ff
[root@localhost ~]# 
[root@localhost ~]# ip addr show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN 
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: enp0s3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 08:00:27:1d:12:18 brd ff:ff:ff:ff:ff:ff
    inet 192.168.56.11/24 brd 192.168.56.255 scope global enp0s3
    inet6 fe80::a00:27ff:fe1d:1218/64 scope link 
       valid_lft forever preferred_lft forever
3: enp0s8: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 08:00:27:97:78:21 brd ff:ff:ff:ff:ff:ff
    inet 192.168.60.11/24 brd 192.168.60.255 scope global enp0s8
    inet6 fe80::a00:27ff:fe97:7821/64 scope link 
       valid_lft forever preferred_lft forever
[root@localhost ~]#

不采用静默安装时,我们需要考虑:
1,修改主机名
2,修改网卡,IP等
3,配置本地YUM源(我一般配置本地yum源,因为如果客户环境大部分情况是不能上网的,因此本地yum源更常用)
4,配置VNC
5,配置asmlib和udev绑定(不同的vm测试重点不同)
6,防火墙和SELINUX
等等
一般我自己测试时asmlib和udev的环境都有,真实的客户更多采用的是UDEV绑定,asmlib目前使用并不多
从Linux6.2开始,multipath.conf文件中没有gid,uid属性了,因此生产中多路径和使用udev绑定设备的情况是常见的。

如果使用配置一个vm,比如主机名是lunar1,然后复制成lunar2,用来装RAC
还需要涉及到vm的复制和修改相关配置等,不同的vm(vmware和vbox)方法不同,比如vbox中可以使用至少3中方法来迁移
总是,装机器也是很好玩的过程……
在Linux7上安装时,通常需要涉及到的配置如下:后续陆续整理出来。


Linux7(CentOS,RHEL,OEL)和Oracle RAC环境系列–1-简介
Linux7(CentOS,RHEL,OEL)和Oracle RAC环境系列-2-修改主机名和hostnamectl工具的使用
Linux7(CentOS,RHEL,OEL)和Oracle RAC环境系列–3-systemd(d.bin和ohasd守护进程)
Linux7(CentOS,RHEL,OEL)和Oracle RAC环境系列–4-target(图形界面和字符界面)
Linux7(CentOS,RHEL,OEL)和Oracle RAC环境系列–5-防火墙
Linux7(CentOS,RHEL,OEL)和Oracle RAC环境系列–6-开机自动启动或者禁用服务
Linux7(CentOS,RHEL,OEL)和Oracle RAC环境系列-7-网络管理之添加网
Linux7(CentOS,RHEL,OEL)和Oracle RAC环境系列-7-网络管理之修改IP地址
Linux7(CentOS,RHEL,OEL)和Oracle RAC环境系列-7-网络管理之修改网络接口名
Linux7(CentOS,RHEL,OEL)和Oracle RAC环境系列-8-在Linux7上安装11.2 RAC和12.1 RAC需要禁用哪些服务
Linux7(CentOS,RHEL,OEL)和Oracle RAC环境系列-9-Linux 7.2上的virbr0设备
Linux7(CentOS,RHEL,OEL)和Oracle RAC环境系列-10-ABRT-系统启动后自动检查和报告错误
Linux7(CentOS,RHEL,OEL)和Oracle RAC环境系列-11-配置VNC和常见问题处理

发表在 Installation and Deinstall, Linux, ORACLE 12C, RAC | 标签为 , , , | 一条评论