systemd

简单了解journalctl

女生的网名这么多〃 提交于 2019-11-29 08:22:57
journalctl 命令 journalctl是什么以及作用? journalctl 用来查询 systemd-journald 服务收集到的日志。 systemd-journald 服务是 systemd init 系统提供的收集系统日志的服务。 命令格式为: journalctl [OPTIONS…] [MATCHES…] journalctl 命令的路径为: /bin/journalctl 查看journalctl 帮助文档:journalctl --help 直接使用journalctl可以输出所有的日志记录,因为是所有的日志信息,所以价值不大,我们只是想要某个服务输出的日志信息。 systemd-journald 服务收集到的日志默认保存在 /run/log 目录中,重启系统会丢掉以前的日志信息。 如果日志需要永久保存,可以将日志保存到文件中。 方法一:创建目录 /var/log/journal,然后重启日志服务 systemd-journald.service。 方法二:修改配置文件 /etc/systemd/journald.conf,把 Storage=auto 改为 Storage=persistent,并取消注释,然后重启日志服务 systemd-journald.service。 方法一的详细操作 在 /var/log/ 下面创建名为 journal 的目录

k8s二进制安装

烂漫一生 提交于 2019-11-29 08:19:44
各节点安装 docker yum install -y yum-utils device-mapper-persistent-data lvm2 yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo yum install docker-ce -y cat << EOF > /etc/docker/daemon.json { "registry-mirrors": ["https://lvb4p7mn.mirror.aliyuncs.com"] } EOF systemctl start docker systemctl enable docker tls自签证书: mkdir ssl && cd ssl/ wget https://pkg.cfssl.org/R1.2/cfssl_linux-amd64 wget https://pkg.cfssl.org/R1.2/cfssljson_linux-amd64 wget https://pkg.cfssl.org/R1.2/cfssl-certinfo_linux-amd64 chmod +x cfssl_linux-amd64 cfssljson_linux-amd64 cfssl-certinfo_linux

How do I check if my local docker image is outdated, without pushing from somewhere else?

孤者浪人 提交于 2019-11-29 06:14:47
问题 I'm running a react app in a docker container, on a Coreos server. Let's say it's been pulled from dockerhub from https://hub.docker.com/r/myimages/myapp . Now I want to check periodically if the dockerhub image for the app container has been updated, to see if the image I'm running locally is behind. What would be the most efficient way to check if a local docker image is outdated compared to the remote image? All solutions I've found so far are bash scripts or external services that push on

5月24日任务MariaDB安装、Apache安装

亡梦爱人 提交于 2019-11-29 04:33:40
11.6 MariaDB安装 1. wget https://downloads.mariadb.com/MariaDB/mariadb-10.2.6/bintar-linux-glibc_214-x86_64/mariadb-10.2.6-linux-glibc_214-x86_64.tar.gz //下载MariaDB 2. tar -zvxf mariadb-10.2.6-linux-systemd-x86_64.tar.gz //解压文件 3. mv mariadb-10.2.6-linux-systemd-x86_64 /usr/local/mariadb //移动并改名mariadb 4. mkdir /data/mariadb //设置数据库目录 5. ./scripts/mysql_install_db --user=mysql --datadir=/data/mariadb //初始化数据库 6. cp my-small.cnf /usr/local/mariadb/my.cnf //拷贝配置文件,和mysql配置文件区分开 ,/etc/my.cnf 是mysql使用 7. cp mysql.server /etc/init.d/mariadb //拷贝启动脚本 8. 修改启动脚本 basedir=/usr/local/mariadb datadir=/data

centos7安装zabbix4.2

旧时模样 提交于 2019-11-29 03:04:40
附zabbixdocker镜像地址 https://hub.docker.com/u/zabbix/ zabbix官方文档 https://www.zabbix.com/cn/download 1、关闭防火墙和selinux # systemctl stop firewalld # vi /etc/selinux/config SELINUX=permissive # setenforce 0 [root@localhost ~]# systemctl is-active firewalld active [root@localhost ~]# [root@localhost ~]# systemctl stop firewalld [root@localhost ~]# [root@localhost ~]# getenforce Enforcing [root@localhost ~]# setenforce 0 [root@localhost ~]# [root@localhost ~]# vi /etc/selinux/config # This file controls the state of SELinux on the system. # SELINUX= can take one of these three values: # enforcing -

centos7下安装zabbix

旧时模样 提交于 2019-11-29 03:01:53
(1)环境 [root@localhost ~]# cat /etc/centos-release CentOS Linux release 7.4.1708 (Core) [zabbix@localhost ~]$ id uid=1000(zabbix) gid=1000(zabbix) 组=1000(zabbix) 环境=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 (2)安装 (2.1)安装源码库配置部署包。这个部署包包含了yum配置文件。 # sudo rpm -ivh http://repo.zabbix.com/zabbix/3.2/rhel/7/x86_64/zabbix-release-3.2-1.el7.noarch.rpm 获取http://repo.zabbix.com/zabbix/3.2/rhel/7/x86_64//zabbix-release-3.2-1.el7.noarch.rpm 警告:/var/tmp/rpm-tmp.xvLHq6: 头V4 RSA/SHA512 Signature, 密钥 ID a14fe591: NOKEY 准备中... ################################# [100%] 正在升级/安装... 1:zabbix-release-3.2

How to Pipe Output to a File When Running as a Systemd Service?

江枫思渺然 提交于 2019-11-29 02:15:03
问题 I'm having trouble piping the STDOUT & STDERR to a file when running a program as a systemd service. I've tried adding the following to the .service file: ExecStart=/apppath/appname > /filepath/filename 2>&1 But this doesn't work. The output is ending up in /var/log/messages and is viewable using journalctl but I'd like a separate file. I've also tried setting StdOutput=tty but can't find a way of redirecting this to a file. Any help would be appreciated. 回答1: systemd.service(5) says:

查看Linux内核版本

放肆的年华 提交于 2019-11-29 01:44:25
导读 您可能因多种原因需要确切知道GNU / Linux 操作系统上运行的内核版本。 也许您正在调试与硬件相关的问题,或者了解影响旧内核版本的新安全漏洞,并且您想知道您的内核是否易受攻击。 无论是什么原因,从 命令 行确定Linux内核版本都非常容易。 使用`uname` 命令 查看Linux内核版本 uname命令显示多个系统信息,包括Linux内核体系结构,名称版本和发行版。 要找出系统上正在运行的Linux内核版本,请输入以下命令: uname -srm 输出结果: Linux 3.10.0-957.12.2.el7.x86_64 x86_64 3 - 内核版本. 10 - 主修订版本. 0-957 - 次要修订版本. 12 - 补丁版本. 使用`hostnamectl`命令查看内核版本 hostnamectl 实用程序是systemd的一部分,用于查询和更改系统主机名。 它还显示Linux发行版和内核版本: hostnamectl Static hostname: CentOS 7.linuxrumen.com Icon name: computer-vm Chassis: vm Machine ID: 20c27040135a4d46b2d3d07180f37303 Boot ID: 2f495af0684e4adfb34f0366f2567460

How to log to journald (systemd) via Python?

笑着哭i 提交于 2019-11-29 01:30:46
I would like logging.info() to go to journald (systemd). Up to now I only found python modules which read journald (not what I want) or modules which work like this: journal.send('Hello world') python-systemd has a JournalHandler you can use with the logging framework. From the documentation: import logging from systemd.journal import JournalHandler log = logging.getLogger('demo') log.addHandler(JournalHandler()) log.setLevel(logging.INFO) log.info("sent to journal") An alternative to the official package, the systemd package works with python 3.6. Its source is also on github . The

30.监控io free ps 查看网络状态 抓包

。_饼干妹妹 提交于 2019-11-29 00:20:43
10.6 监控io性能 10.7 free命令 10.8 ps命令 10.9 查看网络状态 扩展tcp三次握手四次挥手 http://www.doc88.com/p-9913773324388.html 三次握手要查看,面试会被问到 tshark几个用法:http://www.aminglinux.com/bbs/thread-995-1-1.html 10.10 linux下抓包 10.6 监控io性能: 如果我们cpu和内存明明还有剩余,但是系统就是负载很高。用vmstat的查看发现b列或者wa列比较大。那是不是说明我们磁盘有瓶颈,那我们就要更详细的查看磁盘的状态 我们在安装sysstat的时候,就会安装上iostat这个命令。instat和sar属于同一个包 我们直接敲iostat就可以查看,或者敲instat 1(iostat 1 10)来查看读写,跟sar -b的结果差不多 我们需要掌握的是: ~1. iostat -x 1 主要查看 %util。他首先是一个百分比。 &util这一列表示你的io 等待,总之就是你这个磁盘使用有多少时间,就是说占用cpu的。那么我们这个cpu有一部分是给进程处理的、计算的。那也有一部分时间是要等待io的,等待磁盘读写,要把这个数据读出来,数据的读写也要等待的吧。那么这个时间比是多少。就是我等待你的时间比是多少,就是%util