systemd

虚拟化:LXC, KVM

♀尐吖头ヾ 提交于 2019-12-07 16:42:59
一,虚拟化:LXC容器,KVM 1,相关概念 Container:容器,基于容器的虚拟化技术起源于所谓的资源容器和安全容器。 (linux:OpenVZ,linux-VServer,FreeVPS.非linux:Solaris Zones,BSD jails,CoreOS,Dejs,Dynos,Docker) LXC:linux Container. LXC开源项目(sourceforge):项目本身只是一个为用户提供一个用户空间的工具集,用来使用和管理LXC容器。 LXC真正的实现则是靠Linux内核的相关特性,LXC项目只是对此做了整合。 LXC由下列两个技术组成: 1,资源管理方面依赖于Linux内核的cgroups子系统,cgroups子系统是Linux内核提供的一个基于进程组的资源管理的框架, 可以为特定的进程组限定可以使用的资源。 2,LXC在隔离控制方面依赖于Linux内核的namespace特性,具体而言就是在clone时加入相应的flag(NEWNS NEWPID等等)。 2,LXC管理 用户空间两类管理工具集: liblxc,libvirt libvirt是Linux上的虚拟化库,是长期稳定的C语言API,支持KVM/QEMU、Xen、LXC等主流虚拟化方案。 2.1,liblxc工具集: 1,liblxc 工具包: yum install lxc (lxc

记录gentoo从openrc转移到systemd遇到的一些问题。

被刻印的时光 ゝ 提交于 2019-12-07 16:16:28
今天将gentoo从openrc转移到了systemd,详细过程就不说了,基本上都是按照wiki上的步骤进行的。还算比较顺利,一次性成功了,不过仍然遇到了一些小问题,在这里记录一下: 1. “systemd-journald Faile to set ACL”的问题 这个问题我也没高清楚,貌似是userid超出了systemd最大用ID的限制,具体请参照一篇 Arch论坛帖子 。我暂时采用了帖子中修改/etc/systemd/journald.conf文件的方法,修改内容如下: [Journal] Storage=none ForwardToSyslog=yes #ForwardToKMsg=no 没使用所以没有改 ForwardToConsole=no 修改完后重启服务,问题解决。 systemctl start systemd-journald 2. 在X中应用无法启动的问题 进入X后,启动了一个urxvt,之后再也不能启动任何应用程序。退出X以后发现屏幕输出提示“不能连接到Dispaly 0:0”,呃这真有点莫名奇妙了……之前好好的。 重新使用“Xorg -configure”生成新的xorg.conf文件后重启X,问题解决……。 3. 使用systemd以后,合上笔记本屏幕,电脑会进入休眠状态。 这让使用外接显示器的我非常尴尬,网上找了半天发现了解决方法,修改/etc

Docker as a builder, can't install systemd header files

笑着哭i 提交于 2019-12-07 14:32:44
问题 I'm trying to update a Docker image based on the official CentOS7 image. It is used as a builder for Node.js projects. I need to add the systemd-devel package for compiling some dependencies, but this fails with the following error: fakesystemd-1-17.el7.centos.noarch has installed conflicts systemd: fakesystemd-1-17.el7.centos.noarch Thanks 回答1: fakesystemd is a special package in the CentOS Docker image that satisfies the dependency to Systemd without actually installing Systemd (after all,

配置Kafka的Systemctl启动

五迷三道 提交于 2019-12-07 14:00:39
查看system ctl 方式配置 https://www.jianshu.com/p/7fd8b6ea336e systemctl list-unit-files --type=service|grep kafka kafka systemctl 启动方式命令 systemctl start kafka.service systemctl stop kafka.service systemctl start zookeeper.service systemctl stop zookeeper.service 操作步骤 1、修改KafkaStart.sh、zkStart.sh 、zkStop.sh、zkStart.sh,将相对路径改为绝对路径。 2、修改kafkaStart.sh。去掉JMXPORT属性,放到Kafka-Server-Start.sh 3、去掉KafkaStart.sh中的kafkamanager启动命令,单独启动。 4、配置开机启动 注:KafkaStart.sh、zkStart.sh 、zkStop.sh、zkStart.sh 为自己编写的快速启动脚本,主要是将原生命令做了次封装。 systemctl enable zookeeper systemctl enable kafka ● zookeeper.service - zookeeper Loaded:

centos7 Systemctl添加自动以服务启动文件

☆樱花仙子☆ 提交于 2019-12-07 13:03:15
Centos7利用Systemctl添加自定义服务文件 1.centos7的Systemctl启动服务的文件通常存放在:/etc/systemd/system 2.每一个服务文件都以.service结尾,文件内容主要分为三个部分 [Unit]#单元,主要用于对服务的简要说明 Description:描述 After:指在哪个服务后面启动,一般指网络服务后面启动-network.target [service]#服务,用于配置具体的服务启动关闭等相关参数信息 Type:forking 是后台运行的形式 PIDFile:是服务的pid文件路径。开启后,该服务配置文件必须配置pid文件路径。 ExecStart:启动命令 ExecReload:重启服务指令 ExecStop:停止服务指令 PrivateTmp:是否为服务分配独立的临时空间 [Install] WantedBy:这个 unit 本身是附挂在哪一个target unit下面的,一般来说大多的服务性质的 unit 都是附挂在 multi-user.target 下面! 3.编写好文件后,刷新配置让其生效:systemctl daemon-reload 如:以Ttomcat为例 cat >/etc/systemd/system/tomcat.service<<EOF [Unit] Description=Math_Tomcat

Docker 配置国内源加速镜像下载

天涯浪子 提交于 2019-12-07 09:00:41
导读 由于网络原因,我们在pull Image 的时候,从Docker Hub上下载会很慢,所以可以使用国内的镜像(mirror)来加速,方便大家使用。 配置阿里云加速器 1. 登录阿里开发者平台 https://promotion.aliyun.com/ntms/act/kubernetes.html#industry 2. 点击“镜像搜索” 自动跳转到控制台的镜像搜索 3. 注册/登录后 进入Docker 镜像仓库 (https://cr.console.aliyun.com/#/imageList),选中加速器 Tab 这里可以看到,系统已经为我们生成了一个专属加速器地址:https://xxxxx.mirror.aliyuncs.com 4. 根据个人需要 选择运行Docker 的OS,按照要求修改Docker配置文件,我这里的OS是 CentOS ,, 所以步骤如下: 修改配制文件 : vim usr/lib/systemd/system/docker.service 添加红色部分到 "mirror"后面 ExecStart=/usr/bin/dockerd --registry-mirror=your accelerate address 保存文件,重新加载配制:$ systemctl daemon-reload 重新启动服务:$ service docker

java: inconsistent watchdog timeout in systemd-notify

独自空忆成欢 提交于 2019-12-07 05:15:26
问题 My java application gets installed onto on OpenSUSE 13.2 OS, and I'm using systemd for process control. (systemd version 210) I would like to take advantage of the systemd watchdog functionality using systemd-notify. However, I notice the app restarting due to inconsistent timeouts from the watchdog. With WatchdogSec=120, and the app configured to call systemd-notify every 60 seconds, I observe restarts every five to 20 minutes, on average. here is the (slightly redacted) systemd unit file

Unit文件编写,编写服务脚本

删除回忆录丶 提交于 2019-12-07 04:31:19
Unit文件编写参考链接: https://www.freedesktop.org/software/systemd/man/systemd.service.html Unit基础介绍 Unit文件可以从多个位置加载,常见位置如下(优先级 低—>高 ): /usr/local/lib/systemd/system/ :软件包安装后的unit /etc/systemd/system/ :系统管理员安装的unit 备注: ·systemd 单元名仅能包含 ASCII 字符,下划线和点号和有特殊意义的字符('@', '-')。其它字符需要用 C-style "\x2d" 替换。 ·当 systemd 运行在用户模式下时,使用的加载路径是完全不同的。 · 以 # 开头的注释可能也能用在 unit-files 中,但是只能在新行中使用,在systemd的参数后面使用行末注释,则 unit 将会启动失败。 查看加载的位置 # systemctl show --property=UnitPath Unit中的依赖关系处理 使用 systemd 时,可通过正确编写单元配置文件来解决其依赖关系。典型的情况是,单元 A 要求单元 B 在 A 启动之前运行。在此情况下,向单元 A 配置文件中的 [Unit] 段添加 Requires=B 和 After=B 即可。若此依赖关系是可选的,可添加 Wants

Unit文件编写,编写服务脚本

∥☆過路亽.° 提交于 2019-12-07 04:23:59
Unit文件编写参考链接: https://www.freedesktop.org/software/systemd/man/systemd.service.html Unit基础介绍 Unit文件可以从多个位置加载,常见位置如下(优先级 低—>高 ): /usr/local/lib/systemd/system/ :软件包安装后的unit /etc/systemd/system/ :系统管理员安装的unit 备注: ·systemd 单元名仅能包含 ASCII 字符,下划线和点号和有特殊意义的字符('@', '-')。其它字符需要用 C-style "\x2d" 替换。 ·当 systemd 运行在用户模式下时,使用的加载路径是完全不同的。 · 以 # 开头的注释可能也能用在 unit-files 中,但是只能在新行中使用,在systemd的参数后面使用行末注释,则 unit 将会启动失败。 查看加载的位置 # systemctl show --property=UnitPath Unit中的依赖关系处理 使用 systemd 时,可通过正确编写单元配置文件来解决其依赖关系。典型的情况是,单元 A 要求单元 B 在 A 启动之前运行。在此情况下,向单元 A 配置文件中的 [Unit] 段添加 Requires=B 和 After=B 即可。若此依赖关系是可选的,可添加 Wants

How do I build a Spring Boot jarfile that systemd can execute directly as a service?

南笙酒味 提交于 2019-12-07 03:46:17
问题 How do I build a Spring Boot jarfile that systemd can directly execute as a service? Following the example in Installation as a systemd service, I created the following systemd service that directly executes a Spring Boot jarfile : [Unit] Description=CRS Self-certification Service Documentation= Requires=postgresql.service After=postgresql.service [Service] Environment=LOADER_PATH='lib/,config/,/etc/opes/crs/selfcertification' ExecStart=/opt/opes/crs/selfcertification/crs-selfcertification-1