当前位置: 首页 > Linux

Redis安装配置

时间:2023-04-06 02:53:05 Linux

下载软件包wgethttp://download.redis.io/releases/redis-5.0.5.tar.gz编译安装tar-xzvfredis-5.0.5.tar.gzyuminstallgcc-y'makeMALLOC=libc'OR'**yuminstall-yjemalloc**'//--https://blog.csdn.net/qq_37859539/article/details/83715803cdredis-5.0.5makePREFIX=/data1/srv/redisinstallcpredis.conf/data1/srv/redis/bin/修改配置文件[root@bluse/]#cat/data1/srv/redis/bin/redis.confbind192.168.1.242protected-modeyesport6379tcp-backlog511timeout0tcp-keepalive300daemonizeyessupervisednopidfile/var/run/redis_6379.pidloglevelnoticelogfile""databases16always-show-logoyessave9001save30010save6010000stop-writes-on-bgsave-erroryesrdbcompressionyesrdbchecksumyesdbfilenamedump.rdbdir/data1/srv/redis/binreplica-serve-stale-datayesreplica-read-onlyyesrepl-diskless-syncnorepl-diskless-sync-delay5repl-disable-tcp-nodelaynoreplica-priority100lazyfree-lazy-evictionnolazyfree-lazy-expirenolazyfree-lazy-server-delnoreplica-lazy-flushnoappendonlynoappendfilename"appendonly.aof"appendfsynceverysecno-appendfsync-on-rewritenoauto-aof-rewrite-percentage100auto-aof-rewrite-min-size64mbaof-load-truncatedyesaof-use-rdb-preambleyeslua-time-limit5000slowlog-日志比10000slowlog-max-len128latency-monitor-threshold0notify-keyspace-events“”hash-max-ziplist-entries512hash-max-ziplist-value64list-max-ziplist-size-2list-compress-depth0set-max-intset-entries512zset-max-ziplist-entries128zset-max-ziplist-value64hll-sparse-max-bytes3000stream-node-max-bytes4096stream-node-max-entries100activerehashingyesclient-output-buffer-limit正常000client-output-buffer-limitreplica256mb64mb60client-output-buffer-limitpubsub32mb8mb60hz10dynamic-hzyesaof-rewrite-incremental-fsyncyesrdb-save-incremental-fsyncyesrequirepass密码配置启动服务[root@bluse/]#cat/usr/lib/systemd/system/redis.service[Unit]Description=RedisAfter=network.target[Service]Type=forkingPIDFile=/var/run/redis_6379.pidExecStart=/data1/srv/redis/bin/redis-server/data1/srv/redis/bin/redis.confExecReload=/bin/kill-sHUP$MAINPIDExecStop=/bin/kill-sQUIT$MAINPIDPrivateTmp=true[Install]WantedBy=multi-user.target[Install]WantedBy=multi-user.target[Unit]表示这是基本信息Description是描述After就是启动之后service,一般在网络服务启动后启动[Service]表示这是服务信息ExecStart是启动服务的命令ExecStop是停止服务的命令[Install]表示这是安装相关信息WantedBy怎么办start:multi-user.target指示当系统以多用户模式(默认运行级别)启动时应自动启动此服务。systemctldaemon-reloadsystemctl启用redis&&systemctl启动redis