首页 > 编程知识 正文

redis 部署,redis 安装

时间:2023-05-05 12:35:07 阅读:219686 作者:4182

mkdir /data/redis_cluster准备自行下载的软件安装包的存放路径和下载redismkdir /data/soft;cd /data/softwget https://repo.huaweicloud.com/redis/redis-3.2.9.tar.gz安装redistar xf redis-3.2.9.tar.gz -C /data/redis_clustercd /data/redis_clusterln -s redis-3.2.9 rediscd redismkdir conf pid logs datacd /data/redis_cluster/redis-3.2.9/srcmakemake install使用redis官方脚本生成redis的配置文件[root@localhost redis]# cd utils/[root@localhost utils]# lsbuild-static-symbols.tcl corrupt_rdb.c generate-command-help.rb hyperloglog lru redis_init_script redis-sha1.rb speed-regression.tclcluster_fail_time.tcl create-cluster hashtable install_server.sh redis-copy.rb redis_init_script.tpl releasetools whatisdoing.sh[root@localhost utils]# sh install_server.sh Welcome to the redis service installerThis script will help you easily set up a running redis serverPlease select the redis port for this instance: [6379] Selecting default: 6379Please select the redis config file name [/etc/redis/6379.conf] Selected default - /etc/redis/6379.confPlease select the redis log file name [/var/log/redis_6379.log] Selected default - /var/log/redis_6379.logPlease select the data directory for this instance [/var/lib/redis/6379] Selected default - /var/lib/redis/6379Please select the redis executable path [/usr/local/zzdct/redis-server] Selected config:Port : 6379Config file : /etc/redis/6379.confLog file : /var/log/redis_6379.logData dir : /var/lib/redis/6379Executable : /usr/local/zzdct/redis-serverCli Executable : /usr/local/zzdct/redis-cliIs this ok? Then press ENTER to go on or Ctrl-C to abort.Copied /tmp/6379.conf => /etc/init.d/redis_6379Installing service...Successfully added to chkconfig!Successfully added to runlevels 345!Starting Redis server...Installation successful!配置文件[root@localhost redis-3.2.9]# cat /etc/redis/6379.conf | grep -v "^#" | grep -v "^$"zzdctd 127.0.0.1 #绑定本机地址,可以再加上本机ip用空格隔开,如192.168.160.168protected-mode yesport 6379 #监听端口tcp-backlog 511timeout 0tcp-keepalive 300daemonize yes #以守护进程模式启动supervised nopidfile /data/redis_cluster/redis_6379/pid/redis_6379.pid #pid文件所在路径loglevel noticelogfile /data/redis_cluster/redis_6379/logs/redis_6379.log #log文件所在路径databases 16 #数据库的数量save 900 1save 300 10save 60 10000stop-writes-on-bgsave-error yesrdbcompression yesrdbchecksum yesdbfilename redis_6379.rdb #指定本地持久化文件的文件名,默认dump.rdbdir /var/lib/redis/6379 #本地数据库的目录,持久化文件路径slave-serve-stale-data yesslave-read-only yesrepl-diskless-sync norepl-diskless-sync-delay 5repl-disable-tcp-nodelay noslave-priority 100appendonly noappendfilename "appendonly.aof"appendfsync everysecno-appendfsync-on-rewrite noauto-aof-rewrite-percentage 100auto-aof-rewrite-min-size 64mbaof-load-truncated yeslua-time-limit 5000slowlog-log-slower-than 10000slowlog-max-len 128latency-monitor-threshold 0notify-keyspace-events ""hash-max-ziplist-entries 512hash-max-ziplist-value 64list-max-ziplist-size -2list-compress-depth 0set-max-intset-entries 512zset-max-ziplist-entries 128zset-max-ziplist-value 64hll-sparse-max-bytes 3000activerehashing yesclient-output-buffer-limit normal 0 0 0client-output-buffer-limit slave 256mb 64mb 60client-output-buffer-limit pubsub 32mb 8mb 60hz 10aof-rewrite-incremental-fsync yes启动和查看redis[root@localhost pid]# redis-server /data/redis_cluster/redis_6379//conf/redis_6379.conf #另外指定了配置文件[root@localhost pid]# ps aux | grep redisroot 77842 0.1 0.1 136976 2184 ? Ssl 21:30 0:02 /usr/local/zzdct/redis-server 127.0.0.1:6379root 78838 0.0 0.0 112712 960 pts/0 R+ 22:04 0:00 grep --color=auto redis[root@localhost pid]# systemctl status redisUnit redis.service could not be found.[root@localhost pid]# netstat -tunlp | grep redistcp 0 0 127.0.0.1:6379 0.0.0.0:* LISTEN 77842/redis-server建个文件/data/redis_cluster/redis_6379/conf/redis_6379.conf,将有我注释的那些配置写入(最好将主配置文件较为完整的复制过来),同时将这个文件include到/etc/redis/6379.conf,上边的配置文件某些注释的配置是我已经修改过的。/data/redis_cluster/redis_6379/logs/redis_6379.log和/data/redis_cluster/redis_6379/pid/redis_6379.pid文件页准备好

附:


自行安装的软件后各类可执行命令放在/usr/local/zzdct

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。