设为首页 收藏本站
查看: 1918|回复: 0

[经验分享] RedHat EL 6.4搭建LVS负载均衡

[复制链接]

尚未签到

发表于 2015-11-20 14:43:46 | 显示全部楼层 |阅读模式
  今天准备着手搭建lvs,从lvs的官网下载了1.26的tar.gz包

1.解压
  

tar xzvf ipvsadm-1.26.tar.gz
  
  



2.编译,安装
  

make & make install
  
  


  



3. 遇到的错误



这时候报错了  

make -C libipvs
make[1]: Entering directory `/root/ipvsadm-1.26/libipvs'
gcc -Wall -Wunused -Wstrict-prototypes -g -fPIC -DLIBIPVS_USE_NL  -DHAVE_NET_IP_VS_H -c -o libipvs.o libipvs.c
在包含自 libipvs.h:13 的文件中,
从 libipvs.c:23:
ip_vs.h:15:29: 错误:netlink/netlink.h:没有那个文件或目录
ip_vs.h:16:31: 错误:netlink/genl/genl.h:没有那个文件或目录
ip_vs.h:17:31: 错误:netlink/genl/ctrl.h:没有那个文件或目录
In file included from libipvs.h:13,
from libipvs.c:23:
ip_vs.h:520: 错误:数组元素的类型不完全
ip_vs.h:521: 错误:数组元素的类型不完全
ip_vs.h:522: 错误:数组元素的类型不完全
ip_vs.h:523: 错误:数组元素的类型不完全
ip_vs.h:524: 错误:数组元素的类型不完全
ip_vs.h:525: 错误:数组元素的类型不完全
libipvs.c: 在函数‘ipvs_nl_message’中:
libipvs.c:57: 警告:隐式声明函数‘nlmsg_alloc’
libipvs.c:57: 警告:赋值时将整数赋给指针,未作类型转换
libipvs.c:61: 警告:隐式声明函数‘genlmsg_put’
libipvs.c:61: 错误:‘NL_AUTO_PID’未声明(在此函数内第一次使用)
libipvs.c:61: 错误:(即使在一个函数内多次出现,每个未声明的标识符在其
libipvs.c:61: 错误:所在的函数内也只报告一次。)
libipvs.c:61: 错误:‘NL_AUTO_SEQ’未声明(在此函数内第一次使用)
libipvs.c: 在函数‘ipvs_nl_noop_cb’中:
libipvs.c:69: 错误:‘NL_OK’未声明(在此函数内第一次使用)
libipvs.c: 在文件层:
libipvs.c:72: 错误:expected declaration specifiers or ‘...’ before ‘nl_recvmsg_msg_cb_t’
libipvs.c: 在函数‘ipvs_nl_send_message’中:
libipvs.c:76: 警告:隐式声明函数‘nl_handle_alloc’
libipvs.c:76: 警告:赋值时将整数赋给指针,未作类型转换
libipvs.c:78: 警告:隐式声明函数‘nlmsg_free’
libipvs.c:82: 警告:隐式声明函数‘genl_connect’
libipvs.c:85: 警告:隐式声明函数‘genl_ctrl_resolve’
libipvs.c:91: 警告:隐式声明函数‘nl_handle_destroy’
libipvs.c:96: 警告:隐式声明函数‘nl_socket_modify_cb’
libipvs.c:96: 错误:‘NL_CB_VALID’未声明(在此函数内第一次使用)
libipvs.c:96: 错误:‘NL_CB_CUSTOM’未声明(在此函数内第一次使用)
libipvs.c:96: 错误:‘func’未声明(在此函数内第一次使用)
libipvs.c:99: 警告:隐式声明函数‘nl_send_auto_complete’
libipvs.c:102: 警告:隐式声明函数‘nl_recvmsgs_default’
libipvs.c: 在函数‘ipvs_init’中:
libipvs.c:127: 错误:提供给函数‘ipvs_nl_send_message’的实参太多
libipvs.c: 在函数‘ipvs_getinfo_parse_cb’中:
libipvs.c:149: 警告:隐式声明函数‘nlmsg_hdr’
libipvs.c:149: 警告:初始化时将整数赋给指针,未作类型转换
libipvs.c:152: 警告:隐式声明函数‘genlmsg_parse’
libipvs.c:159: 警告:隐式声明函数‘nla_get_u32’
libipvs.c:162: 错误:‘NL_OK’未声明(在此函数内第一次使用)
libipvs.c: 在函数‘ipvs_getinfo’中:
libipvs.c:176: 错误:提供给函数‘ipvs_nl_send_message’的实参太多
libipvs.c: 在函数‘ipvs_flush’中:
libipvs.c:199: 错误:提供给函数‘ipvs_nl_send_message’的实参太多
libipvs.c: 在函数‘ipvs_nl_fill_service_attr’中:
libipvs.c:215: 警告:隐式声明函数‘nla_nest_start’
libipvs.c:215: 警告:赋值时将整数赋给指针,未作类型转换
libipvs.c:219: 警告:隐式声明函数‘NLA_PUT_U16’
libipvs.c:222: 警告:隐式声明函数‘NLA_PUT_U32’
libipvs.c:225: 警告:隐式声明函数‘NLA_PUT’
libipvs.c:229: 警告:隐式声明函数‘NLA_PUT_STRING’
libipvs.c:236: 警告:隐式声明函数‘nla_nest_end’
libipvs.c:239: 警告:标号‘nla_put_failure’定义后未使用
libipvs.c: 在函数‘ipvs_add_service’中:
libipvs.c:255: 错误:提供给函数‘ipvs_nl_send_message’的实参太多
libipvs.c: 在函数‘ipvs_update_service’中:
libipvs.c:276: 错误:提供给函数‘ipvs_nl_send_message’的实参太多
libipvs.c: 在函数‘ipvs_del_service’中:
libipvs.c:296: 错误:提供给函数‘ipvs_nl_send_message’的实参太多
libipvs.c: 在函数‘ipvs_zero_service’中:
libipvs.c:321: 错误:提供给函数‘ipvs_nl_send_message’的实参太多
libipvs.c: 在函数‘ipvs_nl_fill_dest_attr’中:
libipvs.c:334: 警告:赋值时将整数赋给指针,未作类型转换
libipvs.c:348: 警告:标号‘nla_put_failure’定义后未使用
libipvs.c: 在函数‘ipvs_add_dest’中:
libipvs.c:366: 错误:提供给函数‘ipvs_nl_send_message’的实参太多
libipvs.c: 在函数‘ipvs_update_dest’中:
libipvs.c:396: 错误:提供给函数‘ipvs_nl_send_message’的实参太多
libipvs.c: 在函数‘ipvs_del_dest’中:
libipvs.c:425: 错误:提供给函数‘ipvs_nl_send_message’的实参太多
libipvs.c: 在函数‘ipvs_set_timeout’中:
libipvs.c:452: 错误:提供给函数‘ipvs_nl_send_message’的实参太多
libipvs.c:454: 警告:标号‘nla_put_failure’定义后未使用
libipvs.c: 在函数‘ipvs_start_daemon’中:
libipvs.c:473: 警告:赋值时将整数赋给指针,未作类型转换
libipvs.c:483: 错误:提供给函数‘ipvs_nl_send_message’的实参太多
libipvs.c: 在函数‘ipvs_stop_daemon’中:
libipvs.c:504: 警告:赋值时将整数赋给指针,未作类型转换
libipvs.c:514: 错误:提供给函数‘ipvs_nl_send_message’的实参太多
libipvs.c: 在文件层:
libipvs.c:526: 警告:‘struct nlattr’在形参表内部声明
libipvs.c: 在函数‘ipvs_parse_stats’中:
libipvs.c:530: 警告:隐式声明函数‘nla_parse_nested’
libipvs.c:548: 警告:隐式声明函数‘nla_get_u64’
libipvs.c: 在函数‘ipvs_services_parse_cb’中:
libipvs.c:562: 警告:初始化时将整数赋给指针,未作类型转换
libipvs.c:592: 警告:隐式声明函数‘nla_get_u16’
libipvs.c:598: 警告:隐式声明函数‘nla_data’
libipvs.c:599: 警告:传递‘memcpy’的第 2 个参数时将整数赋给指针,未作类型转换
/usr/include/string.h:44: 附注:需要类型‘const void * __restrict__’,但实参的类型为‘int’
libipvs.c:604: 警告:隐式声明函数‘nla_get_string’
libipvs.c:605: 警告:传递‘strncpy’的第 2 个参数时将整数赋给指针,未作类型转换
/usr/include/string.h:131: 附注:需要类型‘const char * __restrict__’,但实参的类型为‘int’
libipvs.c:610: 警告:传递‘strncpy’的第 2 个参数时将整数赋给指针,未作类型转换
/usr/include/string.h:131: 附注:需要类型‘const char * __restrict__’,但实参的类型为‘int’
libipvs.c:614: 警告:隐式声明函数‘nla_memcpy’
libipvs.c:618: 警告:传递‘ipvs_parse_stats’的第 2 个参数时在不兼容的指针类型间转换
libipvs.c:526: 附注:需要类型‘struct nlattr *’,但实参的类型为‘struct nlattr *’
libipvs.c: 在函数‘ipvs_get_services’中:
libipvs.c:649: 错误:‘NLM_F_DUMP’未声明(在此函数内第一次使用)
libipvs.c:650: 错误:提供给函数‘ipvs_nl_send_message’的实参太多
libipvs.c: 在函数‘ipvs_dests_parse_cb’中:
libipvs.c:728: 警告:初始化时将整数赋给指针,未作类型转换
libipvs.c:759: 警告:传递‘memcpy’的第 2 个参数时将整数赋给指针,未作类型转换
/usr/include/string.h:44: 附注:需要类型‘const void * __restrict__’,但实参的类型为‘int’
libipvs.c:771: 警告:传递‘ipvs_parse_stats’的第 2 个参数时在不兼容的指针类型间转换
libipvs.c:526: 附注:需要类型‘struct nlattr *’,但实参的类型为‘struct nlattr *’
libipvs.c: 在函数‘ipvs_get_dests’中:
libipvs.c:809: 错误:‘NLM_F_DUMP’未声明(在此函数内第一次使用)
libipvs.c:813: 警告:赋值时将整数赋给指针,未作类型转换
libipvs.c:829: 错误:提供给函数‘ipvs_nl_send_message’的实参太多
libipvs.c: 在函数‘ipvs_get_service’中:
libipvs.c:939: 错误:提供给函数‘ipvs_nl_send_message’的实参太多
libipvs.c: 在函数‘ipvs_timeout_parse_cb’中:
libipvs.c:972: 警告:初始化时将整数赋给指针,未作类型转换
libipvs.c:986: 错误:‘NL_OK’未声明(在此函数内第一次使用)
libipvs.c: 在函数‘ipvs_get_timeout’中:
libipvs.c:1005: 错误:提供给函数‘ipvs_nl_send_message’的实参太多
libipvs.c: 在函数‘ipvs_daemon_parse_cb’中:
libipvs.c:1023: 警告:初始化时将整数赋给指针,未作类型转换
libipvs.c:1048: 警告:传递‘strncpy’的第 2 个参数时将整数赋给指针,未作类型转换
/usr/include/string.h:131: 附注:需要类型‘const char * __restrict__’,但实参的类型为‘int’
libipvs.c:1051: 错误:‘NL_OK’未声明(在此函数内第一次使用)
libipvs.c: 在函数‘ipvs_get_daemon’中:
libipvs.c:1071: 错误:‘NLM_F_DUMP’未声明(在此函数内第一次使用)
libipvs.c:1072: 错误:提供给函数‘ipvs_nl_send_message’的实参太多
make[1]: *** [libipvs.o] 错误 1
make[1]: Leaving directory `/root/ipvsadm-1.26/libipvs'
make: *** [libs] 错误 2



太可怕了,baidu一下需要安装如下包  
  

[iyunv@localhost ~]# rpm -qa | grep popt
popt-1.13-7.el6.x86_64
popt-devel-1.13-7.el6.x86_64[iyunv@localhost ~]# rpm -qa | grep libnl
libnl-1.1-14.el6.x86_64
libnl-devel-1.1-14.el6.x86_64

安装完这些包还是报错啊  
  

make -C libipvs
make[1]: Entering directory `/root/ipvsadm-1.26/libipvs'
gcc -Wall -Wunused -Wstrict-prototypes -g -fPIC -DLIBIPVS_USE_NL  -DHAVE_NET_IP_VS_H -c -o libipvs.o libipvs.c
gcc -Wall -Wunused -Wstrict-prototypes -g -fPIC -DLIBIPVS_USE_NL  -DHAVE_NET_IP_VS_H -c -o ip_vs_nl_policy.o ip_vs_nl_policy.c
ar rv libipvs.a libipvs.o ip_vs_nl_policy.o
ar: creating libipvs.a
a - libipvs.o
a - ip_vs_nl_policy.o
gcc -shared -Wl,-soname,libipvs.so -o libipvs.so libipvs.o ip_vs_nl_policy.o
make[1]: Leaving directory `/root/ipvsadm-1.26/libipvs'
gcc -Wall -Wunused -Wstrict-prototypes -g  -DVERSION=\"1.26\" -DSCHEDULERS=\""rr|wrr|lc|wlc|lblc|lblcr|dh|sh|sed|nq"\" -DPE_LIST=\""sip"\"  -DHAVE_NET_IP_VS_H -c -o ipvsadm.o ipvsadm.c
ipvsadm.c: 在函数‘print_largenum’中:
ipvsadm.c:1383: 警告:域宽 的类型应该是‘int’,但实参 2 的类型为‘size_t’
gcc -Wall -Wunused -Wstrict-prototypes -g  -DVERSION=\"1.26\" -DSCHEDULERS=\""rr|wrr|lc|wlc|lblc|lblcr|dh|sh|sed|nq"\" -DPE_LIST=\""sip"\"  -DHAVE_NET_IP_VS_H -c -o config_stream.o config_stream.c
gcc -Wall -Wunused -Wstrict-prototypes -g  -DVERSION=\"1.26\" -DSCHEDULERS=\""rr|wrr|lc|wlc|lblc|lblcr|dh|sh|sed|nq"\" -DPE_LIST=\""sip"\"  -DHAVE_NET_IP_VS_H -c -o dynamic_array.o dynamic_array.c
gcc -Wall -Wunused -Wstrict-prototypes -g -o ipvsadm ipvsadm.o config_stream.o dynamic_array.o libipvs/libipvs.a  -lnl
ipvsadm.o: In function `parse_options':
/root/ipvsadm-1.26/ipvsadm.c:432: undefined reference to `poptGetContext'
/root/ipvsadm-1.26/ipvsadm.c:435: undefined reference to `poptGetNextOpt'
/root/ipvsadm-1.26/ipvsadm.c:660: undefined reference to `poptBadOption'
/root/ipvsadm-1.26/ipvsadm.c:502: undefined reference to `poptGetNextOpt'
/root/ipvsadm-1.26/ipvsadm.c:667: undefined reference to `poptStrerror'
/root/ipvsadm-1.26/ipvsadm.c:667: undefined reference to `poptBadOption'
/root/ipvsadm-1.26/ipvsadm.c:670: undefined reference to `poptFreeContext'
/root/ipvsadm-1.26/ipvsadm.c:677: undefined reference to `poptGetArg'
/root/ipvsadm-1.26/ipvsadm.c:678: undefined reference to `poptGetArg'
/root/ipvsadm-1.26/ipvsadm.c:679: undefined reference to `poptGetArg'
/root/ipvsadm-1.26/ipvsadm.c:690: undefined reference to `poptGetArg'
/root/ipvsadm-1.26/ipvsadm.c:693: undefined reference to `poptFreeContext'
collect2: ld 返回 1
make: *** [ipvsadm] 错误 1
  
  



还需要安装一个popt-static的包才可以  http://mirror.centos.org/centos/6/os/x86_64/Packages/popt-static-1.13-7.el6.x86_64.rpm
  

rpm -ivh popt-static-1.13-7.el6.x86_64.rpm


  
  这时候再编译安装
  

make && make install
  
  OK安装成功
  




  

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.iyunv.com/thread-141568-1-1.html 上篇帖子: 负载均衡LVS(DR模式)安装实战 下篇帖子: LVS集群之十种调度算法及负载均衡——理论
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表