为什么virtualbox网卡桥接模式下在宿主机上看不到网桥?
virtualbox在后台启动了一个进程,很牛B,能从指定的网卡读取数据和写入数据,如此,就可以做到将某个虚拟机要发送出去的数据写入到指定网卡,而且网卡上收到的传给某个虚拟机(IP)的数据转发给指定虚拟机; 就这么简单。
参考: http://superuser.com/questions/594550/how-does-bridged-networking-work-in-virtualbox
DevOps
为什么virtualbox网卡桥接模式下在宿主机上看不到网桥?
virtualbox在后台启动了一个进程,很牛B,能从指定的网卡读取数据和写入数据,如此,就可以做到将某个虚拟机要发送出去的数据写入到指定网卡,而且网卡上收到的传给某个虚拟机(IP)的数据转发给指定虚拟机; 就这么简单。
参考: http://superuser.com/questions/594550/how-does-bridged-networking-work-in-virtualbox
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
listen-address=172.16.10.4 # If you want dnsmasq to provide only DNS service on an interface, # configure it as shown above, and then use the following line to # disable DHCP on it. #no-dhcp-interface= # On systems which support it, dnsmasq binds the wildcard address, # even when it is listening on only some interfaces. It then discards # requests that it shouldn't reply to. This has the advantage of # working even when interfaces come and go and change address. If you # want dnsmasq to really bind only the interfaces it is listening on, # uncomment this option. About the only time you may need this is when # running another nameserver on the same machine. bind-interfaces |
在做一个yum源镜像的时候,遇到一个错误: cobbler reposync –only centos-7-aliyun-x86_64-epel
Error: xz compression not available
解决办法:
yum install pyliblzma
PHP中默认的sessionid为PHPSESSID;
当然,也可以通过
string session_name ([ string $name
] )
来修改, 官方说明:
name
The session name references the name of the session, which is used in cookies and URLs (e.g. PHPSESSID). It should contain only alphanumeric characters; it should be short and descriptive (i.e. for users with enabled cookie warnings). If name
is specified, the name of the current session is changed to its value.
疑问: 只能包含字母和数字?
参考源码:
脚本:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
<?php $pid = posix_getpid(); $host = '10.10.11.123'; $port = '6379'; $auth = 'thepassword'; $total = $slow = $fail = 0; $arr = array(); $t_start = microtime(1); for($i = 0; $i < $argv[1]; $i++) { $total++; $time_start = microtime(1); $r = new Redis(); $r->connect($host, $port, 1); $r->auth($auth); $r->select(3); $key = "test_${pid}_$i"; $val = "data_$i"; $r->set($key, $val); $v = $r->get($key); if ($v !== $val) { $fail++;continue; } $r->del($key); $time_end = microtime(1); $time_use = 1000 * ($time_end - $time_start); if ($time_use < 3) { @$arr["<3"]++; } else if ($time_use < 10) { @$arr["<10"]++; } else if ($time_use < 14) { @$arr["<14"]++; } else if ($time_use < 20) { @$arr["<20"]++; } else if ($time_use < 50) { @$arr["<50"]++; } else if ($time_use > 100) { @$arr[">100"]++; } } $t_end = microtime(1); echo "total: $total\t"; echo "fail: $fail\n"; echo "time use: ". (($t_end - $t_start) * 100) ."ms\n"; ksort($arr); printf("%4s: %6s %s(%%)\n", "ms", "count", "percent"); foreach($arr as $k=>$v) { printf("%4s: %6d %.2f%%\n", $k, $v, $v/$total*100); } |
阿里云的1G标准的redis,当同时40个这样的PHP进程压测的话,会有8个进程最终出现select时 1s 超时异常; 但是人家给的指标是支持 300并发的
在使用rsyslog的时候,一般来讲,如果消息中含有换行符的话,这条消息会以换行符为分隔,视为多条消息;即: rsyslog协议是基于行处理的,而且,默认单个消息大小为2k(rsyslogd v5),rsyslogd v8默认单个消息大小为8k。
问题: 一般来讲,程序出错时的堆栈信息都是多行的,这种情况该如何处理呢?
办法1: 先将堆栈信息中的换行替换成其它字符
办法2: 其实rsyslog是可以支持换行的,只是不是想换就换的,在structure data中可以小心地换行
关于syslog协议有两个rfc:
其中:
rfc3164 定义的syslog协议是比较原始的用法,不支持消息的换行
rfc5424 是所谓的version为1的syslog协议,支持 structure data;就是这个structure data中是可以包含换行的; 当然,要严格遵照定义的格式的哦
两种协议格式解析的golang实现: https://github.com/jeromer/syslogparser
rsyslog (rsyslog-8.17.0)源码学习:
翻译下:
mode=0 单行模式,遇到回车算做消息结束
mode=1 空行分隔模式,遇到空行算作消息结束(就是相邻消息之间要已空行分隔)
mode=2 非空开头模式, 只要下一行空白(应该也包含tab吧)开头就算作上个消息的一部分,不视为新消息
不幸的是,目前发现只有imfile模块才支持这三种模式之间的选择,更不幸的时,imfile模块使用inotify配置时,mode=2有bug(我测试时不是有bug,是根本不能用)
我们是这么使用rsyslog的:
app —-通过/dev/log写入—-> 本地rsyslogd ——–tcp转发(DA Queue)——> 集中日志收集rsyslogd
其中: DA Queue就是如果远程rsyslogd出现问题了,就暂存到本地(先内存后磁盘)
小朋友说配置了DA Queue了,但是一次远程rsyslogd的几个小时的中断过后,日志没能暂存到app端;配置如下:
1 2 3 4 5 6 7 8 9 10 11 12 |
$ActionQueueType LinkedList $ActionQueueFileName da_queue $ActionQueueMaxFileSize 100M # 设置单个disk文件的大小 $ActionQueueMaxDiskSpace 10G # 设置最大占用空间 $ActionQueueDisacdSeverity 3 # 设置忽略的等级 $ActionQueueLowWaterMark 5000 # 默认是2000 $ActionQueueHighWatermark 15000 # 默认是8000 $ActionQueueDiscardMark 30000 # 默认是9750 $ActionQueueSize 80000 # 文档没写,测试发现默认是1000 $ActionQueueSaveOnShutdown on user.* @@log-center.xxx.com:514 local6.* @@log-center.xxx.com:514 |
其实,我们只是使用了local6,我们也只想转发local6的日志到远程rsyslogd;但是,小朋友就是画蛇添足多写了 user.* 这行, 问题就出现在这行;说明: ActionQueue的配置是针对紧挨着的那个转发的配置的,一个ActionQueue的配置不能同时应用到多个转发的配置的。
https://us-east.repo.webtatic.com/yum/el6/x86_64/RPMS/
https://us-east.repo.webtatic.com/yum/el7/x86_64/RPMS/
在mac上,beyond compare默认没有安装命令行,需要通过如下方式安装命令行:
其中,命令行有两个命令,如下:
/usr/local/bin/bcomp:
Launches comparison and waits for it to complete.
/usr/local/bin/bcompare:
Launches comparison and returns immediately.
配置diff工具和配置merge工具几乎没有太大差别,这里以diff为例
首先,看看git支持哪些diff工具:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
$ git difftool --tool-help 'git difftool --tool=<tool>' may be set to one of the following: bc bc3 emerge opendiff vimdiff vimdiff2 vimdiff3 The following tools are valid, but not currently available: araxis codecompare deltawalker diffmerge diffuse ecmerge gvimdiff gvimdiff2 gvimdiff3 kdiff3 kompare meld p4merge tkdiff xxdiff Some of the tools listed above only work in a windowed environment. If run in a terminal-only session, they will fail. |
其中:
配置方法, git difftool –help
ldap有几个slap* 命令,与ldap* 命令不同的是,前者直接操作库文件,不涉及密码问题。
导出:
1 |
/usr/sbin/slapcat > /opt/ldap/ldapdbak.ldif |
导入:
1 |
slapadd -l /opt/ldap/ldapdbak.ldif |
注意: 导入时,slapd不能是启动状态,至少使用bdb存储时如此,因为slapd启动后会对数据文件加锁;毕竟slapadd也不是通过slapd写入文件的,所以slapd没必要启动
参考资料:
http://www.361way.com/openldap-bak-imp-move/2366.html
http://www.cnblogs.com/ccdc/p/3356518.html