Category - IT技术

2017-07-19 21:25:48    1313
创建swarm cluster的时候报错:

WARNING: IPv4 forwarding is disabled. Networking will not work.
2016/05/20 09:15:35 Post https://discovery.hub.docker.com/v1/clusters: dial tcp: lookup discovery.hub.docker.com on 192.168.10.2:53: read udp 172.17.0.2:56087->192.168.10.2:53: i/o timeout


解决办法:
# vi /etc/sysctl.conf
或者
# vi /usr/lib/sysctl.d/00-system.conf
添加如下代码:
    net.ipv4.ip_forward=1

重启network服务
# systemctl restart network

查看是否修改成功
# sysctl net.ipv4.ip_forward

如果返回为“net.ipv4.ip_forward = 1”则表示成功了
 
 

 

by 刘迎光@萤火虫工作室
OpenBI交流群:495266201
MicroService 微服务交流群:217722918
mail: liuyg#liuyingguang.cn
博主首页(防止爬虫):http://blog.liuyingguang.cn
OpenBI问答社区:http://openbi.liuyingguang.cn/

linux Forwarding    2017-07-19 21:25:06    860
参考文章:http://blog.csdn.net/maeom/article/details/6033927

但是依据此文章中的操作,重启network服务以后,还是没有配置成功,解决办法


# vi /etc/sysctl.conf
或者
# vi /usr/lib/sysctl.d/00-system.conf
添加如下代码:
    net.ipv4.ip_forward=1

重启network服务
# systemctl restart network

查看是否修改成功
# sysctl net.ipv4.ip_forward

如果返回为“net.ipv4.ip_forward = 1”则表示成功了
 

 

by 刘迎光@萤火虫工作室 
OpenBI交流群:495266201 
MicroService 微服务交流群:217722918 
mail: liuyg#liuyingguang.cn 
博主首页(==防止爬虫==):http://blog.liuyingguang.cn

docker    2017-07-19 21:23:55    896
修改文件

# vi /usr/lib/systemd/system/docker.service

修改为如下方式
[Unit]
Description=Docker Application Container Engine
After=network.target docker.socket
Requires=docker.socket

[Service]
Type=notify
ExecStart=/usr/bin/docker daemon --tls=false -H unix:///var/run/docker.sock  -H tcp://0.0.0.0:2375
MountFlags=slave
LimitNOFILE=1048576
LimitNPROC=1048576
LimitCORE=infinity
TimeoutStartSec=0

[Install]
WantedBy=multi-user.target

重载配置文件:
    # systemctl daemon-reload

重启Docker
    # systemctl restart docker


 


 

by 刘迎光@萤火虫工作室
OpenBI交流群:495266201
MicroService 微服务交流群:217722918
mail: liuyg#liuyingguang.cn
博主首页(防止爬虫):http://blog.liuyingguang.cn
OpenBI问答社区:http://openbi.liuyingguang.cn/

java xwiki restful    2017-07-19 21:22:41    997

xwiki测试流程

  1. 测试页面
  1. public void normalTest()throws Exception, IOException{
  2. CloseableHttpClient httpclient = HttpClients.createDefault();
  3. JAXBContext context = JAXBContext.newInstance("org.xwiki.rest.model.jaxb");
  4. Unmarshaller unmarshaller = context.createUnmarshaller();
  5. HttpUriRequest httpPost = RequestBuilder.get()
  6. .setUri(new URI("http://172.16.200.220:8082/xwiki/rest/wikis/xwiki/spaces/Main/pages/WebHome"))
  7. .setHeader("Accept", "application/xml").build();
  8. CloseableHttpResponse response = httpclient.execute(httpPost);
  9. System.out.println(response.getEntity());
  10. HttpEntity responseEntity=response.getEntity();
  11. Page page = (Page) unmarshaller.unmarshal(responseEntity.getContent());
  12. System.out.println(new Gson().toJson(page));
  13. }
  1. 登录并获取session
  1. public void testLogin() throws Exception{
  2. CloseableHttpClient httpclient =
HttpClient java xml    2017-07-19 21:20:57    818


介绍:我现在有一个对象page,需要将page对象转换为xml格式并以binary方式传输到服务端
其中涉及到的技术点有:
1、对象转xml流
2、输出流转输入流
3、httpClient发送二进制流数据

POM文件依赖配置
	<dependencies>
		<dependency>
			<groupId>junit</groupId>
			<artifactId>junit</artifactId>
			<version>3.8.1</version>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>org.apache.httpcomponents</groupId>
			<artifactId>httpclient</artifactId>
			<version>4.5.2</version>
		</dependency>
		
		<dependency>
		  <groupId>org.apache.httpcomponents</groupId>
		  <artifactId>httpmime</artifactId>
		  <version>4.5.2</version>
		</dependency>
		<dependency>
			<groupId>commons-lang</groupId>
			<artifactId>commons-lang</artifactId>
			<version>2.4</version>
		</dependency>
		<dependency>
			<groupId>com.google.code.gson</groupId>
			<artifactId>gson</artifactId>
			<version>2.2.4</version>
			<type>jar</type>
			<scope>compile</scope>
		</dependency>
		<dependency>
			<groupId>org.xwiki.platform</groupId>
			<artifactId>xwiki-platform-rest-model</artifactId>
			<version>7
16/26