Chapter 9. Managing Services with systemd - Red Hat Customer Portal. Systemd is a system and service manager for Linux operating systems. It is designed to be backwards compatible with Sys. V init scripts, and provides a number of features such as parallel startup of system services at boot time, on- demand activation of daemons, support for system state snapshots, or dependency- based service control logic. In Red Hat Enterprise Linux 7, systemd replaces Upstart as the default init system. Systemd introduces the concept of systemd units. These units are represented by unit configuration files located in one of the directories listed in Table 9. Systemd Unit Files Locations”, and encapsulate information about system services, listening sockets, saved system state snapshots, and other objects that are relevant to the init system. For a complete list of available systemd unit types, see Table 9. Available systemd Unit Types”. Table 9. 1. Available systemd Unit Types. Unit Type. File Extension. Description Service unit . A system service. Target unit . target A group of systemd units. Automount unit . automount A file system automount point. Device unit . device A device file recognized by the kernel. Mount unit . mount A file system mount point. Path unit . path A file or directory in a file system. Scope unit . scope An externally created process. Slice unit . slice A group of hierarchically organized units that manage system processes. Snapshot unit . snapshot A saved state of the systemd manager. Socket unit . socket An inter- process communication socket. Swap unit . swap A swap device or a swap file. Timer unit . timer A systemd timer.
Table 9. 2. Systemd Unit Files Locations. Directory. Description/usr/lib/systemd/system/ Systemd unit files distributed with installed RPM packages. This was a very nasty error that I found in the System Event logs of my Windows 2000 webserver while upgrading a Digital ID for Secure Email certificate. The following simple guide help you to setup the VNC server on RHEL/CentOS 6 machines, VNC help to share the desktop. Systemd unit files created at run time. This directory takes precedence over the directory with installed service unit files. Systemd unit files created by systemctl enable as well as unit files added for extending a service. This directory takes precedence over the directory with runtime unit files. Overriding the Default systemd Configuration Using system. The default configuration of systemd is defined during the compilation and it can be found in systemd configuration file at /etc/systemd/system. Use this file if you want to deviate from those defaults and override selected default values for systemd units globally. For example, to override the default value of the timeout limit, which is set to 9. Default. Timeout. Start. Sec parameter to input the required value in seconds. Default. Timeout. Start. Sec=required value. In Red Hat Enterprise Linux 7, the systemd system and service manager provides the following main features. Socket- based activation — At boot time, systemd creates listening sockets for all system services that support this type of activation, and passes the sockets to these services as soon as they are started. This not only allows systemd to start services in parallel, but also makes it possible to restart a service without losing any message sent to it while it is unavailable: the corresponding socket remains accessible and all messages are queued. Systemd uses socket units for socket- based activation. Bus- based activation — System services that use D- Bus for inter- process communication can be started on- demand the first time a client application attempts to communicate with them. Systemd uses D- Bus service files for bus- based activation. Device- based activation — System services that support device- based activation can be started on- demand when a particular type of hardware is plugged in or becomes available. Systemd uses device units for device- based activation. Path- based activation — System services that support path- based activation can be started on- demand when a particular file or directory changes its state. Systemd uses path units for path- based activation. System state snapshots — Systemd can temporarily save the current state of all units or restore a previous state of the system from a dynamically created snapshot. To store the current state of the system, systemd uses dynamically created snapshot units. Mount and automount point management — Systemd monitors and manages mount and automount points. Systemd uses mount units for mount points and automount units for automount points. Aggressive parallelization — Because of the use of socket- based activation, systemd can start system services in parallel as soon as all listening sockets are in place. In combination with system services that support on- demand activation, parallel activation significantly reduces the time required to boot the system. Transactional unit activation logic — Before activating or deactivating a unit, systemd calculates its dependencies, creates a temporary transaction, and verifies that this transaction is consistent. If a transaction is inconsistent, systemd automatically attempts to correct it and remove non- essential jobs from it before reporting an error. Backwards compatibility with Sys. V init — Systemd supports Sys. V init scripts as described in the Linux Standard Base Core Specification, which eases the upgrade path to systemd service units. Compatibility Changes. The systemd system and service manager is designed to be mostly compatible with Sys. V init and Upstart. The following are the most notable compatibility changes with regards to the previous major release of the Red Hat Enterprise Linux system. Systemd has only limited support for runlevels. It provides a number of target units that can be directly mapped to these runlevels and for compatibility reasons, it is also distributed with the earlier runlevel command. Not all systemd targets can be directly mapped to runlevels, however, and as a consequence, this command might return N to indicate an unknown runlevel. It is recommended that you avoid using the runlevel command if possible. The systemctl utility does not support custom commands. In addition to standard commands such as start, stop, and status, authors of Sys. V init scripts could implement support for any number of arbitrary commands in order to provide additional functionality. For example, the init script for iptables in Red Hat Enterprise Linux 6 could be executed with the panic command, which immediately enabled panic mode and reconfigured the system to start dropping all incoming and outgoing packets. This is not supported in systemd and the systemctl only accepts documented commands. The systemctl utility does not communicate with services that have not been started by systemd. When systemd starts a system service, it stores the ID of its main process in order to keep track of it. The systemctl utility then uses this PID to query and manage the service. Consequently, if a user starts a particular daemon directly on the command line, systemctl is unable to determine its current status or stop it. Systemd stops only running services. Previously, when the shutdown sequence was initiated, Red Hat Enterprise Linux 6 and earlier releases of the system used symbolic links located in the /etc/rc. With systemd, only running services are stopped on shutdown. System services are unable to read from the standard input stream. When systemd starts a service, it connects its standard input to /dev/null to prevent any interaction with the user. System services do not inherit any context (such as the HOME and PATH environment variables) from the invoking user and their session. Each service runs in a clean execution context. When loading a Sys. V init script, systemd reads dependency information encoded in the Linux Standard Base (LSB) header and interprets it at run time. All operations on service units are subject to a default timeout of 5 minutes to prevent a malfunctioning service from freezing the system. This value is hardcoded for services that are generated from initscripts and cannot be changed. However, individual configuration files can be used to specify a longer timeout value per service, see Example 9. Changing the timeout limit”. For a detailed list of compatibility changes introduced with systemd, see the Migration Planning Guide for Red Hat Enterprise Linux 7. Ubuntu 1. 2. 0. 4 Openstack Essex 安装(单节点) – 陈沙克日志以前使用百度空间的文档有不少错误,这次就重新把文档整理一遍,发布到新的blog上。这其实是用windows live writer本地完成,看看效果如何。这个文档是描述Openstack Essex安装,把所有的服务安装在一台机器上。包括组件Nova,Keystone, Glance, Dashboard.文档更新记录2. IP改成1. 0. 1. 1. 99. T参数. 2. 01. 2年7月1. Folsom马上就要正式发布,在发布前,把以前文档有遗憾的地方全部调整了。把默认的密码改成password。基本已经验证了一次,没任何的问题。很多朋友安装失败,基本都是因为修改IP地址导致的,这次调整的命令,让安装过程更加方便,IP设置的地方,采用变量,自动调整。已经反复验证了两遍,没发现任何的问题。. Fix IP,也是采用变量。大家参考文档安装的时候,只需要修改 novarc, 就可以,别的基本都不需要做任何的修改,唯一还需要调整的就是创建floating 网络的时候,需要根据你的情况,设置一下。. IP,fix. IP都设置变量,并且fix IP,是直接取eth. IP地址的前3位合成,这样可以说,算是全部符合我的要求。. SERVICE_PASSWORD=password, 这样你可以根据自己的需要调整密码。. IP地址和密码等设置,全部都是用变量。目前swift可以结合glance工作,不过在dashbord里,snapshot的时候,如果image太大,会导致失败。我使用Cirros的image测试是没问题,ubuntu的image是无法snapshot保存到swift上。说明swift还是有地方需要优化。作为一个POC环境搭建,应该算是基本满足需求。目前在我的实验环境下,使用ubuntu内网的源,从安装OS到全部搭建完成,应该不需要超过3. IP bridge控制节点+计算节点+网络节点+volume+ntp 服务器,Flat. DHCP和multi_host=Tswiftnode. IP Bridge计算节点+网络节点英文原文 百度空间原文 计算节点安装文档改动 Nova,Keystone,Glance,采用mysql. Keystone 的endpoint也导入到mysql里 基本介绍Openstack的网络比较复杂,也很难理解。大家可以直接看http: //www. IP的网络。这是multihost=true的设置。这个图是可以很好帮助大家理解Openstack的网络。我文档和这个图有点不一样,我是使用eth. IP。准备系统安装ubuntu 1. Eth. 0: 1. 0. 1. 1. Eth. 1: 不需要设置IP编辑 /etc/network/interfaces,需要注意一点是对于ubuntu 1. T- FD flow- control, link ok. T- FD flow- control, link ok设置hostname (可选)这是我的习惯,Openstack基本是不需要使用hostname。大家可以忽略。# cat /etc/hostname. The following lines are desirable for IPv. NTP服务器对于单节点来说,NTP服务器,并不是必须的。如果是多台机器的环境。就需要设置所有的节点,都吧ntp服务指向相同的一个ntp服务器上。apt- get - y install ntp设置NTP编辑 /etc/ntp. NTP服务service ntp restart上面设置 server 1. ISCSI (可选)这是为Nova- volume服务使用的。不过目前nova- volume并不稳定,大家测试一下就可以。未来的Folsom版本,将会有新的组件来替代Nova- volume。如果你不测试nova volume,可以不安装apt- get - y install tgtnova- compute节点,需要安装ISCSI客户端apt- get install - y open- iscsi open- iscsi- utils. Nova- volume (可选)如果你没有单独的分区,那么就不建议你测试,采用文件模拟的方式,基本是不可行。我安装系统的时候,创建了一个nova- volume的分区,我先umount,再创建一个volume,名字为nova- volumes。nova的默认使用的volume的名字就是叫 nova- volumes. Filesystem Size Used Avail Use% Mounted on. G 9. 41. M 5. 91. G 1% /. udev 2. G 4. 0. K 2. 0. G 1% /dev. M 2. 76. K 7. 89. M 1% /run. none 5. M 0 5. 0. M 0% /run/lock. G 0 2. 0. G 0% /run/shm. M 3. 0M 1. 01. M 2. G 1. 88. M 9. 2G 1% /nova- volume. G 1. 88. M 9. 2G 1% /swift创建nova- volumes 卷umount /dev/sda. Bridge目前Openstack的网络是通过linux的bridge和iptables来实现的。apt- get - y install bridge- utils重启网络/etc/init. Rabbit. MQ和Memcache 等Rabbit. MQ是用来做调度使用。Memcache是给Dashboard使用。apt- get install - y rabbitmq- server memcached python- memcache kvm libvirt- bin curl环境变量大家经常参考文档安装不成功,基本都是因为你修改的IP地址或者你更改了我文档默认的密码。为了让文档更加灵活,所以需要设置一下环境变量。你可以根据你的实际情况修改admin的密码和mysql的密码。下面文档和数据库相关的密码都是相同,你只需要修改novarc就可以。运行完下面的命令,你再对novarc进行修改。cat > /root/novarc < < EOF. OS_TENANT_NAME=admin. OS_USERNAME=admin. OS_PASSWORD=password. MYSQL_PASS=password. SERVICE_PASSWORD=password. FIXED_RANGE=1. 0. FLOATING_RANGE=$(/sbin/ifconfig eth. F "."'{print $1"."$2"."$3}'). OS_AUTH_URL="http: //localhost: 5. SERVICE_ENDPOINT="http: //localhost: 3. SERVICE_TOKEN=$(openssl rand - hex 1. MASTER="$(/sbin/ifconfig eth. EOF根据你的需求进行调整,我的novarc的内容# cat novarc. OS_TENANT_NAME=admin. OS_USERNAME=admin. OS_PASSWORD=password. MYSQL_PASS=password. SERVICE_PASSWORD=password. FIXED_RANGE=1. 0. FLOATING_RANGE=1. OS_AUTH_URL="http: //localhost: 5. SERVICE_ENDPOINT="http: //localhost: 3. SERVICE_TOKEN=d. 5d. MASTER="1. 0. 1. 1. MYSQL在Openstack组件里,Nova,Keystone, Glance, 都需要用到数据库。所以我们需要创建相关的数据库和用户。应用数据库数据库用户密码mysqlrootpasswordnovanovapasswordglanceglancepasswordkeystonekeystonepassword 安装mysql自动安装cat < < MYSQL_PRESEED | debconf- set- selections. MYSQL_PASS. mysql- server- 5. MYSQL_PASS. mysql- server- 5. MYSQL_PRESEEDOpenstack都是Python写的,所以你需要python- mysqldb,安装过程,就不会提示你输入root密码apt- get install - y mysql- server python- mysqldb配置编辑/etc/mysql/my. MYSQL_PASS < < EOF. CREATE DATABASE nova. GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'%' IDENTIFIED BY '$MYSQL_PASS'. CREATE DATABASE glance. GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'%' IDENTIFIED BY '$MYSQL_PASS'. CREATE DATABASE keystone. GRANT ALL PRIVILEGES ON keystone.* TO 'keystone'@'%'IDENTIFIED BY '$MYSQL_PASS'. FLUSH PRIVILEGES. EOFKeystone. Keystone是Openstack的核心,所有的组件,都需要通过keystone进行认证和授权。租户(tenant)用户密码 adminadminpassword servicenovapassword glancepassword 安装apt- get install - y keystone python- keystone python- keystoneclient配置编辑/etc/keystone/keystone. ADMIN,我这里修改成随机生成,查看novarc获得. DEFAULT]. #bind_host = 0. ADMIN. admin_token = d. ADMIN/admin_token = $SERVICE_TOKEN/g" /etc/keystone/keystone. MYSQL_PASS"'@'"$MASTER"'/keystone|g}' /etc/keystone/keystone. Keystone Datawget http: //www. Endpoint 导入wget http: //www. Name": "admin. Tenant", "password. Credentials": \. {"username": "admin. User", "password": "secretword"}}}' - H "Content- type: \. IP: 3. 53. 57/v. 2. Name": "admin", "password. Credentials": {"username": "admin", "password": "password"}}}' - H "Content- type: application/json" http: //$MASTER: 3. T0. 2: 0. 9: 3. 7Z". True | admin@chenshake. True | glance@chenshake. True | swift@chenshake. True | nova@chenshake. Region. One | http: //1. Region. One | http: //1. Region. One | http: //1. Region. One | http: //1. Region. One | http: //1. AUTH_%(tenant_id)s | http: //1. AUTH_%(tenant_id)s | http: //1. Region. One | http: //1. Cloud | http: //1. Cloud | http: //1. Admin |. +- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -+- -- -- -- -- -- +- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -+可以使用下面命令来查看结果keystone tenant- list. Glance. Glance是提供镜像管理服务,可以理解成一个中间件,后面的存储可以是本地存储,也可以使用swift存储。安装apt- get install - y glance glance- api glance- client glance- common glance- registry python- glance配置编辑 /etc/glance/glance- api- paste. SERVICE_TENANT_NAME%. SERVICE_USER%. #admin_password = %SERVICE_PASSWORD%. SERVICE_TENANT_NAME%/service/g; s/%SERVICE_USER%/glance/g; s/%SERVICE_PASSWORD%/$SERVICE_PASSWORD/g; " /etc/glance/glance- api- paste. SERVICE_TENANT_NAME%/service/g; s/%SERVICE_USER%/glance/g; s/%SERVICE_PASSWORD%/$SERVICE_PASSWORD/g; " /etc/glance/glance- registry- paste. MYSQL_PASS"'@'"$MASTER"'/glance|g}' /etc/glance/glance- registry. EOF > > /etc/glance/glance- api. EOF > > /etc/glance/glance- registry. EOF重启glance服务service glance- api restart & & service glance- registry restart同步glance数据库# glance- manage version_control 0. SADeprecation. Warning: useexisting is deprecated. Use extend_existing. True)看到下面的输出,表示正常的。重启glance服务service glance- api restart & & service glance- registry restart测试glance index没有输出,表示正常,因为目前还没有镜像。下载Image我们下载Cirr. OS的image作为测试使用,只有1. M。如果是ubuntu官方的image,2. M,并且ubuntu官方的image,都是需要使用密钥登陆。Cirr. OS下载imagewget https: //launchpad. Cirros,是可以使用用户名和密码登陆,也可以使用密钥登陆user: cirrospassword: cubswin: )Ubuntu官方image下载imagewget http: //cloud- images. Ubuntu 1. 2. 0. 4 cloudimg amd. ID Name Disk Format Container Format Size. Ubuntu 1. 2. 0. 4 cloudimg amd. Nova安装apt- get install - y nova- api nova- cert nova- common nova- objectstore \. SERVICE_TENANT_NAME%. SERVICE_USER%. #admin_password = %SERVICE_PASSWORD%. SERVICE_TENANT_NAME%/service/g; s/%SERVICE_USER%/nova/g; s/%SERVICE_PASSWORD%/$SERVICE_PASSWORD/g; " /etc/nova/api- paste. Essex版本的nova,配置文件不需要前面加上 — 。日后我会逐步调整nova. EOF. ###### LOGS/STATE. AUTHENTICATION. auth_strategy=keystone. SCHEDULER. #- -compute_scheduler_driver=nova.Filter. Scheduler.Simple. Scheduler.DATABASE. sql_connection=mysql: //nova: $MYSQL_PASS@$MASTER/nova. Canon Mx860 Printer Error 6A80 Canon . True. libvirt_use_virtio_for_bridges=true. MASTER. cc_host=$MASTER. RABBITMQ. rabbit_host=$MASTER. Glance. Image. Service. MASTER: 9. 29. 2. Flat. DHCPManager. True. dhcpbridge_flagfile=/etc/nova/nova. Iptables. Firewall. Driver. public_interface=eth. FIXED_RANGE. multi_host=true. NOVNC CONSOLE. novnc_enabled=true. MASTER: 6. 08. 0/vnc_auto. MASTER. vncserver_listen=$MASTER. EOF设置目录权限chown - R nova: nova /etc/nova重启所有服务service rabbitmq- server restart. Stopping rabbitmq- server: rabbitmq- server. Stopping Open. Stack No. VNC proxy nova- novncproxy [ OK ]. Starting rabbitmq- server: SUCCESS. Starting Open. Stack No. VNC proxy nova- novncproxy [ OK ]. WARNING nova. utils [- ] /usr/lib/python. SADeprecation. Warning: The 'listeners' argument to Pool (and create_engine()) is deprecated. Use event. listen(). Pool.__init__(self, creator, **kw). WARNING nova. utils [- ] /usr/lib/python. SADeprecation. Warning: Pool. Use event. listen(). AUDIT nova. db. sqlalchemy.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
November 2017
Categories |