Install Redis on Fedora

Management tool:
install phpredisadmin under centos6.3, and the configuration file http://wktdhe.blog.51cto.com/4764978/1144514

About the command:
redis-cli command summary  http://www.178-go.com/archives/ redis-cli-%E5%91%BD%E4%BB%A4%E6%80%BB%E7%BB%93.htmlAbout

configuring password:
http://blog.csdn.net/zyz511919766/article/details/ 42268219
Modify redis.conf
requirepass 12345
and then start the
server./redis-server ../redis.conf
login./redis-cli
-h 127.0.0.1 -p 6379 -a 12345


Several commands:
keys * : View all key information
keys PANDY*: View all keys at the beginning of PANDY
exists(key): confirm whether a key exists
del(key): delete a key
type(key): return value type
flushdb: delete all keys in the currently selected database
flushall: delete all All keys in the database are


installed and tested
wget http://download.redis.io/releases/redis-2.8.24.tar.gz
tar xzf redis-2.8.24.tar.gz
cd redis-2.8.24
make #start

server
cd src
./redis-server #Client

link test
$ src/redis-cli
redis> set foo bar
OK
redis> get foo
"bar"



Output:
......
......
[18380] 03 May 21:02:31.295 * The server is now ready to accept connections on port 6379
indicates successful installation


package com.pandy.test;

import redis.clients.jedis.Jedis;

/**
 * Project name: wp_idea_linux
 * Function Description:
 * Created by: Pandy,
 * Email: [email protected], [email protected]
 * Copyright:
 * Official website:
 * Date of creation: 15-5-11.
 * Creation time: 12:55 pm.
 * Modification history:
 * -----------------------------------------------
 */

/**
 * Redis test program
 */
public class RedisTest {
    public static void main(String[] args) {
        Jedis jedis = new Jedis("192.168.0.198",6379);
        jedis.auth("12345"); //If there is a password, set the password
        jedis.set("foo", "This is Chinese");
        String value = jedis.get("foo");
        System.out.println(value);
    }
}






install sh
#!/bin/bash
# From here: http://www.codingsteps.com/install-redis-2-6-on-amazon-ec2-linux-ami-or-centos/
# Based on: https://github.com/saxenap/install-redis-amazon-linux-centos
# Thanks to https://raw.github.com/gist/2776679/b4f5f5ff85bddfa9e07664de4e8ccf0e115e7b83/install-redis.sh
# Uses redis-server init script from https://raw.github.com/saxenap/install-redis-amazon-linux-centos/master/redis-server
###############################################
# To use:
## wget https://raw.github.com/jorgerc/install-redis-amazon-linux-centos/master/redis-install-script.sh
## chmod 777 redis-install-script.sh
## ./redis-install-script.sh
###############################################
# Set up SO:
####
yum -y update
ln -sf /usr/share/zoneinfo/UTC /etc/localtime
yum -y install gcc gcc-c++ make
####
# Download and install Redis:
####
version=2.8.12
wget -q http://download.redis.io/releases/redis-$version.tar.gz
tar xzf redis-$version.tar.gz
rm -f redis-$version.tar.gz
cd redis-$version
make
make install
####
# Set up Redis
####
rm -rf /etc/redis /var/lib/redis
mkdir / etc / redis / var / lib / redis
cp src/redis-server src/redis-cli /usr/local/bin
cp redis.conf /etc/redis
sed -e "s/^daemonize no$/daemonize yes/" -e "s/^# bind 127.0.0.1$/bind 0.0.0.0/" -e "s/^dir \.\//dir \/var\/lib\/redis\//" -e "s/^loglevel verbose$/loglevel notice/" -e "s/^logfile stdout$/logfile \/var\/log\/redis.log/" redis.conf > /etc/redis/redis.conf
####
# Redis correctly installed.
# Download script for running Redis
####
wget -q https://raw.github.com/saxenap/install-redis-amazon-linux-centos/master/redis-server
mv redis-server /etc/init.d
chmod 755 /etc/init.d/redis-server
chkconfig --add redis-server
chkconfig --level 345 redis-server on
####
# To start Redis just uncomment this line
####
#service redis-server start

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326801875&siteId=291194637