惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

G
Google Developers Blog
宝玉的分享
宝玉的分享
月光博客
月光博客
B
Blog
云风的 BLOG
云风的 BLOG
Google DeepMind News
Google DeepMind News
Engineering at Meta
Engineering at Meta
aimingoo的专栏
aimingoo的专栏
N
Netflix TechBlog - Medium
博客园_首页
GbyAI
GbyAI
人人都是产品经理
人人都是产品经理
A
About on SuperTechFans
Y
Y Combinator Blog
L
LangChain Blog
有赞技术团队
有赞技术团队
D
Docker
爱范儿
爱范儿
博客园 - 司徒正美
H
Hackread – Cybersecurity News, Data Breaches, AI and More
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
酷 壳 – CoolShell
酷 壳 – CoolShell
Microsoft Security Blog
Microsoft Security Blog
D
DataBreaches.Net

博客园 - Xsi64

STS或eclipse安装SVN插件 Html解析类的新选择CsQuery Tomcat编码问题 在64位平台上的Lucene,应该使用MMapDirectory[转] Java properties文件用法 Cache Lucene IndexReader with Apache Commons Pool apache commons pool deb软件包安装和卸载 maven GroupId 和ArtifactId通常填什么 mongodb first mongodb mongod 启动参数 Could not resolve archetype org.apache.maven.archetypes:maven-archetype-quickstart 在CentOS上安装tomcat CentOS上安装 jdk Linux CentOS修改网卡IP/网关设置 vim使用大全 [Redis] redis-cli 命令总结 CentOS装机必备-基本设置以及缺失文件 maven scope含义的说明
centOS上安装redis
Xsi64 · 2014-05-27 · via 博客园 - Xsi64

1.安装tcl支持

2.安装redis我们以最新的2.8.9为例

$ wget http://download.redis.io/releases/redis-2.8.9.tar.gz
$ tar xzf redis-2.8.9.tar.gz
$ cd redis-2.8.9
$ make
$ make test
$ make install

测试通过后安装,安装后会自动把redis-server,redis-cli,redis-benchmark,redis-check-aof,redis-check-dump复制到/usr/local/bin目录下。

编辑redis.conf文件

修改daemonize no改成yes。

我们手动复制redis.conf到/etc目录下

编写自init.d脚本。

内容如下:

###########################
#chkconfig: 2345 10 90
#description: Start and Stop redis
PATH=/usr/local/bin:/sbin:/usr/bin:/bin
   
REDISPORT=6379
EXEC=/usr/local/bin/redis-server
REDIS_CLI=/usr/local/bin/redis-cli
   
PIDFILE=/var/run/redis.pid
CONF="/etc/redis.conf"
   
case "$1" in
    start)
        if [ -f $PIDFILE ]
        then
                echo "$PIDFILE exists, process is already running or crashed"
        else
                echo "Starting Redis server..."
                $EXEC $CONF
        fi
        if [ "$?"="0" ] 
        then
              echo "Redis is running..."
        fi
        ;;
    stop)
        if [ ! -f $PIDFILE ]
        then
                echo "$PIDFILE does not exist, process is not running"
        else
                PID=$(cat $PIDFILE)
                echo "Stopping ..."
                $REDIS_CLI -p $REDISPORT SHUTDOWN
                while [ -x ${PIDFILE} ]
               do
                    echo "Waiting for Redis to shutdown ..."
                    sleep 1
                done
                echo "Redis stopped"
        fi
        ;;
   restart|force-reload)
        ${0} stop
        ${0} start
        ;;
  *)
    echo "Usage: /etc/init.d/redis {start|stop|restart|force-reload}" >&2
        exit 1
esac
##############################

可以通过winscp上传到/etc/init.d/目录下

修改权限,可以运行

chmod +x /etc/init.d/redis

设置开机自动启动服务

启动服务:

停止服务:

配置防火墙打开对应的端口:

vi /etc/sysconfig/iptables
-A INPUT -m state --state NEW -m tcp -p tcp --dport 6379 -j ACCEPT

 重启防火墙