对于NoSQL之Redis-CentOS6.5安装测试感兴趣的读者,本文将会是一篇不错的选择,我们将详细介绍centosyum安装redis,并为您提供关于CentOS6.5下Redis安装测试、Ce
对于NoSQL之Redis - CentOS 6.5安装测试感兴趣的读者,本文将会是一篇不错的选择,我们将详细介绍centos yum安装redis,并为您提供关于CentOS 6.5下Redis安装测试、CentOS 6.5安装 Redis、CentOS 6.5安装Redis-2.8.23、CentOS 安装 PHP5.5+Redis+XDebug+Nginx+MySQL全纪录,centosredis的有用信息。
本文目录一览:- NoSQL之Redis - CentOS 6.5安装测试(centos yum安装redis)
- CentOS 6.5下Redis安装测试
- CentOS 6.5安装 Redis
- CentOS 6.5安装Redis-2.8.23
- CentOS 安装 PHP5.5+Redis+XDebug+Nginx+MySQL全纪录,centosredis
NoSQL之Redis - CentOS 6.5安装测试(centos yum安装redis)
1.下载redis
可以在线安装或者下载redis
①在线安装前需要检测是否存在rpm包不存在的话查看yum在线是否存在rpm包不存在的话就只能手动下载或者用别的方式下载
[root@localhost~]#rpm-qa|grepredis [root@localhost~]#yumlist|grepredis
说明不存在。
②去官网下载或者在线下载
wgethttp://redis.googlecode.com/files/redis-2.2.13.tar.gz
官网下载好的redis已经存在博客中了点击下载 redis。
2.安装
由于是tar.gz格式的所以需要解压安装
下载好之后查找下载文件所在路径
[root@localhost~]#whereisredis redis:/etc/redis [root@localhost~]#
解压编译redis的软件包需要有gcc环境
总之缺少什么安装什么。
tar-zxvfreids-2.8.13.tar.gz cdredis-2.8.13 make sudomakeinstall #配置开始--- 编译完成后在Src目录下有四个可执行文件redis-server、redis-benchmark、redis-cli和redis.conf。然后拷贝到一个目录下。 mkdir/usr/redis cpredis-server/usr/redis cpredis-benchmark/usr/redis cpredis-cli/usr/redis cpredis.conf/usr/redis cd/usr/redis #配置结束--
或者可以这样配置
mkdir/etc/redis cpredis.conf/etc/redis/redis.conf mkdir/var/lib/redis
可从此处下载修改好的 redis.conf
启动redis redis-server/etc/redis/redis.conf #即可在后台启动redis服务确认运行了之后可以用redis-benchmark命令测试看看还可以通过redis-cli命令实际操作一下比如 #install的时候redis的命令会被拷贝到/usr/local/bin下面
3.测试
客户端测试一下是否启动成功
[root@localhostsrc]#ps-aux|grepredis Warning:badSyntax,perhapsabogus'-'?See/usr/share/doc/procps-3.2.8/FAQ root232660.00.71373567768?Sl00:230:04redis-server*:6379 root239820.00.5194045100pts/0S+01:090:00redis-cli root243980.00.0103244876pts/2S+01:440:00grepredis [root@localhostsrc]#redis-cli 127.0.0.1:6379>setwwang OK 127.0.0.1:6379>getw "wang" 127.0.0.1:6379>
4.关闭服务
redis-clishutdown 如果端口变化可以指定端口: redis-cli-p6379shutdown
127.0.0.1:6379>i+j CouldnotconnecttoRedisat127.0.0.1:6379:Connectionrefused notconnected>setw3 CouldnotconnecttoRedisat127.0.0.1:6379:Connectionrefused notconnected>
5.启动服务
[root@localhostsrc]#redis-server [24502]28Oct01:54:35.784#Warning:noconfigfilespecified,usingthedefaultconfig.Inordertospecifyaconfigfileuseredis-server/path/to/redis.conf [24502]28Oct01:54:35.784*Increasedmaximumnumberofopenfilesto10032(itwasoriginallysetto1024). _._ _.-``__''-._ _.-```.`_.''-._Redis2.8.13(00000000/0)64bit .-``.-```.```\/_.,_''-._ (',.-`|`,)Runninginstandalonemode |`-._`-...-`__...-.``-._|'`_.-'|Port:6379 |`-._`._/_.-'|PID:24502 `-._`-._`-./_.-'_.-' |`-._`-._`-.__.-'_.-'_.-'| |`-._`-.__.-'_.-'|http://redis.io `-._`-._`-.__.-'_.-'_.-' |`-._`-._`-.__.-'_.-'_.-'| |`-._`-.__.-'_.-'| `-._`-._`-.__.-'_.-'_.-' `-._`-.__.-'_.-' `-.__.-' `-.__.-' [24502]28Oct01:54:35.786#Serverstarted,Redisversion2.8.13 [24502]28Oct01:54:35.786#WARNINGovercommit_memoryissetto0!Backgroundsavemayfailunderlowmemorycondition.Tofixthisissueadd'vm.overcommit_memory=1'to/etc/sysctl.confandthenrebootorrunthecommand'sysctlvm.overcommit_memory=1'forthistotakeeffect. [24502]28Oct01:54:35.786*DBloadedfromdisk:0.000seconds [24502]28Oct01:54:35.786*TheserverisNowreadytoacceptconnectionsonport6379
启动之后最好重新打开个窗口运行redsi-cli进入控制台
否则可能出现连接错误。和windows下cmd运行tomcat类似。
[root@localhostredis]#redis-cli CouldnotconnecttoRedisat127.0.0.1:6379:Connectionrefused notconnected>redis-cli CouldnotconnecttoRedisat127.0.0.1:6379:Connectionrefused notconnected> [root@localhostredis]#redis-cli 127.0.0.1:6379>setname=wangxin (error)ERRSyntaxerror 127.0.0.1:6379>setnamewangxin OK 127.0.0.1:6379>setage26 OK 127.0.0.1:6379>getnameage (error)ERRwrongnumberofargumentsfor'get'command 127.0.0.1:6379>getname "wangxin" 127.0.0.1:6379>getage "26" 127.0.0.1:6379>
CentOS 6.5下Redis安装测试
NoSQL之Redis - CentOS 6.5安装测试 1.下载redis 可以在线安装或者下载 redis ①在线安装前需要检测是否存在rpm包不存在的话查看
nosql之redis - centos 6.5安装测试
1.下载redis
可以在线安装或者下载 redis
①在线安装前需要检测是否存在rpm包不存在的话查看yum在线是否存在rpm包不存在的话就只能手动下载或者用别的方式下载
[root@localhost ~]# rpm -qa|grep redis
[root@localhost ~]# yum list|grep redis
说明不存在。
②去官网下载或者在线下载
wget
官网下载好的 redis 已经存在博客中了点击下载 redis。
2.安装
由于是tar.gz格式的所以需要解压安装
下载好之后查找下载文件所在路径
[root@localhost ~]# whereis redis
redis: /etc/redis
[root@localhost ~]#
解压编译redis的软件包需要有gcc环境
总之缺少什么安装什么。
tar -zxvf reids-2.8.13.tar.gz
cd redis-2.8.13
make
sudo make install
#配置开始---
编译完成后在Src目录下有四个可执行文件redis-server、redis-benchmark、redis-cli和redis.conf。然后拷贝到一个目录下。
mkdir /usr/redis
cp redis-server /usr/redis
cp redis-benchmark /usr/redis
cp redis-cli /usr/redis
cp redis.conf /usr/redis
cd /usr/redis
#配置结束--
或者可以这样配置
mkdir /etc/redis
cp redis.conf /etc/redis/redis.conf
mkdir /var/lib/redis
可从此处下载修改好的 redis.conf
启动redis
redis-server /etc/redis/redis.conf
#即可在后台启动redis服务确认运行了之后可以用redis-benchmark命令测试看看还可以通过redis-cli命令实际操作一下比如
#install的时候redis的命令会被拷贝到/usr/local/bin下面
3.测试
客户端测试一下是否启动成功
[root@localhost src]# ps -aux|grep redis
Warning: bad syntax, perhaps a bogus ''-''? See /usr/share/doc/procps-3.2.8/FAQ
root 23266 0.0 0.7 137356 7768 ? Sl 00:23 0:04 redis-server *:6379
root 23982 0.0 0.5 19404 5100 pts/0 S+ 01:09 0:00 redis-cli
root 24398 0.0 0.0 103244 876 pts/2 S+ 01:44 0:00 grep redis
[root@localhost src]# redis-cli
127.0.0.1:6379> set w wang
OK
127.0.0.1:6379> get w
"wang"
127.0.0.1:6379>
4.关闭服务
redis-cli shutdown
如果端口变化可以指定端口:
redis-cli -p 6379 shutdown
127.0.0.1:6379> i+j
Could not connect to Redis at 127.0.0.1:6379: Connection refused
not connected> set w 3
Could not connect to Redis at 127.0.0.1:6379: Connection refused
not connected>
5.启动服务
[root@localhost src]# redis-server
[24502] 28 Oct 01:54:35.784 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf
[24502] 28 Oct 01:54:35.784 * Increased maximum number of open files to 10032 (it was originally set to 1024).
_._
_.-``__ ''''-._
_.-`` `. `_. ''''-._ Redis 2.8.13 (00000000/0) 64 bit
.-`` .-```. ```\/ _.,_ ''''-._
( '' , .-` | `, ) Running in stand alone mode
|`-._`-...-` __...-.``-._|''` _.-''| Port: 6379
| `-._ `._ / _.-'' | PID: 24502
`-._ `-._ `-./ _.-'' _.-''
|`-._`-._ `-.__.-'' _.-''_.-''|
| `-._`-._ _.-''_.-'' |
`-._ `-._`-.__.-''_.-'' _.-''
|`-._`-._ `-.__.-'' _.-''_.-''|
| `-._`-._ _.-''_.-'' |
`-._ `-._`-.__.-''_.-'' _.-''
`-._ `-.__.-'' _.-''
`-._ _.-''
`-.__.-''
[24502] 28 Oct 01:54:35.786 # Server started, Redis version 2.8.13
[24502] 28 Oct 01:54:35.786 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add ''vm.overcommit_memory = 1'' to /etc/sysctl.conf and then reboot or run the command ''sysctl vm.overcommit_memory=1'' for this to take effect.
[24502] 28 Oct 01:54:35.786 * DB loaded from disk: 0.000 seconds
[24502] 28 Oct 01:54:35.786 * The server is now ready to accept connections on port 6379
启动之后最好重新打开个窗口运行redsi-cli进入控制台
CentOS 6.5安装 Redis
CentOS 6.5安装 Redis 版本:redis-2.8.19.tar.gz 检查下面依赖是否安装,如果没有要先安装,不然会有异常。 yum installgcc-c++
centos 6.5安装 redis
版本:redis-2.8.19.tar.gz
检查下面依赖是否安装,,如果没有要先安装,不然会有异常。
yum installgcc-c++
yum install -y tcl。
1、获取安装文件
redis-2.8.19.tar.gz
2、解压文件
tar -xzvf redis-2.8.19.tar.gz
mv redis-2.8.19 /usr/local/redis
3、进入目录
cd redis
4、编译
make
5、安装
make install
6、设置配置文件路径
mkdir -p /etc/redis
cp redis.conf/etc/redis
7、修改配置文件
vi /etc/redis/redis.conf
仅修改: daemonize yes
8、启动
/usr/local/bin/redis-server/etc/redis/redis.conf
9、查看启动
ps -ef | grep redis
10、使用客户端
redis-cli
>set namedavid
OK
11.关闭客户端
redis-cli shutdown
12.异常及解决方法
异常一:
make[2]: cc:Command not found
异常原因:没有安装gcc
解决方案:yum install gcc-c++
异常二:
zmalloc.h:51:31:error: jemalloc/jemalloc.h: No such file or directory
异常原因:一些编译依赖或原来编译遗留出现的问题
解决方案:make distclean。清理一下,然后再make。
在make成功以后,需要make test。在make test出现异常。
异常一:
couldn''texecute "tclsh8.5": no such file or directory
异常原因:没有安装tcl
如果不先安装tcl在编译redis的时候,执行make test 会报以下错误,这步也可以省略,不执行make test 直接执行make install 对redis的启动和关闭没有什么影响。
[root@localhostredis]# make test
cd src &&make test
make[1]: Enteringdirectory `/usr/local/webserver/redis/src''
You need tcl 8.5 ornewer in order to run the Redis test
make[1]: *** [test]Error 1
make[1]: Leavingdirectory `/usr/local/webserver/redis/src''
make: *** [test]Error 2
Ubuntu 14.04下Redis安装及简单测试
Redis集群明细文档
Ubuntu 12.10下安装Redis(图文详解)+ Jedis连接Redis
Redis系列-安装部署维护篇
CentOS 6.3安装Redis
Redis安装部署学习笔记
Redis配置文件redis.conf 详解
Redis 的详细介绍:请点这里
Redis 的下载地址:请点这里
本文永久更新链接地址:
CentOS 6.5安装Redis-2.8.23
安装环境:
CentOS 6.5
Redisredis-2.8.23
下载安装:
1、切换至/usr/local/src/目录下:
[root@node2 ~]# cd /usr/local/src
下载源码包:
[root@node2 src]# wgethttp://download.redis.io/releases/redis-2.8.23.tar.gz
2、解压:
[root@node2 src]# tar xf redis-2.8.23.tar.gz
3、切换至redis-2.8.23目录下:
[root@node2 src]# cd redis-2.8.23
4、安装redis至/usr/local/redis目录:
[root@node2 redis-2.8.23]# make PREFIX=/usr/local/redis install
5、为redis提供SysV init脚本:
[root@node2 redis-2.8.23]# vim /etc/rc.d/init.d/redis
#!/bin/sh
# chkconfig: 2345 83 93
# Simple Redis init.d script conceived to work on Linux systems
# as it does use of the /proc filesystem.
#
# Simple Redis init.d script conceived to work on Linux systems
# as it does use of the /proc filesystem.
REdisPORT=6379
EXEC=/usr/local/redis/bin/redis-server
CLIEXEC=/usr/local/redis/bin/redis-cli
PIDFILE=/var/run/redis.pid
CONF="/etc/redis/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
;;
stop)
if [ ! -f $PIDFILE ]
then
echo "$PIDFILE does not exist,process is not running"
else
PID=$(cat $PIDFILE)
echo "Stopping ..."
$CLIEXEC -p $REdisPORT shutdown
while [ -x /proc/${PID} ]
do
echo "Waiting for Redis to shutdown ..."
sleep 1
done
echo "Redis stopped"
fi
;;
*)
echo "Please use start or stop as first argument"
;;
esac
6、给脚本赋予执行权限:
[root@node2 redis-2.8.23]# chmod u+x /etc/rc.d/init.d/redis
7、添加至服务管理列表,并让其开机自动启动:
[root@node2 redis-2.8.23]# chkconfig --add /etc/rc.d/init.d/redis
[root@node2 redis-2.8.23]# chkconfig redis on
8、创建redis持久化文件存放目录
mkdir -pv /var/redis/data
9、创建配置文件存放目录
[root@node2 redis-2.8.23]# mkdir /etc/redis
10、提供配置文件
[root@node2 redis-2.8.23]# cp /usr/local/src/redis-2.8.23/redis.conf /etc/redis/
11、编辑配置文件更改以下选项为如下值
[root@node2 redis-2.8.23]# vim /etc/redis/redis.conf
daemonize yes#使Redis以守护进程模式运行
dir /var/redis/data #设置持久化文件存放位置,路径可自定义
12、启动服务
[root@node2 redis-2.8.23]# service redis start
13、检查服务端口
[root@node2 redis-2.8.23]# netstat -tunl | grep 6379
tcp 0 0 0.0.0.0:6379 0.0.0.0:* LISTEN
14、修改PATH环境变量,让系统可以直接使用redis的相关命令:
[root@node2 ~]# echo 'export PATH=/usr/local/redis/bin:$PATH' > /etc/profile.d/redis.sh
[root@node2 ~]# source /etc/profile.d/redis.sh
15、使用redis客户端工具连上redis进行测试:
[root@node2 ~]# redis-cli
127.0.0.1:6379> set hello world
OK
127.0.0.1:6379>
127.0.0.1:6379> get hello
"world"
127.0.0.1:6379> quit
[root@node2 ~]#
到此Redis的安装测试已经完成。
CentOS 安装 PHP5.5+Redis+XDebug+Nginx+MySQL全纪录,centosredis
centos 安装 php5.5+redis+xdebug+nginx+mysql全纪录,centosredis
启动ssh服务
service sshd start
yum -y update
查看centos版本
centos 5 执行:
复制代码 代码如下:
rpm -Uvh http://mirror.webtatic.com/yum/el5/latest.rpm
centos 6 执行:
复制代码 代码如下:
rpm -Uvh http://mirror.webtatic.com/yum/el6/latest.rpm
yum安装php
立即学习“PHP免费学习笔记(深入)”;
复制代码 代码如下:
yum install php55w php55w-bcmath php55w-cli php55w-common
php55w-devel php55w-fpm php55w-gd php55w-imap php55w-ldap
php55w-mbstring php55w-mcrypt php55w-mysql php55w-odbc php55w-pdo
php55w-pear php55w-pecl-igbinary php55w-xml php55w-xmlrpc
php55w-opcache php55w-intl php55w-pecl-memcache
安装完成
whereis php
启动php-fpm
复制代码 代码如下:
/etc/rc.d/init.d/php-fpm start
安装Redis server
> yum install wget make gcc gcc-c++ zlib-devel openssl openssl-devel > pcre-devel kernel keyutils patch perl > > mkdir /tmp/redis > > cd /tmp/redis > > wget http://download.redis.io/releases/redis-2.8.8.tar.gz > > tar xzf redis-* > > cd redis-* > > make > > sudo make install clean > > mkdir /etc/redis > > cp redis.conf /etc/redis/redis.conf
修改conf配置
复制代码 代码如下:
vim /etc/redis/redis.conf
例子 /n关键字去修改
复制代码 代码如下:
> daemonize yes
>
> port 6379
>
> bind 127.0.0.1
>
> dir /var/opt
查看是否安装成功
复制代码 代码如下:
> whereis redis-server
>
> /usr/local/bin/redis-server /etc/redis/redis.conf
>
> redis-cli
安装 PHPRedis
下载地址
https://github.com/nicolasff/phpredis/archive/2.2.4.tar.gz
上传 phpredis-2.2.4.tar.gz 到 /usr/local/src 目录
> cd /usr/local/src > > tar zxvf phpredis-2.2.4.tar.gz > > cd phpredis-2.2.4 > > /usr/local/php/bin/phpize > > whereis php > > /usr/bin/phpize > > /usr/bin/php/bin/phpize > > find / -name "phpize" > > ./configure --with-php-config=/usr/bin/php-config > > make > > make install > > > vim /usr/bin/php.ini
安装完成之后,出现下面的安装路径
复制代码 代码如下:
> /usr/local/php/lib/php/extensions/no-debug-non-zts-20090626/
3、配置php支持 在php.ini里添加
复制代码 代码如下:
> extension="redis.so"
重启php-fpm
复制代码 代码如下:
> /etc/rc.d/init.d/php-fpm stop
>
> /etc/rc.d/init.d/php-fpm start
>
> php -r "if (new Redis() == true){ echo \"\r\n OK \r\n\"; }"
ok 就是成功了
安装Xdebug
到官网 http://www.xdebug.com/download.php
linux 系统下载 source 版 tgz 压缩包
> tar -xvzf xdebug-2.3.1.tgz > > cd xdebug-2.3.1 > > phpize > > ./configure > > make > > make install > > cp modules/xdebug.so /usr/include/php/ext //将 xdebug.so 文件移到 php 下面
ext可以通过find 去找到
编辑php.ini,加入下面配置,一般的功能都打开了
1818 [Xdebug] 1819 zend_extension="/usr/include/php/ext/xdebug.so" 1820 xdebug.trace_output_dir="/tmp/php/xdebug" 1821 xdebug.profiler_output_dir="/tmp/php/xdebug" 1822 xdebug.profiler_output_name="callgrind.out.%s.%t" 1823 xdebug.profiler_enable=On 1824 xdebug.profiler_enable_trigger=1 1825 xdebug.default_enable=1 1826 xdebug.show_exception_trace=On 1827 xdebug.show_local_vars=0 1828 xdebug.max_nesting_level=300 1829 xdebug.var_display_max_depth=6 1830 xdebug.dump_once=On 1831 xdebug.dump_globals=On 1832 xdebug.dump_undefined=On 1833 xdebug.dump.GET=* 1834 xdebug.dump.SERVER=REMOTE_ADDR 1835 xdebug.dump.REQUEST=* 1836 xdebug.dump.SERVER=REQUEST_METHOD,REQUEST_URI,HTTP_USER_AGENT 1837 xdebug.remote_connect_back=1 1838 xdebug.remote_enable=1 1839 xdebug.remote_handler=dbgp 1840 xdebug.remote_mode=req 1841 xdebug.cli_color=1 1842 xdebug.trace_format=0 1843 xdebug.auto_trace=On 1844 xdebug.force_display_errors= 1 1845 xdebug.collect_assignments=On 1846 xdebug.force_error_reporting = 1 1847 display_startup_errors=1 1848 allow_url_include=1 1849 always_populate_raw_post_data=1 1850 asp_tags=1 1851 xdebug.scream=0 1852 xdebug.collect_return=1 1853 xdebug.collect_vars=1 1854 xdebug.remote_host = 127.0.0.1 1855 xdebug.collect_params=On 1856 xdebug.collect_params=4 1857 how_local_vars=On 1858 xdebug.idekey="PHPSTORM" 1859 xdebug.dump.COOKIE=* 1860 xdebug.dump.ENV=* 1861 xdebug.dump.FILES=* 1862 xdebug.dump.POST=* 1863 xdebug.dump.SERVER=* 1864 xdebug.dump.SESSION=* 1865 xdebug.file_link_format=* 1866 xdebug.profiler_aggregate=1 1867 xdebug.profiler_append=1 1868 xdebug.profiler_enable_trigger_value=* 1869 xdebug.remote_autostart=1 1870 xdebug.show_local_vars=1 1871 xdebug.show_mem_delta=1 1872 xdebug.trace_enable_trigger=1
安装nginx
复制代码 代码如下:
> yum install nginx -y
安装完成,下面直接就可以启动Nginx了:
复制代码 代码如下:
> /etc/init.d/nginx start
>
> /etc/init.d/iptables stop 关闭防火墙
>
> /etc/nginx/nginx.conf # Nginx配置文件位置
php错误,nginx报502错误 在nginx.conf里把502注释掉即可
laravel5的配置
> server { > listen 80; > server_name baidu.com; > set $index_file index.php; > location / { > root /opt/www/baidu/public; > index index.html index.htm index.php; > > if (!-e $request_filename) { > rewrite ^/(.*)$ /index.php?$1 last; > break; > } > index $index_file; > > } location ~ \.php$ { root html; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; > fastcgi_param SCRIPT_FILENAME > /opt/www/baidu/public/$fastcgi_script_name; include > fastcgi_params; } }
安装mysql
复制代码 代码如下:
> yum install mysql mysql-server
设置开机启动
> chkconfig mysqld on > > mysql -u root > > mysql> select user,host,password from mysql.user; > mysql> set password for root@localhost=password(''123456''); mysql> exit show databases; use laravel5; show tables;
以上所述就是本文的全部内容了,希望大家能够喜欢。
请您花一点时间将文章分享给您的朋友或者留下评论。我们将会由衷感谢您的支持!
关于NoSQL之Redis - CentOS 6.5安装测试和centos yum安装redis的问题就给大家分享到这里,感谢你花时间阅读本站内容,更多关于CentOS 6.5下Redis安装测试、CentOS 6.5安装 Redis、CentOS 6.5安装Redis-2.8.23、CentOS 安装 PHP5.5+Redis+XDebug+Nginx+MySQL全纪录,centosredis等相关知识的信息别忘了在本站进行查找喔。
本文标签: