systemd

Linux 面试最常问的十个问题

这一生的挚爱 提交于 2020-07-27 01:13:31
如果你要去面试一个Linux系统运维工程师的职位,下面这十个最常见的问题一定要会,否则你的面试可能就危险了。这些都是比较基本的问题,大家要理解,不能光死记硬背。 1、如何查看系统内核的版本 这里有两种方法: 1) uname -a uname 这个命令是用来打印系统信息的, -a 可以打印系统所有信息,其中包含内核版本,比如我的版本号是3.10.0-957.21.3.el7.X86_64。 2) cat /proc/version 下面再补充一下各个数字和字母代表的含义: 3 表示主版本号,有结构性变化才更改 (最新的是5) 10 表示次版本号,新增功能才会变化,一般基数表示测试版,偶数表示稳定版。2020年3月30日,Linus Torvalds 发布了最新的 Linux 内核版本为 5.6 0 表示对次版本的修订次数或补丁包数 957 代表编译的次数,每次编译可对少数程序优化或修改 el7 用来表示版本的特殊信息,有较大的随意性;el 代表企业版,pp代表测试版,fc代表 Fedora core,rc代表候选版本 X86_64 表示64位 2、如何查看系统当前的 IP 地址 也有两种方法: 1)ifconfig -a ifconfig 是用来配置网络接口的命令,-a 可以显示当前所有的接口。 2)ip addr show 3、如何查看磁盘还有多少剩余空间 这里主要可以用 df

跟着炎炎盐实践k8s---Kubernetes 1.16.10 二进制高可用集群部署之通用配置

元气小坏坏 提交于 2020-07-24 15:02:12
文档将介绍如何使用二进制部署Kubernetes v1.16高可用集群,而不是使用自动化部署(kubeadm)集群。在部署过程中,将详细列出各个组件启动参数,以及相关配置说明。部署完成后,将理解k8s各个组件的交互原理,并且可以快速解决实际问题。 * 环境及组件版本 Centos7.2 Kubernetes v1.16.10 Docker 18.09 .01(需要和k8s版本匹配) Etcd 3.3.13 Flanneld 0.12.0 一、 环境准备 服务器准备 master节点 10.13.33.29 master-01 10.13.33.40 master-02 10.13.33.38 master-03 node节点 10.13.33.31 node-01 修改主机名 为对应服务器设置永久主机名 cat >> /etc/hosts <<EOF 10.13.33.29 master-01 10.13.33.40 master-02 10.13.33.38 master-03 10.13.33.31 node-01 EOF hostnamectl set-hostname master-01 #所有机器按照要求修改 bash #刷新主机名 更新PATH变量 k8s所有文件和配置都会存储在/opt/k8s/ 中,运行以下命令,配置环境变量 echo 'PATH=/opt/k8s

Unit service is not loaded properly: Exec format error. on ubuntu18.04 creating .net service

扶醉桌前 提交于 2020-07-02 03:12:14
问题 I am trying to create a service to run by .net application on ubuntu 18.04. cd /lib/systemd/system/YellowPages.service [Unit] Description = Yellow pages .NET service [Service] Type=forking WorkingDirectory=/home ExecStart=dotnet /home/yp_app/YellowPages.dll [Install] WantedBy=multi-user.target ~ I have my application on /home/yp_app. when I run:systemd start YellowPages.service I get Excess arguments. so I tried with: systemctl start YellowPages.service I get Failed to start YellowPages

Python subprocess, realtime print with COLORS and save stdout

∥☆過路亽.° 提交于 2020-05-29 08:57:48
问题 Printing the output of a subprocess while saving the result is not a new problem, and has been answered many times before e.g.: https://stackoverflow.com/a/28319191/5506400 This does not work for me because I am trying to maintain the shell colours printed. E.g. when one goes systemctl status application , its prints running in green. The above-mentioned methods all rely on reading a line one by one from subprocess, but it seems to me by them the colour information is stripped off and lost. I

Python subprocess, realtime print with COLORS and save stdout

醉酒当歌 提交于 2020-05-29 08:57:35
问题 Printing the output of a subprocess while saving the result is not a new problem, and has been answered many times before e.g.: https://stackoverflow.com/a/28319191/5506400 This does not work for me because I am trying to maintain the shell colours printed. E.g. when one goes systemctl status application , its prints running in green. The above-mentioned methods all rely on reading a line one by one from subprocess, but it seems to me by them the colour information is stripped off and lost. I

Python subprocess, realtime print with COLORS and save stdout

自闭症网瘾萝莉.ら 提交于 2020-05-29 08:56:50
问题 Printing the output of a subprocess while saving the result is not a new problem, and has been answered many times before e.g.: https://stackoverflow.com/a/28319191/5506400 This does not work for me because I am trying to maintain the shell colours printed. E.g. when one goes systemctl status application , its prints running in green. The above-mentioned methods all rely on reading a line one by one from subprocess, but it seems to me by them the colour information is stripped off and lost. I

Linux自定义服务文件编写

◇◆丶佛笑我妖孽 提交于 2020-05-09 16:21:39
参考文章: 服务的依赖关系查看 https://www.pianshen.com/article/9810282044/ Linux服务文件手册 https://www.freedesktop.org/software/systemd/man/systemd.service.html linux systemd.service说明: https://blog.csdn.net/guozhongwei1/article/details/100561551 来源: oschina 链接: https://my.oschina.net/u/4263894/blog/4272085

【转载】MySQL版本升级之5.6到5.7

◇◆丶佛笑我妖孽 提交于 2020-05-08 20:03:03
文一 两种升级方式 In-Place Upgrade : Involves shutting down the old MySQL version, replacing the old MySQL binaries or packages with the new ones, restarting MySQL on the existing data directory, and running mysql_upgrade . Logical Upgrade : Involves exporting existing data from the old MySQL version using mysqldump , installing the new MySQL version, loading the dump file into the new MySQL version, and running mysql_upgrade . 升级实践(采用in-place方式) #关闭快速关闭服务选项,防止关闭服务后有脏页未刷进磁盘,升级后表格式变化无法进行recovery mysql -u root -p123456 -S /tmp/mysql_3306.sock -e "SET GLOBAL innodb_fast_shutdown=0" #关闭MySQL服务 mysqld

Centos7服务器搭建VNC Server环境

孤街浪徒 提交于 2020-05-08 20:00:15
在企业级项目的开发中,尤其是分布式项目,经常直接在服务器上进行开发工作,操作系统环境一般是Centos 7。普遍状况是,在服务器上安装IDE 开发工具,通过 Xshell等工具远程启动,本地通过虚拟桌面打开IDE,使用体验是非常差的,IDE 卡顿严重,及其影响开发体验。 解决方案:在Centos服务器上安装VNC(virtual network computing) Server。 参考书可见:鸟哥的linux私房菜-服务器架设篇 VNC Server会在服务端启动一个监听用户要求的端口,端口号一般在5901-5910之间。(大概就是说,最多开10个虚拟桌面) ## CentOS安装VNC # 可参考https://linux.cn/article-5335-1.html yum -y install @x11 @gnome tigervnc-server yum -y remove gnome-initial-setup #取消GNOME引导设置程序 yum -y remove PackageKit #取消YUM源后台自动更新 systemctl set-default graphical #设置默认启动runlevel 5 systemctl isolate graphical.target #启动runlevel5 systemctl enable vncserver@:1

(转载)消息队列(mq)是什么?

ぐ巨炮叔叔 提交于 2020-05-08 19:35:52
链接: https://www.zhihu.com/question/54152397 一、什么是消息队列? 消息队列不知道大家看到这个词的时候,会不会觉得它是一个比较 高端 的技术,反正我是觉得它好像是挺牛逼的。 消息队列,一般我们会简称它为MQ(Message Queue),嗯,就是很直白的简写。 我们先不管消息(Message)这个词,来看看队列(Queue)。这一看,队列大家应该都熟悉吧。 队列是一种 先进先出 的数据结构。 在Java里边,已经实现了不少的队列了: 那为什么还需要消息队列(MQ)这种 中间件 呢???其实这个问题,跟之前我学Redis的时候很像。Redis是一个以 key-value 形式存储的内存数据库,明明我们可以使用类似HashMap这种实现类就可以达到类似的效果了,那还为什么要Redis?《 Redis合集 》 到这里,大家可以先猜猜为什么要用消息队列(MQ)这种 中间件 ,下面会继续补充。 消息队列可以简单理解为: 把要传输的数据放在队列中 。 科普: 把数据放到消息队列叫做 生产者 从消息队列里边取数据叫做 消费者 二、为什么要用消息队列? 为什么要用消息队列,也就是在问:用了消息队列有什么好处。我们看看以下的场景 2.1 解耦 现在我有一个系统A,系统A可以产生一个 userId 然后,现在有系统B和系统C都需要这个 userId