解决方法:配置群集时# gem install redis 报错:Unable to require openssl, install OpenSSL and rebuild ruby
问题:
前面已经在/usr/local/src安装了ruby-2.3.0.tar.gz、rubygems-2.4.2.tar.gz。
在配置 redis-3.1.1 群集中,使用gem install 安装 ruby redis 接口时报:
- # [root@localhost src]# gem install redis --version 3.0.0
- # # 由于源的原因,可能下载失败,就手动下载下来安装
- [root@localhost src]# gem install /usr/local/src/redis-3.2.1.gem
- ERROR: While executing gem ... (Gem::Exception)
- Unable to require openssl, install OpenSSL and rebuild ruby (preferred) or use non-HTTPS sources
原因:
缺少openssl,需要安装openssl包,我现在这里来安装一个openssl-1.0.1s.tar.gz(下载链接:http://www.openssl.org/source/)
解决方法步骤:
1.解压在/usr/local/src目录下,进入/usr/local/src/openssl-1.0.1s目录准备安装:
- [root@localhost src]# tar -xzvf openssl-1.0.1s.tar.gz
- [root@localhost src]# cd openssl-1.0.1s
- [root@localhost openssl-1.0.1s]# ./config -fPIC --prefix=/usr/local/openssl enable-shared
- [root@localhost openssl-1.0.1s]# ./config -t
- [root@localhost openssl-1.0.1s]# make && make install
openssl的配置文件必须要配置-fPIC参数,如果没有该参数下面的安装中会出现问题!
安装完成,可以检测一下是否安装成功:
- [root@localhost openssl-1.0.1s]# openssl version
2.进入ruby源码[/usr/local/src/ruby-2.3.0]目录下的ext/openssl 目录:
- [root@localhost openssl-1.0.1s]# cd ../ruby-2.3.0
- [root@localhost ruby-2.3.0]# cd ext/openssl
- [root@localhost openssl]# ruby extconf.rb
- checking for t_open() in -lnsl... no
- checking for socket() in -lsocket... no
- checking for assert.h... yes
- checking for openssl/ssl.h... no
提示没有找到ssl.h, 因为出现了错误:openssl/ssl.h:没有那个文件或目录
- [root@localhost openssl]# ruby extconf.rb --with-openssl-include=/usr/local/openssl/include/ --with-openssl-lib=/usr/local/openssl/lib
- checking for t_open() in -lnsl... no
- checking for socket() in -lsocket... no
- checking for assert.h... yes
- checking for openssl/ssl.h... yes
- .............................................中间略.............................................
- checking for EVP_CTRL_GCM_GET_TAG in openssl/evp.h... yes
- creating extconf.h
- creating Makefile
成功。
3.接下来并且将ruby 源码目录下的include目录软链接到 / 目录下:
- [root@localhost openssl]# ln -s /usr/local/src/ruby-2.2.3/include /
接着再执行make,如果在配置openssl时没有-fPIC参数时就会出现如下错误
- [root@localhost openssl]# make
- gcc -shared -o openssl.so ossl_x509.o ossl_x509cert.o ossl_x509crl.o ossl_pkcs7.o ossl_cipher.o ossl_pkey_dh.o ossl_ssl_session.o ossl_x509attr.o ossl_x509ext.o ossl_ocsp.o ossl_asn1.o ossl_x509name.o ossl_x509revoked.o ossl_rand.o ossl_pkcs12.o ossl_x509store.o ossl_ssl.o ossl.o ossl_digest.o ossl_config.o ossl_pkcs5.o ossl_bio.o ossl_pkey_dsa.o ossl_pkey.o ossl_x509req.o ossl_pkey_ec.o ossl_hmac.o openssl_missing.o ossl_ns_spki.o ossl_pkey_rsa.o ossl_engine.o ossl_bn.o -L. -L/usr/local/ruby/lib -Wl,-R/usr/local/ruby/lib -L/usr/local/ssl/lib -Wl,-R/usr/local/ssl/lib -L. -rdynamic -Wl,-export-dynamic -lssl -lcrypto -lrt -ldl -lcrypt -lm -lc
- /usr/bin/ld: /usr/local/ssl/lib/libssl.a(s2_meth.o): relocation R_X86_64_32 against `a local symbol'
- can not be used when making a shared object; recompile with -fPIC
- /usr/local/ssl/lib/libssl.a: could not read symbols: Bad value
- collect2: ld returned 1 exit status
- make: *** [openssl.so] Error 1
有配置-fPIC参数时就继续走下去:
- [root@localhost openssl]# make
- compiling ossl_pkey_dsa.c
- compiling openssl_missing.c
- compiling ossl_x509name.c
- compiling ossl_pkey_rsa.c
- .............................................中间略.............................................
- compiling ossl_bn.c
- compiling ossl.c
- linking shared-object openssl.so
- [root@localhost openssl]# make install
- /usr/bin/install -c -m 0755 openssl.so /usr/local/ruby/lib/ruby/site_ruby/2.2.0/x86_64-linux
- installing default openssl libraries
成功。
4.回过头来,这时候我们已经把配置集群遇到的各种问题已经解决好了,再次使用gem install 安装 ruby redis 接口:
- # [root@localhost src]# gem install redis --version 3.0.0
- # # 由于源的原因,可能下载失败,就手动下载下来安装
- [root@localhost src]# gem install /usr/local/src/redis-3.2.1.gem
- Successfully installed redis-3.2.1
- Parsing documentation for redis-3.2.1
- Installing ri documentation for redis-3.2.1
- Done installing documentation for redis after 0 seconds
- WARNING: Unable to pull data from 'https://rubygems.org/': SSL_connect returned=1 errno=0 state=error: certificate verify failed (https://rubygems.org/specs.4.8.gz)
- 1 gem installed
可以看到这时ruby redis接口已经安装成功了;
当Redis也安装好,这时我们来做一个Redis集群测试,在一台服务器中创建了6个Redis实例,开启6个Redis服务。
- [root@localhost redis-cluster]# redis-trib.rb create --replicas 1 127.0.0.1:7001 127.0.0.1:7002 127.0.0.1:7003 127.0.0.1:7004 127.0.0.1:7005 127.0.0.1:7006
- >>> Creating cluster
- >>> Performing hash slots allocation on 6 nodes...
- Using 3 masters:
- 127.0.0.1:7001
- 127.0.0.1:7002
- 127.0.0.1:7003
- Adding replica 127.0.0.1:7004 to 127.0.0.1:7001
- Adding replica 127.0.0.1:7005 to 127.0.0.1:7002
- Adding replica 127.0.0.1:7006 to 127.0.0.1:7003
- M: e18c4d9b2a9c2b92b3695cb7236512bc3569349e 127.0.0.1:7001
- slots:0-5460 (5461 slots) master
- M: bfd2c5320bfa800713e18b8f57900fd63995d7cf 127.0.0.1:7002
- slots:5461-10922 (5462 slots) master
- M: 9d41b514413bcf348d55fe7239ce93b94fab7b01 127.0.0.1:7003
- slots:10923-16383 (5461 slots) master
- S: fef13f9a028d8a5de2442f562aa88941eb591ba5 127.0.0.1:7004
- replicates e18c4d9b2a9c2b92b3695cb7236512bc3569349e
- S: 7845903bdd01e2992877e27110bbbc7ff4036828 127.0.0.1:7005
- replicates bfd2c5320bfa800713e18b8f57900fd63995d7cf
- S: c0becb06b09e957fd34fad5ae85dec15d0b59cd8 127.0.0.1:7006
- replicates 9d41b514413bcf348d55fe7239ce93b94fab7b01
- Can I set the above configuration? (type 'yes' to accept): yes
- >>> Nodes configuration updated
- >>> Assign a different config epoch to each node
- >>> Sending CLUSTER MEET messages to join the cluster
- Waiting for the cluster to join.....
- >>> Performing Cluster Check (using node 127.0.0.1:7001)
- M: e18c4d9b2a9c2b92b3695cb7236512bc3569349e 127.0.0.1:7001
- slots:0-5460 (5461 slots) master
- M: bfd2c5320bfa800713e18b8f57900fd63995d7cf 127.0.0.1:7002
- slots:5461-10922 (5462 slots) master
- M: 9d41b514413bcf348d55fe7239ce93b94fab7b01 127.0.0.1:7003
- slots:10923-16383 (5461 slots) master
- M: fef13f9a028d8a5de2442f562aa88941eb591ba5 127.0.0.1:7004
- slots: (0 slots) master
- replicates e18c4d9b2a9c2b92b3695cb7236512bc3569349e
- M: 7845903bdd01e2992877e27110bbbc7ff4036828 127.0.0.1:7005
- slots: (0 slots) master
- replicates bfd2c5320bfa800713e18b8f57900fd63995d7cf
- M: c0becb06b09e957fd34fad5ae85dec15d0b59cd8 127.0.0.1:7006
- slots: (0 slots) master
- replicates 9d41b514413bcf348d55fe7239ce93b94fab7b01
- [OK] All nodes agree about slots configuration.
- >>> Check for open slots...
- >>> Check slots coverage...
- [OK] All 16384 slots covered.
- [root@localhost redis-cluster]# redis-trib.rb check
- [ERR] Wrong number of arguments for specified sub command
- [root@localhost redis-cluster]# redis-trib.rb check 127.0.0.1:7001
- >>> Performing Cluster Check (using node 127.0.0.1:7001)
- M: e18c4d9b2a9c2b92b3695cb7236512bc3569349e 127.0.0.1:7001
- slots:0-5460 (5461 slots) master
- 1 additional replica(s)
- S: c0becb06b09e957fd34fad5ae85dec15d0b59cd8 127.0.0.1:7006
- slots: (0 slots) slave
- replicates 9d41b514413bcf348d55fe7239ce93b94fab7b01
- S: fef13f9a028d8a5de2442f562aa88941eb591ba5 127.0.0.1:7004
- slots: (0 slots) slave
- replicates e18c4d9b2a9c2b92b3695cb7236512bc3569349e
- S: 7845903bdd01e2992877e27110bbbc7ff4036828 127.0.0.1:7005
- slots: (0 slots) slave
- replicates bfd2c5320bfa800713e18b8f57900fd63995d7cf
- M: bfd2c5320bfa800713e18b8f57900fd63995d7cf 127.0.0.1:7002
- slots:5461-10922 (5462 slots) master
- 1 additional replica(s)
- M: 9d41b514413bcf348d55fe7239ce93b94fab7b01 127.0.0.1:7003
- slots:10923-16383 (5461 slots) master
- 1 additional replica(s)
- [OK] All nodes agree about slots configuration.
- >>> Check for open slots...
- >>> Check slots coverage...
- [OK] All 16384 slots covered.
这样就表示我们的集群(三主三从)创建成功了!
主节点:127.0.0.1:7001 127.0.0.1:7002 127.0.0.1:7003
从节点:127.0.0.1:7004 127.0.0.1:7005 127.0.0.1:7006
解决方法:配置群集时# gem install redis 报错:Unable to require openssl, install OpenSSL and rebuild ruby的更多相关文章
- 安装Redis-cluster-gem install redis报错的解决方案
错误描述: [root@eshop-cache01 local]# gem install redis ERROR: Loading command: install (LoadError) cann ...
- mac brew install redis 报错
mac brew install redis 报错 /usr/local/opt/php55/bin/phpize /usr/local/opt/php55/bin/phpize: line 61: ...
- gem install redis报错解决
在执行gem install redis时 提示: gem install redis ERROR: Error installing redis: redis r ...
- pip install mysql-python报错1. Unable to find vcvarsall.bat 2 fatal error C1083: Cannot open include file: 'config-win.h': No such file or directory 3.error: command 'mt.exe' failed with exit statu
最近在安装mysql -python 时报错折腾了半天,通过以下方法解决: 1. pip install mysql-python报错 Unable to find vcvarsall.bat (参考 ...
- vue项目初始化时npm run dev报错webpack-dev-server解决方法
vue项目初始化时npm run dev报错webpack-dev-server解决方法 原因:这是新版webpack存在的BUG,卸载现有的新版本webpack,装老版本就好webpack-dev- ...
- C#编译器优化那点事 c# 如果一个对象的值为null,那么它调用扩展方法时为甚么不报错 webAPI 控制器(Controller)太多怎么办? .NET MVC项目设置包含Areas中的页面为默认启动页 (五)Net Core使用静态文件 学习ASP.NET Core Razor 编程系列八——并发处理
C#编译器优化那点事 使用C#编写程序,给最终用户的程序,是需要使用release配置的,而release配置和debug配置,有一个关键区别,就是release的编译器优化默认是启用的.优化代码 ...
- redis报错解决
1.Connecting to node 127.0.0.17000 [ERR] Sorry, can't connect to node 192.168.1.917000 redis集群:Conne ...
- 解决mvn clean install的报错The packaging for this project did not assign a file to the build artifact
解决mvn clean install的报错The packaging for this project did not assign a file to the build artifact
- redis报错Windows error 0x70(a large memory)
redis报错Windows error 0x70 redis 嫌弃你内存不够了,就给你不开第二个实例. The Windows version of Redis allocates a large ...
随机推荐
- apply-register-acl 参数允许FreeSWITCH分机注册/拨打不验证密码
今天调试 发现 注册的分机 的 `Auth-User` 居然是 `unknown` !!! 怎么回事? 仔细对比检查 发现, internal profile 指定了 `apply-register- ...
- openLDAP 2
一.安装OPENLDAP 二.打开安装目录中的文件 slapd.conf 三.安装完成后退出 编辑文本,输入以下内容,并命名为test.ldif dn: dc=company objectClass: ...
- Spring注解配置Aop
之前学习了SpringAop的基本原理.http://www.cnblogs.com/expiator/p/7977975.html 现在尝试使用注解来配置SpringAop. Aop,面向切面编程. ...
- SpringBoot Actuator & SpringBoot Admin
SpringBoot Actuator提供了很多监控和管理你的spring boot应用的HTTP或者JMX端点,并且你可以有选择地开启和关闭部分功能. 当你的spring boot应用中引入依赖之后 ...
- ubuntu18 tensorflow faster_rcnn cpu训练自己数据集
(flappbird) luo@luo-ThinkPad-W540:tf-faster-rcnn$ ./experiments/scripts/train_faster_rcnn.sh 0 pasca ...
- "分辨率"到底是个什么概念?它和DPI之间是什么关系?
"分辨率"到底是个什么概念?它和DPI之间是什么关系? 分辨率:显示分辨率(屏幕分辨率)是屏幕图像的精密度,是指显示器所能显示的像素有多少.由于屏幕上的点.线和面都是由像素组成的, ...
- ajax 整个表单的提交
重点:data: $("#form1").serialize() function setSaveNext() { setSaveData(); var cx = pageInde ...
- 如何查看HBase的HFile
记一个比较初级的笔记. ===流程=== 1. 创建一张表 2. 插入10条数据 3. 查看HFile ===操作=== 1.创建表 package api; import org.apache.ha ...
- Go 网络编程笔记
前言: 本文是学习<<go语言程序设计>> -- 清华大学出版社(王鹏 编著) 的2014年1月第一版 做的一些笔记 , 如有侵权, 请告知笔者, 将在24小时内删除, 转载请 ...
- python 数据清洗
前言 1. 删除重复 2. 异常值监测 3. 替换 4. 数据映射 5. 数值变量类型化 6. 创建哑变量 统计师的Python日记[第7天:数据清洗(1)] 前言 根据我的Python学习计划: N ...