Centos7瀹夎骞堕厤缃畆edis
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Centos7瀹夎骞堕厤缃畆edis相关的知识,希望对你有一定的参考价值。
鏍囩锛?a href='http://www.mamicode.com/so/1/%e5%bc%80%e5%90%af' title='寮€鍚?>寮€鍚?/a> 鍘绘帀 isp 瀹氫箟 娣诲姞 exists opp filesyste
涓€銆佷笅杞絩edis-5.0.5瀹夎鍖?/span>
# wget http://download.redis.io/releases/redis-5.0.5.tar.gz
浜屻€佽В鍘嬪帇缂╁寘鑷虫寚瀹氱洰褰?br />
# mkdir -p /home/mark/tools
# tar zxvf redis-5.0.5.tar.gz -C /home/mark/tools/
涓夈€佽浆鍒皉edis瑙e帇鐩綍
# cd redis-5.0.5/
鍥涖€佺紪璇戝畨瑁?/span>
# make MALLOC=libc 灏?/span>/redis-5.0.5/src鐩綍涓嬬殑鏂囦欢娣诲姞鑷?usr/local/bin鐩綍 # cd src/ && make install
浜斻€佽缃畆edis寮€鏈鸿嚜鍚?/span>
淇敼redis.conf鏂囦欢 daemonize no 鏀逛负 daemonize yes # sed -i 鈥榮/daemonize no/daemonize yes/g鈥?../redis.conf 1銆佸湪/etc鐩綍涓嬫柊寤簉edis鐩綍 # mkdir -p /etc/redis 2銆佸皢/redis-5.0.5/redis.conf 鏂囦欢澶嶅埗涓€浠藉埌/etc/redis鐩綍涓嬶紝骞跺懡鍚嶄负6379.conf銆€ # cp /home/mark/tools/redis-5.0.5/redis.conf /etc/redis/6379.conf 3銆佸皢redis鐨勫惎鍔ㄨ剼鏈鍒朵竴浠芥斁鍒?etc/init.d鐩綍涓? # cp /home/mark/tools/redis-5.0.5/utils/redis_init_script /etc/init.d/redisd 4銆佽缃紑鏈鸿嚜鍚? # systemctl enable redisd 5銆佸紑鍚湇鍔?amp;鏌ョ湅鏈嶅姟鐘舵€? # systemctl start redisd # systemctl status redisd.service 鈼?redisd.service - LSB: Redis data structure server Loaded: loaded (/etc/rc.d/init.d/redisd; bad; vendor preset: disabled) Active: active (running) since 浜?2020-06-09 17:50:19 CST; 7min ago Docs: man:systemd-sysv-generator(8) CGroup: /system.slice/redisd.service 鈹斺攢10153 /usr/local/bin/redis-server 127.0.0.1:6379
鍏€佽缃鎴风鐧诲綍瀵嗙爜
缂栬緫redis.conf鏂囦欢锛屾悳绱equirepass鍏抽敭瀛楋紝鍘绘帀娉ㄩ噴鍚庯紝鎶奻oobared鏇挎崲涓鸿嚜宸辩殑瀵嗙爜鍗冲彲锛?# vim ../redis.conf requirepass 123456
涓冦€佹洿鏀瑰畬瀹㈡埛绔櫥褰曞瘑鐮侊紝Redis鏈嶅姟鍋滄鎶ラ敊瑙e喅鏂规
1銆佷慨鏀箁edis鏈嶅姟鑴氭湰锛屽姞鍏ュ涓嬫墍绀虹殑绾㈣壊鎺堟潈淇℃伅鍗冲彲锛? vi /etc/init.d/redis $CLIEXEC -a "youpassword" -p $REDISPORT shutdown 2銆佹垨娣诲姞涓€涓瘑鐮佸彉閲忥紝鐩存帴寮曠敤濡備笅锛? #!/bin/sh # # Simple Redis init.d script conceived to work on Linux systems # as it does use of the /proc filesystem. ### BEGIN INIT INFO # Provides: redis_6379 # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: Redis data structure server # Description: Redis data structure server. See https://redis.io ### END INIT INFO REDISPORT=6379 EXEC=/usr/local/bin/redis-server CLIEXEC=/usr/local/bin/redis-cli RESDISPASSWORD=123456 ###瀹氫箟瀵嗙爜鍙橀噺 PIDFILE=/var/run/redis_${REDISPORT}.pid CONF="/etc/redis/${REDISPORT}.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 -a $RESDISPASSWORD -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" ;; 閲嶆柊鍔犺浇鏈嶅姟閰嶇疆鏂囦欢 # systemctl daemon-reload
以上是关于Centos7瀹夎骞堕厤缃畆edis的主要内容,如果未能解决你的问题,请参考以下文章
mac锛欸o瀹夎鍜岄厤缃?GoLand瀹夎鍜屼娇鐢ㄤ箣瀹屾暣鏁欑▼