本文共 4169 字,大约阅读时间需要 13 分钟。
staragent 是什么?部署在 ECS 上的一个组件,两个主要功能:
主要的目录都统计出来,不重要的目录这里就不过介绍。
├── bin│ ├── agent.sh│ ├── agent_start_cmd.txt│ ├── dnsresolver│ ├── fakeStaragentctl7u│ ├── pluginctl│ ├── pluginplatform│ ├── post_install.sh│ ├── sa_healthCheck.sh│ ├── sa_install_lock.sh│ ├── sa_install.sh│ ├── sa_recovery.sh│ ├── staragent2│ ├── staragentctl│ ├── staragentctl7u│ ├── staragentd│ └── unzip |├── conf│ ├── channels.conf│ └── staragent.conf |├── log│ ├── dbscanner.log│ ├── dbscanner.log.20181118195157│ ├── staragent_channels.log│ ├── staragent_channels.log.20181116175937│ ├── staragent_core.log│ ├── staragent_core.log.20181111214336│ ├── staragent_core.log.20181117070750│ ├── staragent_ctl.log│ ├── staragent_master.log│ └── staragent_tasks.log└──
主要配置文件如下
1)/home/staragent/conf/staragent.conf,配置 staragent 注册的服务地址
{"Common": { "LogLevel" : "debug" //error,warn,info,debug },"Sub_Core": { "ConfServer":{ "ConfServer" : [ "http://staragent-edas.aliyuncs.com" //服务端域名 ] }}}
2)/home/staragent/conf/channels.conf 服务端的备份 IP
100.100.27.142 80100.100.36.55 80
/home/staragent/bin/staragent2 -e GetStatus------agent running ok------ StartTime : 2016-08-30 19:03:34 CST RegisterTime : 2016-08-30 19:03:44 CST ServiceTag : 94a2a7e7-5baa-4623-95f4-ef2f22741bff ServerConnected : 1 ServerAddr : 10.125.250.64:8000 LocalAddr : 10.101.94.148 Max Core count : 0 Total CPU Count : 2 Total CPU Rate : 1.01% Total MEM Rate : 12.85% Process CPU Rate : 0.00% Load Avg (1,5,15) : 6,4,5 Virtual Memory : 397MB Physical Memory : 11MB检查 1) ServerConnected 是否为 1 如果ServerConnected为1,表示已连接,agent已工作正常。
wget -q -O /root/install.sh http://edas-sz.oss-cn-shenzhen-internal.aliyuncs.com/install.sh && sh /root/install.sh -full -force
强制重新安装 agent 脚本,其中 sz 代表深圳,可以替换成你自己的 region 比如 hz 就是杭州。shenzhen 替换成你的 region ,其他的不用变。ECS 进行集群转移,报错 "issue config fail on ecu"
1)先看下要迁移的源 ECS 是否还在应用中,确认是已经摘除掉应用的才能进行迁移;
2)源机器的 VPC 和目标机器的 VPC 必须是同一个;
3)客户端上执行下 /home/staragent/bin/staragent2 -e GetStatus 看下 ServerConnected 的状态是否为 1 ,如果不为 1 说明 agent 的状态异常,可以重启下 agent /home/staragent/bin/agent.sh restart
4)执行 ps aux | grep -E "staragentd|staragent-core|staragent-ppf" | grep -v grep
如果进程一直起不来,说明 agent 本身就有问题。要手动执行脚本重装 agent ;5)第 3 步没有效果的话,再继续看下 /home/staragent/conf/ 目录下的配置文件 channels.conf staragent.conf;
"ConfServer" : [ "http://staragent-edas.aliyuncs.com" ]
[root@hanli-edas-01 plugins]# cat /home/staragent/conf/channels.conf 100.100.27.142 80100.100.36.55 80[root@hanli-edas-01 plugins]# ping -c 4 100.100.27.142PING 100.100.27.142 (100.100.27.142) 56(84) bytes of data.64 bytes from 100.100.27.142: icmp_seq=1 ttl=46 time=27.4 ms64 bytes from 100.100.27.142: icmp_seq=2 ttl=46 time=26.9 ms64 bytes from 100.100.27.142: icmp_seq=3 ttl=46 time=26.9 ms64 bytes from 100.100.27.142: icmp_seq=4 ttl=46 time=26.9 ms--- 100.100.27.142 ping statistics ---4 packets transmitted, 4 received, 0% packet loss, time 3004msrtt min/avg/max/mdev = 26.924/27.082/27.477/0.229 ms[root@hanli-edas-01 plugins]# telnet 100.100.27.142 80Trying 100.100.27.142...Connected to 100.100.27.142.Escape character is '^]'.^]Connection closed by foreign host.[root@hanli-edas-01 plugins]#
5)第 4 步还是解决不了的话就需要查看 agent 的异常日志的,进去我们上面说的日志目录,找到 staragent_core.log ,这个是 agent 的启动、上报健康状态、注册的核心日志。这里就用到之前说的 grep error 关键
排查到这里基本上我们就知道问题了,接下来我们再客户端上部署下 tcpdump 抓包,然后看下超时的原因:
5.1)nohup tcpdump -i <网卡出口> -s0 host staragent-edas.aliyuncs.com &
通过抓包发现客户端发去的 request 后服务端没有响应,这时大致可以判断了是 staragent 在服务端注册失败,这种情况我们重新执行下安装脚本即可解决这个问题。
转载地址:http://qaaql.baihongyu.com/