Author Archives: fencatn

kubernetes中的deployment模拟failover

先写了个简单的应用部署,副本设置为5 [fencatn@k8s-master ~]$ cat nginx.yml — apiVersion: extensions/v1beta1 kind: Deployment metadata: name: nginx-deployment spec: replicas: 5 template: metadata: labels: app: web_server spec: containers: – name: nginx image: nginx:1.7.9 [fencatn@k8s-master ~]$ 然后开始部署应用 [fencatn@k8s-master ~]$ kubectl apply -f nginx.yml deployment.extensions/nginx-deployment configured [fencatn@k8s-master … Continue reading

Posted in kubernetes | Tagged | Leave a comment

zabbix可用微信报警脚本(基于微信企业版)

我隐去了一些认证信息,其余自行修改使用: #!/usr/bin/python # -*- coding: utf-8 -*- #Author:fencatn #Alert for wechat import requests import json import sys def Get_Token(Corpid,Secret): url = ‘https://qyapi.weixin.qq.com/cgi-bin/gettoken’ values = { “corpid”:隐藏, #企业Id,对应’CorpID’ “corpsecret”:隐藏 #新建应用对应’Secret’ } req = requests.post(url, params=values) data = json.loads(req.text) Token = data[“access_token”] … Continue reading

Posted in zabbix | Tagged | Leave a comment

jenkins脚本-jar包脚本

脚本1:(包名我隐去了) #! /bin.bash # by fencatn echo “Stopping SpringBoot Application” jarfile=file.jar #指定启动的配置文件是dev/test/pro export SPRING_PROFILES_ACTIVE=test pid=`ps -ef | grep $jarfile | grep -v grep | awk ‘{print $2}’` echo $pid echo “——–kill start————–” if [ -n “$pid” ] then echo “kill … Continue reading

Posted in jenkins | Tagged | Leave a comment

jenkins脚本-war包脚本

脚本1:(这个脚本路径被我处理了一下,用的时候自己修改下;start.sh 无非就是个启动tomcat的脚本) #!/bin/bash #deploy war to tomcat #by fencatn export JAVA_HOME=/usr/lib/jvm/java-11-openjdk-11.0.3.7-0.el7_6.x86_64 TOMCAT_PID=`/usr/sbin/lsof -n -P -t -i :8081` TOMCAT_DIR=”/usr/share/tomcat/webapps/” FILES=”files.war” DES_DIR=”/des_dir/” DES_URL=”des_url” BAK_DIR=”/data/backup/`date +%Y%m%d-%H%M`” [ -n “$TOMCAT_PID” ] && kill -9 $TOMCAT_PID cd $DES_DIR rm -rf $FILES mkdir -p $BAK_DIR;\cp -a … Continue reading

Posted in jenkins | Tagged | Leave a comment

感受docker build过程

这篇日志只是让你感受下制作镜像的过程,并不是详细介绍,后面有专门的文档来介绍制作镜像的各种办法。 docker build 命令用于使用 Dockerfile 创建镜像。 语法 docker build [OPTIONS] PATH | URL | – OPTIONS说明: –build-arg=[] :设置镜像创建时的变量; –cpu-shares :设置 cpu 使用权重; –cpu-period :限制 CPU CFS周期; –cpu-quota :限制 CPU CFS配额; –cpuset-cpus :指定使用的CPU id; –cpuset-mems :指定使用的内存 id; –disable-content-trust :忽略校验,默认开启; -f :指定要使用的Dockerfile路径; … Continue reading

Posted in Docker | Tagged | Leave a comment

ntp授时服务器列表(可用)

找到个好用的网站,自己去看 http://www.ntp.org.cn/index.php 国内节点可用cn.ntp.org.cn 阿里的自带有6个 ntp1.aliyun.com ntp2.aliyun.com ntp3.aliyun.com ntp4.aliyun.com ntp5.aliyun.com ntp6.aliyun.com ntp7.aliyun.com

Posted in NTP | Tagged | Leave a comment

docker基础镜像alpine

alpine是面向安全应用的轻量级linux发行版本,拖下来看一下 [root@localhost ~]# docker pull alpine Using default tag: latest latest: Pulling from library/alpine 921b31ab772b: Pull complete Digest: sha256:ca1c944a4f8486a153024d9965aafbe24f5723c1d5c02f4964c045a16d19dc54 Status: Downloaded newer image for alpine:latest [root@localhost ~]# docker images REPOSITORY TAG IMAGE ID CREATED SIZE alpine latest 4d90542f0623 2 weeks … Continue reading

Posted in Docker | Tagged | Leave a comment

docker查看镜像信息

这里我们用inspect来查看镜像的详细信息: [root@localhost ~]# docker inspect ubuntu:14.04 [ { “Id”: “sha256:2c5e00d77a67934d5e39493477f262b878f127b9c01b491f06d8f06f78819578”, “RepoTags”: [ “ubuntu:14.04” ], “RepoDigests”: [ “ubuntu@sha256:2f7c79927b346e436cc14c92bd4e5bd778c3bd7037f35bc639ac1589a7acfa90” ], “Parent”: “”, “Comment”: “”, “Created”: “2019-05-15T21:21:13.96007615Z”, “Container”: “0da171ebca7c967d1bc6e8bb0bc12658c5b2c8cc242c9c86f503dae0684a5cc7”, “ContainerConfig”: { “Hostname”: “0da171ebca7c”, “Domainname”: “”, “User”: “”, “AttachStdin”: false, “AttachStdout”: false, “AttachStderr”: false, … Continue reading

Posted in Docker | Tagged | Leave a comment

docker启动示范”hello world”

这个镜像很好说明了docker启动的完整过程,注意看对应的输出日志 [root@localhost ~]# docker run –rm hello-world Unable to find image ‘hello-world:latest’ locally latest: Pulling from library/hello-world 1b930d010525: Pull complete Digest: sha256:41a65640635299bab090f783209c1e3a3f11934cf7756b09cb2f1e02147c6ed8 Status: Downloaded newer image for hello-world:latest Hello from Docker! This message shows that your installation appears to be … Continue reading

Posted in Docker | Tagged | Leave a comment

docker diff/events命令

diff是用来比较容器和原镜像有什么区别,类似于git diff和status,这个直接用就行了,没太多好说的,比如刚才我们用docker cp复制了几份文件进入了ubuntu这个容器,看看有没有什么不同 [root@localhost ~]# docker diff ubuntu C /home A /home/rtest.txt A /home/rtest2.txt A /home/test.txt events是用来实时查看输出的,类似于tail -f ,所以你得重新打开个终端。比如,我们先start ubuntu_2,看看发生什么 [root@localhost ~]# docker ps -a CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES be9d5c6f2a25 ubuntu:14.04 “/bin/bash” 4 seconds ago Up … Continue reading

Posted in Docker | Tagged | Leave a comment