Rootop 服务器运维与web架构

2014-06-20
发表者 Venus
uid 4294967295 (-1) is impossible to set on已关闭评论

uid 4294967295 (-1) is impossible to set on

C:\>C:\"Program Files (x86)\cwRsync\bin\rsync.exe" -vzrtopg --delete --no-super /cygdrive/f/www rsync://192.168.0.6:873/www
sending incremental file list
uid 4294967295 (-1) is impossible to set on "www/新建文本文档.txt" (in www)

sent 77 bytes received 12 bytes 59.33 bytes/sec
total size is 0 speedup is 0.00
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1052) [sender=3.0.8]

同步数据老提示错误 uid 4294967295 (-1) is impossible to set on  查资料说是软件bug··· 但是数据同步是不受到影响的。

解决方法:

在server端添加一行参数:

fake super = yes

重启rsync服务即可。再同步就不会出现错误信息了。

2014-06-19
发表者 Venus
Microsoft visual j# 2.0 second edition 安装程序返回错误代码 “1603”。已关闭评论

Microsoft visual j# 2.0 second edition 安装程序返回错误代码 “1603”。

安装vSphere Client出现报错:

Microsoft visual j# 2.0 second edition 安装程序返回错误代码 “1603”。

单独下载 vjredist 安装也是报错:

error 1406 无法将值写入注册表 \software\classes\interface\xxx

最后把安全软件关闭,重新安装,问题解决。原因是安全软件阻止了安装程序写入注册表的某些项目,导致报错。

 

2014-06-16
发表者 Venus
openvas修改界面显示时间(时区)已关闭评论

openvas修改界面显示时间(时区)

openvas默认使用UTC时间,也就是世界统一时间。这样可能对使用、生成报告会造成一些影响,所以需要修改为中国时间。

 修改方法:

点击 右上角 当前的 “用户名” ,可以看到 my setting 。点击,扳手 图标。

把timezone的值改为: Asia/Shanghai  往下拖动滚动条,点击 save my settings  即可。

这样时间就正确了。

PS:

原先以为只需改 UTC 为 CST  (中国标准时间)。结果发现不行,后来看openvas自带的文档说等于系统tz变量。tz就是timezone缩写,系统本身为 Asia/Shanghai 时区 ,就尝试修改为 Asia/Shanghai 。问题解决。

openvas对时区的解释:

Timezone

The format of the timezone is the same as that of the TZ environment variable on GNU/Linux systems. That is, the same value accepted by the tzset C function. There are three versions of the format. Note the lack of spaces in the examples.

2014-06-15
发表者 Venus
暂无评论

nginx配置负载均衡

后端服务器为2台iis,要通过nginx实现负载均衡功能。并实现健康监测。

1、定义upstream:
在nginx主配置文件http {} 段中配置如下:

upstream iis {
 ip_hash;
 server 192.168.1.11 max_fails=3 fail_timeout=20s;
 server 192.168.1.12 max_fails=3 fail_timeout=20s;
 }

ip_hash 通过ip_hash实现会话保持。
max_fails=3 请求失败次数,超过时返回proxy_next_upstream定义的错误。
fail_timeout 在max_fails失败时,停止服务的时间。

2、定义服务:

server {
 listen 80;
 server_name www.test.com;
 index index.html;

location / {
 proxy_pass http://iis;
 proxy_next_upstream http_500 http_502 http_503 error timeout invalid_header;
 include /usr/local/nginx/conf/proxy.conf;
 }
 }

proxy_next_upstream 当分发到会话的服务器出现500,502,503,504,超时错误时,转发到另一台,实现故障转移

3、编辑代理配置文件:/usr/local/nginx/conf/proxy.conf

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;
client_body_buffer_size 128k;
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;

proxy_set_header实现转发客户端ip到后端服务器。

当在内网环境测试时,会发现不管几台机器访问nginx负载均衡,会话总是分发到一台机器,除非那台机器宕机,会话才分发到第二台,后来查资料说:The key for the hash is the class-C network address of the client. 意思说来自同一网段的ip会话都会分发到一台机器。类似于网络地址hash了。而不是ip地址hash。

2014-06-14
发表者 Venus
暂无评论

XenServer图形界面安装CentOS

默认情况下,redhat/centos/SUSE之类的会使用xs自带的定制安装脚本,最小化安装,分区也是自动,这样很不方便。

在配置虚拟机的时候可以通过vnc方式安装。这样就出现图形界面,并且可以自定义分区,安装桌面等。

在配置虚拟机时,在 graphical utf8 后面加一个 vnc  参数 ,这样就可以启用vnc安装。

通过dhcp自动分配的ip。然后通过nvc客户端,直接连接192.168.0.139:0 即可。

或者切换上面的  switch to graphical console 切换到图形界面。