Ansible配置: ansible有两个核心配置文件: ansible.cfg 配置文件和Inventory配置文件 Ansible.cfg配置文件 Inventory机器列表配置 这里介绍Inventory配置文件. Inventory file: Inventory file 机器清单,ansible用于管理机器节点的配置文件,类似系统的/etc/hosts文件. 默认的配置文件为:/etc/ansible/hosts (新版本默认的Inventory文件好像是 /home/ansible…
Patterns 是定义Ansible要管理的主机.但是在playbook中它指的是对应主机应用特定的配置或IT流程. 命令格式 命令行 ansible <host-pattern> [options] playbook 中 - hosts: <host-pattern> 使用示例 ansible \* -m service -a "name=httpd state=restarted" Patterns 使用 匹配所有的主机 all * # 命令行中使用 \进…
sudo(superuser or another do)让普通用户可以以超级管理员或其他人的身份执行命令. sudo基本流程如下: 1.管理员需要先授权(修改/etc/sudoers文件) 2.普通用户以sudo的形式执行命令 3.可以通过sudo -l 查看授权情况 修改/etc/sudoers的方法如下: 1.visudo(带语法检查,默认没有颜色提示) 2.vim /etc/sudoers(不带语法检查,默认有颜色提示) 授权格式: 用户或组 主机列表=(提权身份) [NOPASSWD]…
Go Concurrency Patterns: Timing out, moving on  GO并发模式: 超时, 继续前进 23 September 2010 Concurrent programming has its own idioms. A good example is timeouts. Although Go's channels do not support them directly, they are easy to implement. Say we want to…
非正常关闭vi编辑器时会生成一个.swp文件 非正常关闭vi编辑器时会生成一个.swp文件 关于swp文件 使用vi,经常可以看到swp这个文件,那这个文件是怎么产生的呢,当你打开一个文件,vi就会生成这么一个.(filename)swp文件以备不测(不测下面讨论),如果你正常退出,那么这个这个swp文件将会自动删除.下面说不测. 不测分为:1当你用多个程序编辑同一个文件时.          2非常规退出时. 第一种情况的话,为了避免同一个文件产生两个不同的版本(vim中的原话),还是建议选择…
目录 · Strategy · When to use the Strategy Design Pattern? · Sample Code · Observer · When to use the Observer Design Pattern? · Sample Code · Command · What is the Command Design Pattern? · Benefits of the Command Design Pattern. · Sample Code · Templ…
首先看一下概念 Little-Endian 就是低位字节排放在内存的低地址端,高位字节排放在内存的高地址端 Big-Endian 就是高位字节排放在内存的低地址端,低位字节排放在内存的高地址端. 第一种方式,在 C++ 程序运行期间判断并转换 #include <algorithm> // std::reverse // 判断和转换都在函数内部进行 template <typename T> T LittleEndianToNative(const T x) { ; char *p…
一.检查机器是否安装gcc.unzip.wget 二.部署模式 #模式1: 将所有主从节点以及sentinel节点部署在同一台机器上 #模式2: 将一个数据节点和一个sentinel节点部署在一台机器上,如master+sentinel1,slave1+sentinel2 #模式3: 将所有节点分开部署 三.一键部署脚本 1.在/root/test/目录下创建目录7001 7002 7003 7004 7005 7006 以及env ##7001~7006目录用来存放redis的配置文件redi…
目录 · 概述 · Factory · What is the Factory Design Pattern? · Sample Code · Abstract Factory · What is the Abstract Factory Design Pattern? · What can you do with an Abstract Factory Design Pattern? · Sample Code · Singleton · What is the Singleton Desig…