systemd

第八次作业

拥有回忆 提交于 2019-11-29 18:40:42
1、systemd查看日志文件有隐藏该如何处理? systemd 日志的配置文件是 /etc/systemd/journald.conf 在默认情况下,systemd日志保存于/run/log/journal中,系统重启后会清除,这里面的日志文件是二进制形式保存的,不能直接用less等文本文件查看的方式查看内容。 journalctl 一个命令,查看所有日志(内核日志和应用日志) journalctl语法格式: journalctl [OPTIONS…] [MATCHES…] journalctl -o verbose [MATCHES....] 可显示全部字段,包括通常被内部隐藏的字段。 json-pretty 格式输出abrtd.service 的最后一条日志: [ root@benny~ ] #journalctl -u abrtd.service -n 1 --no-pager -o json-pretty { "__CURSOR" : "s=c2f466af2cbe4f26aec6f75f7b2e6bb5;i=7fe;b=9ccdf377d2b244059a1df0d872624443;m=a04209;t=5926c07ef7fb1;x=5828f5a008b0749" , "__REALTIME_TIMESTAMP" : "1568367570812849" , "_

ubuntu-18.04 设置开机启动脚本

旧街凉风 提交于 2019-11-29 17:07:33
https://www.jianshu.com/p/ba6d38ce9c1e ubuntu-16.10 开始不再使用initd管理系统,改用systemd systemd is now used for user sessions. System sessions had already been provided by systemd in previous Ubuntu releases. 快速看了 systemd 的使用方法,发现改动有点大, 包括用 systemctl 命令来替换了 service 和 chkconfig 的功能。 比如以前启动 mysql 服务用: sudo service mysql start 现在用: sudo systemctl start mysqld.service 其实这个改动到不是算大,主要是开机启动比以前复杂多了。systemd 默认读取 /etc/systemd/system 下的配置文件,该目录下的文件会链接/lib/systemd/system/下的文件。 执行 ls /lib/systemd/system 你可以看到有很多启动脚本,其中就有我们需要的 rc.local.service 打开脚本内容: # This file is part of systemd. # # systemd is free software; you

拓展 centos 7

♀尐吖头ヾ 提交于 2019-11-29 17:05:01
查看端口的占用情况 Centos6/contos7(ECS) 使用 netstat 查询系统上有多少TCP 多少UDP会话 netstat -tun -t: tcp -u: udp -a: all 表示列出所有的连接,服务监听,Socket资料 -n: port number 用数字的形式展示 -p: program显示哪个进程监听这个端口 -l :listening,列出当前处于监听状态的服务 contos7(Minimal) /contos7(ECS) 使用 命令 : ss ss 尤其是在有海量并发时, 效率更高 -t: tcp -u: udp 显示当前机器上有哪些端口提供服务 [root@139 bin]# ss -nlutp centos7特性 操作 centos6 centos7 文件系统 ext4 xfs 修改主机名 /etc/sysconfig/network /etc/hosthome 修改时区 /etc/sysconfig/clock timedatectl set-timezone Asia/Tokyo 查看ip信息 ifconfig ifconfig/ip(阿里ECS) 查看DNS信息 /etc/resolv.conf - 查看端口状态 netsat netsat/ss 核心服务 操作| centos6 | centos7 ---|------|--- 防火墙

linux_fedora nexus_auto_start

生来就可爱ヽ(ⅴ<●) 提交于 2019-11-29 15:57:40
fedora20发布,不对rc.local支持,其实只是删除了rc.local文件,如果想在开机时能够运行自己写的脚本,只要新建rc.local文件就可以了,下面让我们来测试下吧: 环境:fedora20 GNOME桌面 1./etc/rc.local其实是/etc/rc.d/rc.local的软连接,那么: vi /etc/rc.d/rc.local 1 #!/bin/ bash 2 #this is a script foe nexus start, if the nexus is startting,return. 3 echo " nexus verify.. " 4 testing8081=`(netstat -an| grep 8081 )` 5 if [ " NULL$testing8081 " = " NULL " ] ; then 6 echo " nuxus starting... " 7 /home/Jorcen/Environments/nexus/nexus- 2.7 . 0 - 04 /bin/ nexus start 8 else 9 echo -n " nexus had started,do you need restart it?(Y/N): " 10 read verify 11 if [ " $verify " = " Y " ] ;

Centos 7下Mongodb开机无法自启动的解决方法

余生颓废 提交于 2019-11-29 14:52:05
Centos 7下Mongodb开机无法自启动的解决方法 更新时间:2017年03月29日 09:34:59 作者:多客博图 我要评论 这篇文章主要介绍了Centos 7下Mongodb开机无法自启动的解决方法,文中介绍的非常详细,对大家具有一定的参考价值,需要的朋友们下面来一起看看吧。 前言 首先下载的mongodb有bug,需要自己手动fix,这种只是对特定版本有问题,并非所有版本都有这个问题, SeLinux 另外,一定要把selinux设置为disabled或者permissive 问题描述 ? 1 sudo systemctl status mongod.service 看到服务起不来,于是打开log文件: ? 1 cat /var/log/mongodb/mongod .log 有如下问题,是因为无法创建pid文件 ? 1 2 ***** SERVER RESTARTED ***** ERROR: Cannot write pid file to /var/run/mongodb/mongod .pid: No such file or directory Centos7系统每次会把/var/run下面的一些项目清理,所以下次重起来的时候就没有了这个文件了,现在的systemd启动的话,没有什么好办法处理这个文件,因为systemd启动就是执行一个命令: ? 1

ubuntu 16.04 安装 Jenkins

拥有回忆 提交于 2019-11-29 14:43:43
安装方法很简单: wget -q -O - https://pkg.jenkins.io/debian/jenkins.io.key | sudo apt-key add - sudo sh -c 'echo deb http://pkg.jenkins.io/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list' sudo apt-get update sudo apt-get install jenkins 如果在执行 sudo apt-get install jenkins 中出现如下报错: invoke-rc.d: initscript jenkins, action "start" failed. ● jenkins.service - LSB: Start Jenkins at boot time Loaded: loaded (/etc/init.d/jenkins; bad; vendor preset: enabled) Active: failed (Result: exit-code) since Wed 2019-01-30 22:39:31 PST; 14ms ago Docs: man:systemd-sysv-generator(8) Process: 13548 ExecStart=

systemctl

混江龙づ霸主 提交于 2019-11-29 10:13:50
一、常用命令 systemctl daemon-reload 刚刚配置的服务需要让systemctl能识别,就必须刷新配置 systemctl enable nginx.service 设置开机自启动 systemctl disable nginx.service 停止开机自启动 systemctl kill nginx.service 杀死服务 ---------- systemctl start nginx.service systemctl restart nginx.service systemctl stop nginx.service systemctl reload nginx.service systemctl status nginx.service ---------- ------------------------------------------------------------ 二、配置文件举例 systemctl cat nginx.service ---------- [Unit] Description=nginx After=network.target [Service] Type=forking ExecStart=/usr/local/nginx/sbin/nginx ExecReload=/usr/local/nginx/sbin

CentOS7 增加tomcat 启动,停止,使用systemctl进行配置

和自甴很熟 提交于 2019-11-29 09:16:03
1,centos7 使用 systemctl 替换了 service命令 参考:redhat文档: https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/System_Administrators_Guide/sect-Managing_Services_with_systemd-Services.html#sect-Managing_Services_with_systemd-Services-List 查看全部服务命令: systemctl list-unit-files --type service 查看服务 systemctl status name.service 启动服务 systemctl start name.service 停止服务 systemctl stop name.service 重启服务 systemctl restart name.service增加开机启动 systemctl enable name.service 删除开机启动 systemctl disable name.service 其中.service 可以省略。 2,tomcat增加启动参数 tomcat 需要增加一个pid文件 在tomca/bin 目录下面,增加 setenv.sh

9.6/9.7 awk(上、下)

一笑奈何 提交于 2019-11-29 09:07:16
9.6 awk命令(上) >awk是一种编程语言,用于在linux/unix下对文本和数据进行处理。数据可以来自标准输入(stdin)、一个或多个文件,或其它命令的输出。它支持用户自定义函数和动态正则表达式等先进功能,是linux/unix下的一个强大编程工具。它在命令行中使用,但更多是作为脚本来使用。awk有很多内建的功能,比如数组、函数等,这是它和C语言的相同之处,灵活性是awk最大的优势。 awk应用 awk打印指定内容 awk ‘{print $n}’ [filename] 在此n代表数字(当n=0时$0代表文件所有内容,当n=1,2,3...时$1,2,3...代表相应列) awk -F 指定分隔符(默认以空格为分隔符) [root@cham2 awk]# awk -F ':' '{print $1}' test.txt root bin daemon adm lp sync shutdown halt mail operator games ftp nobody systemd-bus-proxy systemd-network dbus polkitd tss postfix sshd chrony 可以一次打印多列 [root@cham2 awk]# awk -F ':' '{print $1,$2,$3}' test.txt root x 0 bin x 1

OpenStack(7)-cinder服务部署

拟墨画扇 提交于 2019-11-29 08:31:16
OpenStack Block Storage服务(Cinder)将持久存储添加到虚拟机。 块存储提供用于管理卷的基础结构,并与OpenStack Compute交互以为实例提供卷。 该服务还可以管理卷快照和卷类型。 块存储服务包含以下组件: cinderAPI 接受API请求,并将它们路由到 cinder-volume for操作。 cinder卷 直接与Block Storage服务以及诸如之后的进程交互 cinder-scheduler 。 它还通过消息队列与这些进程交互。 该 cinder-volume 服务响应发送到块存储服务的读写请求以维持状态。 它可以通过驱动程序体系结构与各种存储提供程序进行交互。 cinder-scheduler守护进程 选择要在其上创建卷的最佳存储提供程序节点。 一个类似的组成部分 nova-scheduler 。 cinder-backup守护进程 该 cinder-backup 服务为备份存储提供程序提供任何类型的备份卷。 与 cinder-volume 服务 一样 ,它可以通过驱动程序体系结构与各种存储提供程序进行交互。 消息队列 消息队列 在块存储进程之间路由信息。 我们需要在存储节点添加一块硬盘sdb 我们先配置控制节点 1.创建cinder数据库; mysql> CREATE DATABASE cinder; Query OK, 1