array(2) { ["docs"]=> array(10) { [0]=> array(10) { ["id"]=> string(3) "428" ["text"]=> string(77) "Visual Studio 2017 单独启动MSDN帮助(Microsoft Help Viewer)的方法" ["intro"]=> string(288) "目录 ECharts 异步加载 ECharts 数据可视化在过去几年中取得了巨大进展。开发人员对可视化产品的期望不再是简单的图表创建工具,而是在交互、性能、数据处理等方面有更高的要求。 chart.setOption({ color: [ " ["username"]=> string(8) "DonetRen" ["tagsname"]=> string(55) "Visual Studio 2017|MSDN帮助|C#程序|.NET|Help Viewer" ["tagsid"]=> string(23) "[401,402,403,"300",404]" ["catesname"]=> string(0) "" ["catesid"]=> string(2) "[]" ["createtime"]=> string(10) "1511400964" ["_id"]=> string(3) "428" } [1]=> array(10) { ["id"]=> string(3) "427" ["text"]=> string(42) "npm -v;报错 cannot find module "wrapp"" ["intro"]=> string(288) "目录 ECharts 异步加载 ECharts 数据可视化在过去几年中取得了巨大进展。开发人员对可视化产品的期望不再是简单的图表创建工具,而是在交互、性能、数据处理等方面有更高的要求。 chart.setOption({ color: [ " ["username"]=> string(4) "zzty" ["tagsname"]=> string(50) "node.js|npm|cannot find module "wrapp“|node" ["tagsid"]=> string(19) "[398,"239",399,400]" ["catesname"]=> string(0) "" ["catesid"]=> string(2) "[]" ["createtime"]=> string(10) "1511400760" ["_id"]=> string(3) "427" } [2]=> array(10) { ["id"]=> string(3) "426" ["text"]=> string(54) "说说css中pt、px、em、rem都扮演了什么角色" ["intro"]=> string(288) "目录 ECharts 异步加载 ECharts 数据可视化在过去几年中取得了巨大进展。开发人员对可视化产品的期望不再是简单的图表创建工具,而是在交互、性能、数据处理等方面有更高的要求。 chart.setOption({ color: [ " ["username"]=> string(12) "zhengqiaoyin" ["tagsname"]=> string(0) "" ["tagsid"]=> string(2) "[]" ["catesname"]=> string(0) "" ["catesid"]=> string(2) "[]" ["createtime"]=> string(10) "1511400640" ["_id"]=> string(3) "426" } [3]=> array(10) { ["id"]=> string(3) "425" ["text"]=> string(83) "深入学习JS执行--创建执行上下文(变量对象,作用域链,this)" ["intro"]=> string(288) "目录 ECharts 异步加载 ECharts 数据可视化在过去几年中取得了巨大进展。开发人员对可视化产品的期望不再是简单的图表创建工具,而是在交互、性能、数据处理等方面有更高的要求。 chart.setOption({ color: [ " ["username"]=> string(7) "Ry-yuan" ["tagsname"]=> string(33) "Javascript|Javascript执行过程" ["tagsid"]=> string(13) "["169","191"]" ["catesname"]=> string(0) "" ["catesid"]=> string(2) "[]" ["createtime"]=> string(10) "1511399901" ["_id"]=> string(3) "425" } [4]=> array(10) { ["id"]=> string(3) "424" ["text"]=> string(30) "C# 排序技术研究与对比" ["intro"]=> string(288) "目录 ECharts 异步加载 ECharts 数据可视化在过去几年中取得了巨大进展。开发人员对可视化产品的期望不再是简单的图表创建工具,而是在交互、性能、数据处理等方面有更高的要求。 chart.setOption({ color: [ " ["username"]=> string(9) "vveiliang" ["tagsname"]=> string(0) "" ["tagsid"]=> string(2) "[]" ["catesname"]=> string(8) ".Net Dev" ["catesid"]=> string(5) "[199]" ["createtime"]=> string(10) "1511399150" ["_id"]=> string(3) "424" } [5]=> array(10) { ["id"]=> string(3) "423" ["text"]=> string(72) "【算法】小白的算法笔记:快速排序算法的编码和优化" ["intro"]=> string(288) "目录 ECharts 异步加载 ECharts 数据可视化在过去几年中取得了巨大进展。开发人员对可视化产品的期望不再是简单的图表创建工具,而是在交互、性能、数据处理等方面有更高的要求。 chart.setOption({ color: [ " ["username"]=> string(9) "penghuwan" ["tagsname"]=> string(6) "算法" ["tagsid"]=> string(7) "["344"]" ["catesname"]=> string(0) "" ["catesid"]=> string(2) "[]" ["createtime"]=> string(10) "1511398109" ["_id"]=> string(3) "423" } [6]=> array(10) { ["id"]=> string(3) "422" ["text"]=> string(64) "JavaScript数据可视化编程学习(二)Flotr2,雷达图" ["intro"]=> string(288) "目录 ECharts 异步加载 ECharts 数据可视化在过去几年中取得了巨大进展。开发人员对可视化产品的期望不再是简单的图表创建工具,而是在交互、性能、数据处理等方面有更高的要求。 chart.setOption({ color: [ " ["username"]=> string(7) "chengxs" ["tagsname"]=> string(28) "数据可视化|前端学习" ["tagsid"]=> string(9) "[396,397]" ["catesname"]=> string(18) "前端基本知识" ["catesid"]=> string(5) "[198]" ["createtime"]=> string(10) "1511397800" ["_id"]=> string(3) "422" } [7]=> array(10) { ["id"]=> string(3) "421" ["text"]=> string(36) "C#表达式目录树(Expression)" ["intro"]=> string(288) "目录 ECharts 异步加载 ECharts 数据可视化在过去几年中取得了巨大进展。开发人员对可视化产品的期望不再是简单的图表创建工具,而是在交互、性能、数据处理等方面有更高的要求。 chart.setOption({ color: [ " ["username"]=> string(4) "wwym" ["tagsname"]=> string(0) "" ["tagsid"]=> string(2) "[]" ["catesname"]=> string(4) ".NET" ["catesid"]=> string(7) "["119"]" ["createtime"]=> string(10) "1511397474" ["_id"]=> string(3) "421" } [8]=> array(10) { ["id"]=> string(3) "420" ["text"]=> string(47) "数据结构 队列_队列实例:事件处理" ["intro"]=> string(288) "目录 ECharts 异步加载 ECharts 数据可视化在过去几年中取得了巨大进展。开发人员对可视化产品的期望不再是简单的图表创建工具,而是在交互、性能、数据处理等方面有更高的要求。 chart.setOption({ color: [ " ["username"]=> string(7) "idreamo" ["tagsname"]=> string(40) "C语言|数据结构|队列|事件处理" ["tagsid"]=> string(23) "["246","247","248",395]" ["catesname"]=> string(12) "数据结构" ["catesid"]=> string(7) "["133"]" ["createtime"]=> string(10) "1511397279" ["_id"]=> string(3) "420" } [9]=> array(10) { ["id"]=> string(3) "419" ["text"]=> string(47) "久等了,博客园官方Android客户端发布" ["intro"]=> string(288) "目录 ECharts 异步加载 ECharts 数据可视化在过去几年中取得了巨大进展。开发人员对可视化产品的期望不再是简单的图表创建工具,而是在交互、性能、数据处理等方面有更高的要求。 chart.setOption({ color: [ " ["username"]=> string(3) "cmt" ["tagsname"]=> string(0) "" ["tagsid"]=> string(2) "[]" ["catesname"]=> string(0) "" ["catesid"]=> string(2) "[]" ["createtime"]=> string(10) "1511396549" ["_id"]=> string(3) "419" } } ["count"]=> int(200) } 222 Centos7安装Redis4.0.8 - 爱码网

今天安装了CentOS7 1708 在安装redis时报错  make[1]: *** [adlist.o] 错误 127

 

因为Redis是C实现的,需要gcc来进行编译,所以原因是系统未安装gcc,按顺序执行:
yum install cpp
yum install binutils
yum install glibc
yum install glibc-kernheaders
yum install glibc-common
yum install glibc-devel
yum install gcc
yum install make
因为gcc依赖很多,都执行一下,以防万一
然后执行安装redis OK:

一、软件安装

1、进入官网下载Redis4.0.8

https://redis.io/download

官网也附有安装教程。

 

shell>wget http://download.redis.io/releases/redis-4.0.2.tar.gz

 

1.1 方式一

去 Redis 官网下载最新稳定版,上传到 Linux:https://redis.io/download

1.2 方式二

使用 wget 命令获取

wget http://download.redis.io/releases/redis-4.0.8.tar.gz

Centos7安装Redis4.0.8

2、解压压缩文件

shell>tar -zxvf redis-4.0.8.tar.gz

Centos7安装Redis4.0.8

 

3、进入redis-4.0.8目录 使用make命令编译redis

shell>cd   /edis-4.0.8

shell>make

等几分钟,过程可能比较慢,正常情况下是不会报错的,如下图:

Centos7安装Redis4.0.8

4、在redis-4.0.8目录中 使用makePREFIX=/usr/local/redis/redis-4.0.8 install命令安装redis到/usr/local/redis/redis-4.0.8中

shell>make PREFIX=/usr/local/redis/redis-4.0.8 install

Centos7安装Redis4.0.8

 

二、修改配置

前台启动:./redis-server 

后台启动:复制redis.conf (在/redis-4.0.8源码下,就是解压的那个文件夹)到redis的安装目录(就是你那个bin里),修改redis.conf中的 daemonize yes ,执行下边的命令就启动了,下一条是关闭命令

shell>cd /usr/local/webtools/redis-4.0.8

shell>cp redis.conf /usr/local/redis/redis-4.0.8/bin/

shell>cd /usr/local/redis/redis-4.0.8/bin/

Centos7安装Redis4.0.8 

shell>用vi工具打开redis-4.0.8目录下的redis.conf配置文件:

vi redis.config

1、.设置redis可以一直在后台运行,以守护进程方式运行,即关闭SSH工具程序也在运行。 
daemonize no 改成 daemonize yes

2、默认的话redis-server启动时会在当前目录生成或读取dump.rdb,可以指定生成的路径 
dir ./ 改成 dir /usr/local/redis/

3、指定是否在每次更新操作后进行日志记录,Redis在默认情况下是异步的把数据写入磁盘,如果不开启,可能会在断电时导致一段时间内的数据丢失。 因为 redis本身同步数据文件是按上面save条件来同步的,所以有的数据会在一段时间内只存在于内存中。默认为no 
appendonly no 改成 appendonly yes

4、.默认redis是只能内网127.0.0.0访问,如果想外网访问需要修改绑定的地址 
bind 127.0.0.1 改成 bind 0.0.0.0 (别忘了在阿里云后台给6379增加安全组配置)
改成任何IP都能访问的,当然这里也可以绑定单独的IP

5、修改保护模式,不修改保护模式也是只能内网访问的 
protected-mode yes 改成 protected-mode no

6.设置密码 
将”#requirepass foobared“ 取掉注释改成 requirepass 123

保存文件

第四、启动测试

启动redis服务

shell>./redis-server  ./redis.conf

验证服务是否启动:

shell>ps aux|grep redis

结果如下: 
Centos7安装Redis4.0.8
说明启动成功了。 
关闭启动的窗口,重新打开个命令终端,然后测试是否在后台运行,结果和上面一样,说明不论SSH是否关闭,redis服务都会在后台以守护进程方式运行。

用redis-cli测试内网

运行命令,连接客户端:

shell>./redis-cli -a xxx

备注:redis-cli -h 实例连接地址 -a 密码

Centos7安装Redis4.0.8

用java测试外网(阿里云防火墙规则添加端口6379)

创建一个java项目,导入jedis包,新new一个RedisConnectTest.java类,代码如下:

package test.service;

import redis.clients.jedis.Jedis; 

public class RedisConnectTest { 

             /**

              * @author liu

              * @version 创建时间:2018年3月17日22:13:50

              * @ClassName 类名称

              * @Description 类描述

              */

             public static void main(String[]args) {

        try {

            String host = "www.iotworld.vip";//控制台显示访问IP地址

            int port = xxx;

            Jedis jedis = new Jedis(host,port);

            // 鉴权信息

            jedis.auth("xxxxx.");//password

            String key = "redis_test";

            String value = "Hello-aliyun-redis";

            // select db 默认为0,共有16个

            jedis.select(1);

            // set一个key

            jedis.set(key, value);

            System.out.println("SetKey " + key + " Value: " + value);

            // get 设置进去的key

            String getvalue = jedis.get(key);

            System.out.println("GetKey " + key + " ReturnValue: " + getvalue);

            jedis.quit();

            jedis.close();

        } catch (Exception e) {

            e.printStackTrace();

       }

 

 

    }
}

运行结果如下:

Set Key redis_test Value: Hello-aliyun-redis

Get Key redis_test ReturnValue: Hello-aliyun-redis

说明连接并存储成功了,并且取数据也成功了。 
Centos7安装Redis4.0.8

相关文章:

  • 2021-11-20
  • 2021-11-20
  • 2021-11-17
  • 2021-11-19
  • 2021-11-18
  • 2021-11-18
  • 2021-11-19
  • 2021-11-19
猜你喜欢
  • 2021-11-19
  • 2021-11-19
  • 2021-11-19
  • 2021-11-20
  • 2021-11-20
  • 2021-11-20
  • 2021-11-18
  • 2021-11-18
相关资源
相似解决方案