https://jingyan.baidu.com/article/d169e18662aa60436611d8c1.html
saltstack pillar 维护
默认情况下,pillar信息是维护在文件中的,虽然方便,如果要自动化的话,就不太方便,如果能存到数据库会方便维护一些。
相关salt模块:https://docs.saltstack.com/en/latest/ref/pillar/all/index.html
将pillar信息存入mysql:
https://docs.saltstack.com/en/latest/ref/pillar/all/salt.pillar.mysql.html
其实,还有现成的模块可以将pillar信息存储mongodb、ldap、redis等
https://docs.saltstack.com/en/latest/ref/pillar/all/salt.pillar.pillar_ldap.html
https://docs.saltstack.com/en/latest/ref/pillar/all/salt.pillar.redismod.html
https://docs.saltstack.com/en/latest/ref/pillar/all/salt.pillar.postgres.html
https://docs.saltstack.com/en/latest/ref/pillar/all/salt.pillar.git_pillar.html
持续构建之maven + Jenkins + Nexus
一般来讲,maven deploy时要部署到Nexus,需要在pom.xml 中添加如下类似的东东:
1 2 3 4 5 6 7 8 9 10 11 12 |
<distributionManagement> <repository> <id>releases</id> <name>Nexus Release Repository</name> <url>http://nexus.phpor.net/nexus/content/repositories/releases/</url> </repository> <snapshotRepository> <id>snapshots</id> <name>Nexus Snapshot Repository</name> <url>http://nexus.phpor.net/nexus/content/repositories/snapshots/</url> </snapshotRepository> </distributionManagement> |
如此的话,该pom.xml 就不便于分享,还有人喜欢deploy到自己的Nexus呢;
其实,还可以在mvn deploy 时通过参数的方式来指定,如:
1 |
mvn deploy -D altDeploymentRepository=snapshots::default::http://nexus.phpor.net/nexus/content/repositories/snapshots/ |
这样的话,不管snapshot还是release都会deploy到相同位置; 正确的姿势为分别设置snapshot和release的位置,如下:
1 2 |
mvn deploy -D altSnapshotDeploymentRepository=snapshots::default::http://nexus.phpor.net/nexus/content/repositories/snapshots/ -D altReleaseDeploymentRepository=releases::default::http://nexus.phpor.net/nexus/content/repositories/releases/ |
参考:https://maven.apache.org/plugins/maven-deploy-plugin/deploy-mojo.html
docker swarm 模式下证书过期后daemon无法启动
报错信息:
1 |
Error creating cluster component: error while loading TLS Certificate |
相关文章: https://github.com/moby/moby/issues/24132
解决办法: 把 Docker Root Dir (通过docker info查看)下的swarm目录删掉就好了
xfire 代理设置
xfire 可以通过如下方式设置代理:
1 2 |
client.setProperty(CommonsHttpMessageSender.HTTP_PROXY_HOST, httpProxyHost); client.setProperty(CommonsHttpMessageSender.HTTP_PROXY_PORT, httpProxyPort); |
需要注意的是,该代理配置并不作用于下载wsdl
java问题
java 用很多内存,占用全部的cpu:
1 2 3 4 5 6 7 8 9 |
{Heap before GC invocations=3629 (full 101): PSYoungGen total 699392K, used 350208K [0x0000000780000000, 0x00000007c0000000, 0x00000007c0000000) eden space 350208K, 100% used [0x0000000780000000,0x0000000795600000,0x0000000795600000) from space 349184K, 0% used [0x00000007aab00000,0x00000007aab00000,0x00000007c0000000) to space 349184K, 0% used [0x0000000795600000,0x0000000795600000,0x00000007aab00000) ParOldGen total 2097152K, used 2097081K [0x0000000700000000, 0x0000000780000000, 0x0000000780000000) object space 2097152K, 99% used [0x0000000700000000,0x000000077ffee728,0x0000000780000000) Metaspace used 69136K, capacity 72006K, committed 73560K, reserved 1114112K class space used 7517K, capacity 8088K, committed 8320K, reserved 1048576K |
golang 中的只读变量
示例:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
// Copyright 2011 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package proxy import ( "net" ) type direct struct{} // Direct is a direct proxy: one that makes network connections directly. var Direct = direct{} func (direct) Dial(network, addr string) (net.Conn, error) { return net.Dial(network, addr) } |
上面是 golang.org/x/net/proxy/direct.go 里面的代码
- 我们显然是可以在proxy包外访问到Direct变量的
- 我们显然是无法在proxy包外new 一个 direct 结构变量的
- 由于2,而且我们无法改变Direct的变量类型,所以,我们做不到给Direct进行重新赋值
Mac 上给网卡添加多个ip地址
示例:
1 |
sudo ifconfig lo0 127.0.0.2/32 alias |
关键是: alias
sproxy开发体验
曾经为了让所有服务不允许随便访问公网,要访问公网则必须走代理,于是就需要一个非常NB的代理,能应对各种复杂的需求,于是自己写了一个sproxy(Supper Proxy),支持http 隧道代理、https隧道代理、sni代理。
现在,为了一些特殊的需要,需要在代理之后再转发到一个socket5代理,这样就可以与所有的socket5代理(比如: shadowsocks)实现对接,查了一下资料,其实,修改非常简单,我可以只修改两行代码就能搞定,借助golang.org/x/net/proxy 中的socket5代理,至于如何配置是否走代理,简单通过设置环境变量来实现了,如:
1 |
all_proxy=socks5://127.0.0.1:1080 |
尽管只有两行代码,还是学到了不少东西:
- 想让mac上的IDE调试那个需要listen 443的程序,默认IDE不是root启动的,没有权限listen 1024以下的端口,于是通过查资料发现,可以通过端口重定向实现,让需要调试的程序listen 1443, 通过 (http://www.cnblogs.com/fullstack-yang/p/6223960.html ) 提到的方法将443的数据包重定向到 1443, 相关参考: http://www.cnblogs.com/fullstack-yang/p/6224050.html
- socks5不仅可以支持ip地址,还支持域名,可以在socks5之前解析域名,也可以在socks5之后解析域名;原本程序是在socks5之前解析域名的,程序偶尔会调试不通,因为socks5之前通过 114.114.114.114 解析到的 www.google.com 的ip地址是被篡改过的,有时候是Twitter的,有时候是facebook的,还有不知道是谁家的,这种情况就需要把解析域名的事情放到socks5之后做了
- 关于域名被篡改的情况,还可以通过dnscrypt-proxy 来解决,只是,这个需要部署dnscrypt-server,不过也有很多公开的dnscrypt-server,稍微麻烦一些,没尝试
- 或许可以有一种dns-proxy,可以把dns请求转发到socket5,也是挺好的,注意: golang.org/x/net/proxy 中的socks5尚不支持udp (https://github.com/better0332/myproxy/blob/master/proxy/socks5.go) 这里有人实现过,不过star好少
- 也可以自己实现一个dns-server
- 单步调试golang时,提示找不到lldb-server, 解决办法:
1xcode-select --install
h3c 交换机之dns proxy
h3c s5560可以开启dns proxy功能,该功能不仅proxy,还cache查询的结果,而且cache的ttl并无法设置,也没有提高操作cache的方法,查看cache的域名信息:
1 |
> display dns host |
未解: 并非所有代理过的域名都会被cache的,难道只有解析速度慢到一定程度的才被cache?