我的乐与怒

Life, thoughts, stories and ideas.

一些运维脚本

Yearning SQL审核平台 拉代码 git clone git@github.com:cookieY/Yearning.git 打包镜像 cd Yearning.git && docker build -t yearning . docker run -it --rm -e MYSQL_USER=root -e MYSQL_ADDR=172.17.0.1:3307 -e MYSQL_PASSWORD=root -e MYSQL_DB=yearning yearning /opt/Yearning install docker run --restart=always -d --name yearning -p 9001:8000 -e MYSQL_USER=root -e MYSQL_ADDR=172.17.0.1:3307 -e MYSQL_PASSWORD=root -e SECRET_KEY=mws1118888888888 -e MYSQL_DB=yearning yearning Docker #查询当前容器状态 docker stats --no-stream docker stats $(docker ps --format={{.Names}}) #只输出指定容器 docker stats --no-stream registry mysql #格式化输出结果 docker stats --format "table {{.Name}}\t{{.CPUPerc}}\t{{.MemUsage}}" 变量 说明 .Container 根据用户指定的名称显示容器的名称或 ID .Name 容器名称 .ID 容器 ID .CPUPerc CPU 使用

VUE项目读取Docker环境变量

使用场景 前端项目通常编译的时候会配置多个环境的参数,根据环境参数编译不同的文件.无法做到在各个环境使用同一个版本的镜像.使用环境变量可以在创建镜像的时候传递基础参数减少编译确保测试的有效性. 方案 通过将环境变量传递到DOM,在VUE项目中读取DOM来进行使用环境变量. 读取环境变量 const

Docker+Consul+Ngxin配置脚本

Docker #!/bin/sh sudo apt-get remove docker docker-engine docker.io sudo apt-get update sudo apt-get install \ apt-transport-https \ ca-certificates \ curl \ software-properties-common curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - sudo apt-key fingerprint 0EBFCD88 sudo add-apt-repository \ "deb [arch=amd64] https://download.docker.com/linux/ubuntu \ $(lsb_release -cs) \ stable" sudo apt-get update sudo apt-get -y install docker-ce apt-cache madison docker-ce sudo apt-get install docker-ce=<VERSION> NGINX server { listen 80 default_server; listen [::]:80 default_server ipv6only=on; root /usr/share/nginx/html; index index.html index.htm; server_name localhost; location / { proxy_pass http://127.0.0.1:8009; proxy_redirect off; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504; proxy_max_temp_file_size 0; proxy_connect_timeout 90; proxy_send_timeout 90; proxy_read_timeout 90; proxy_buffer_size 4k; proxy_buffers 4 32k; proxy_busy_buffers_size 64k; proxy_temp_file_write_size 64k; } } 容器 #mysql docker run \ --name mysql-primary \ -v /alidata/mysqldb:/var/lib/mysql \ -p 3306:3306 \ -e MYSQL_ROOT_PASSWORD=xxxx \ -e "SERVICE_NAME=mysql_promary"

使用Consul Docker微服务平台实践

基础环境 - CentOS6.6 内核升级 因为虚拟机的centos内核无法达到docker稳定运行,因此升级到3.1,执行 #导入key rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org #安装ELRepo到CentOS 6.6中 rpm -Uvh http://www.elrepo.org/elrepo-release-6-6.el6.elrepo.noarch.rpm #安装长期支持版本kernel yum --enablerepo=elrepo-kernel install kernel-lt -y #编辑grub.conf文件,修改Grub引导顺序,选择3.1版本的内容(一

安装生成环境的Swarm集群

参考 : https://docs.docker.com/swarm/install-manual/ 网络规划 规划如下 节点描述 名称 Swarm 主机和备份机 p4 , hdp1 Swarm 节点 hdp2,hdp3 发现后台 p4

dockerpool CA 证书错误

docker被墙后用,拉dockerpool的镜像会出现这个错误 > sudo docker pull dl.dockerpool.com:5000/centos:7 FATA[0000] Error response from daemon: v1 ping attempt failed with error: Get https://dl.dockerpool.com:5000/v1/_ping: tls: oversized record received with length 28012. If this private registry supports only HTTP or HTTPS with an unknown CA certificate, please add `--insecure-registry dl.dockerpool.com:5000` to the daemon's arguments. In the case of HTTPS, if you have access to the registry's CA certificate, no need for the flag; simply place the CA certificate at /etc/docker/certs.d/dl.dockerpool.com:5000/ca.crt 解决方法,在/etc/sysconfig/docker添加 INSECURE_REGISTRY='--insecure-registry dl.dockerpool.com:5000' 版本如下

使用Mesos和Docker构建你的私有云平台

安装

如果没有安装epel源先安装

yum install epel-release

先添加mesosphere源

sudo rpm -Uvh http://repos.mesosphere.io/el/7/noarch/RPMS/mesosphere-el-repo-7-1.noarch.rpm

安装mesos 以及运算框架marathon

yum install mesos 
yum install marathon 

安装zookeeper

yum install mesosphere-zookeeper

CentOS 6.5 docker 错误

Docker 在centos6.5中安装因为 device-mapper 不正确会报这个错 \n三 6月 10 16:46:56 CST 2015\n time="2015-06-10T16:46:56+08:00" level="info" msg="+job serveapi(unix:///var/run/docker.sock)" time="2015-06-10T16:46:56+08:00" level="info" msg="WARNING: You are running linux kernel version 2.6.32-431.el6.x86_64, which might be unstable running docker. Please upgrade your kernel to 3.8.0." time="2015-06-10T16:46:56+08:00" level="info" msg="Listening for HTTP on unix (/var/run/docker.sock)" /usr/bin/docker: relocation error: /usr/bin/docker: symbol dm_task_get_info_with_deferred_remove, version Base not defined in file libdevmapper.so.1.02 with link time reference 解决方法 sudo yum install device-mapper-event-libs sudo yum reinstall docker