当前位置: 首页 > news >正文

【转】解决启动memcached启动时报”memcached:error while load...

2019独角兽企业重金招聘Python工程师标准>>> hot3.png

安装完memcached, 启动时报错如下: 

/usr/local/memcached/bin/memcached: error while loading shared libraries: libevent-1.4.so.2: cannot open shared object file: No such file or directory

首先确认是否已经安装了libevent库和libevent-devel库, Memcache用到了libevent这个库用于Socket的处理,所以需要安装libevent,默认是安装在 /usr/local/lib目录下的.

ls /usr/local/lib/libevent-1.4.so.2

执行如下的命令看看memcached去是到哪些目录查找libevent动态库的 : 

LD_DEBUG=libs /usr/local/memcached/bin/memcached -v
   29653:      find library=libevent-1.4.so.2 [0]; searching
     29653:      search cache=/etc/ld.so.cache
     29653:      search path=/lib64/tls/x86_64:/lib64/tls:/lib64/x86_64:/lib64:/usr/lib64/tls/x86_64:/usr/lib64/tls:/usr/lib64/x86_64:/usr/lib64             (system search path)
     29653:       trying file=/lib64/tls/x86_64/libevent-1.4.so.2
     29653:       trying file=/lib64/tls/libevent-1.4.so.2
     29653:       trying file=/lib64/x86_64/libevent-1.4.so.2
     29653:       trying file=/lib64/libevent-1.4.so.2
     29653:       trying file=/usr/lib64/tls/x86_64/libevent-1.4.so.2
     29653:       trying file=/usr/lib64/tls/libevent-1.4.so.2
     29653:       trying file=/usr/lib64/x86_64/libevent-1.4.so.2
     29653:       trying file=/usr/lib64/libevent-1.4.so.2
     29653:
/usr/local/memcached/bin/memcached: error while loading shared libraries: libevent-1.4.so.2: cannot open shared object file: No such file or directory

这里解释一下LD_DEBUG=libs的作用: 

LD_DEBUG=help ls
Valid options for the LD_DEBUG environment variable are:
 
  libs        display library search paths
  reloc       display relocation processing
  files       display progress for input file
  symbols     display symbol table processing
  bindings    display information about symbol binding
  versions    display version dependencies
  all         all previous options combined
  statistics  display relocation statistics
  unused      determined unused DSOs

  help        display this help message and exit

To direct the debugging output into a file instead of standard output

a filename can be specified using the LD_DEBUG_OUTPUT environment variable

现在我们得知memcached会在/lib64和/usr/lib64中查找动态库,所以我们只需在这两个目录下创建一个软连接指向libevent的libevent-1.4.so.2 即可

su root -c 'ln -s /usr/local/lib/libevent-1.4.so.2 /usr/lib64/libevent-1.4.so.2'

 

但如果无法获得root权限,那么只能重新安装memcached, 并且在执行./configure命令之前,先导出环境变量LD_RUN_PATH, 使其指向libevent的lib目录.  重装后的memcached就会到LD_RUN_PATH中查找dongtai

export LD_RUN_PATH='/PATH/TO/libevent/lib/'

转载:http://www.cnblogs.com/txwsqk/archive/2011/10/08/2201886.html

           http://hi.baidu.com/zer4tul/blog/item/b640a5189dbcc70d34fa4161.html

  

附memcached的常用启动参数:



 



-p 监听的端口
-l 连接的IP地址, 默认是本机
-d start 启动memcached服务
-d restart 重起memcached服务
-d stop|shutdown 关闭正在运行的memcached服务
-d install 安装memcached服务
-d uninstall 卸载memcached服务
-u 以的身份运行 (仅在以root运行的时候有效)
-m 最大内存使用,单位MB。默认64MB
-M 内存耗尽时返回错误,而不是删除项
-c 最大同时连接数,默认是1024
-f 块大小增长因子,默认是1.25-n 最小分配空间,key+value+flags默认是48
-h 显示帮助


转载于:https://my.oschina.net/aiguozhe/blog/67523

相关文章:

  • MySql跨服务器备份数据库
  • 语音提示倒计时小工具
  • Unicode
  • Cisco 路由器硬件信息查询命令
  • LaTeX空白距离
  • switch语句
  • 下了班----你干啥
  • 进位标志位
  • [转载]C++引用浅谈
  • 七月总结 八月安排
  • 如何实现一卡多号
  • java actor模型和消息传递简单示例
  • C语言--库文件
  • C# 4.0 新特性
  • 一花一世界--VMware Horizon 部署 Step by Step Part 1
  • JS 中的深拷贝与浅拷贝
  • [分享]iOS开发-关于在xcode中引用文件夹右边出现问号的解决办法
  • [译] React v16.8: 含有Hooks的版本
  • 《深入 React 技术栈》
  • 2017届校招提前批面试回顾
  • javascript面向对象之创建对象
  • laravel with 查询列表限制条数
  • Spring技术内幕笔记(2):Spring MVC 与 Web
  • SwizzleMethod 黑魔法
  • Wamp集成环境 添加PHP的新版本
  • 测试开发系类之接口自动化测试
  • 从setTimeout-setInterval看JS线程
  • 欢迎参加第二届中国游戏开发者大会
  • 入门到放弃node系列之Hello Word篇
  • 提升用户体验的利器——使用Vue-Occupy实现占位效果
  • 听说你叫Java(二)–Servlet请求
  • 一起来学SpringBoot | 第十篇:使用Spring Cache集成Redis
  • d²y/dx²; 偏导数问题 请问f1 f2是什么意思
  • Linux权限管理(week1_day5)--技术流ken
  • #define、const、typedef的差别
  • (10)ATF MMU转换表
  • (6)添加vue-cookie
  • (C#)Windows Shell 外壳编程系列9 - QueryInfo 扩展提示
  • (C语言)编写程序将一个4×4的数组进行顺时针旋转90度后输出。
  • (Matalb回归预测)PSO-BP粒子群算法优化BP神经网络的多维回归预测
  • (附源码)ssm考生评分系统 毕业设计 071114
  • (附源码)小程序儿童艺术培训机构教育管理小程序 毕业设计 201740
  • (十一)手动添加用户和文件的特殊权限
  • (四)库存超卖案例实战——优化redis分布式锁
  • (转)MVC3 类型“System.Web.Mvc.ModelClientValidationRule”同时存在
  • (转)shell中括号的特殊用法 linux if多条件判断
  • (轉貼) 寄發紅帖基本原則(教育部禮儀司頒布) (雜項)
  • .dwp和.webpart的区别
  • .NET 8.0 发布到 IIS
  • .NET C#版本和.NET版本以及VS版本的对应关系
  • .NET Core 网络数据采集 -- 使用AngleSharp做html解析
  • .NET Core工程编译事件$(TargetDir)变量为空引发的思考
  • .Net FrameWork总结
  • .NET gRPC 和RESTful简单对比
  • ??eclipse的安装配置问题!??