Skip to content

Commit a792dcf

Browse files
committed
2017-02-23补充redis材料
1 parent afb19c8 commit a792dcf

File tree

4 files changed

+50
-5
lines changed

4 files changed

+50
-5
lines changed

Redis-Install-And-Settings.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,14 @@
3030
- 关闭客户端:`redis-cli shutdown`
3131
- 开机启动配置:`echo "/usr/local/bin/redis-server /etc/redis.conf" >> /etc/rc.local`
3232
- 开放防火墙端口:
33-
- 添加规则:`sudo iptables -I INPUT -p tcp -m tcp --dport 6379 -j ACCEPT`
34-
- 保存规则:`sudo /etc/rc.d/init.d/iptables save`
35-
- 重启 iptables:`sudo service iptables restart`
33+
- 添加规则:`iptables -I INPUT -p tcp -m tcp --dport 6379 -j ACCEPT`
34+
- 保存规则:`service iptables save`
35+
- 重启 iptables:`service iptables restart`
3636

3737

3838
## Redis 配置
3939

40-
- 编辑配置文件:`vim /usr/program/redis-3.0.7/redis.conf`
40+
- 编辑配置文件:`vim /etc/redis.conf`
4141
- Redis 默认的配置文件内容:
4242

4343
``` ini
@@ -96,7 +96,7 @@ aof-rewrite-incremental-fsync yes
9696

9797
## 设置 Redis 请求密码
9898

99-
- 打开 `vim /usr/program/redis-3.0.7/redis.conf` 配置文件,找到默认是被注释的这一行:`# requirepass foobared`
99+
- 打开 `vim /etc/redis.conf` 配置文件,找到默认是被注释的这一行:`# requirepass foobared`
100100
- 去掉注释,把 `foobared` 改为你想要设置的密码,比如我打算设置为:123456,所以我改为:`requirepass 123456`
101101
- 修改之后重启下服务
102102
- 有了密码之后,进入客户端,就得这样访问:`redis-cli -h 127.0.0.1 -p 6379 -a 123456 `

favorite-file/shell/install_mysql.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,4 +48,10 @@ ln -s /usr/program/mysql/bin/mysqlslap /usr/bin
4848

4949
ln -s /usr/program/mysql/data/mysql.sock /tmp/mysql.sock
5050

51+
iptables -I INPUT -p tcp -m tcp --dport 3306 -j ACCEPT
52+
53+
service iptables save
54+
55+
service iptables restart
56+
5157
echo "安装 mysql 结束,现在需要手动设置防火墙和禁用 selinux."

favorite-file/shell/install_nginx.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,10 @@ make
1818

1919
make install
2020

21+
iptables -I INPUT -p tcp -m tcp --dport 80 -j ACCEPT
22+
23+
service iptables save
24+
25+
service iptables restart
26+
2127
echo "完成安装 nginx,把端口加到防火墙中"
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#!/bin/sh
2+
3+
echo "安装开始"
4+
5+
yum install -y gcc-c++ tcl
6+
7+
cd /opt/setups
8+
9+
tar zxvf redis-3.2.8.tar.gz
10+
11+
mv redis-3.2.8/ /usr/program/
12+
13+
cd /usr/program/redis-3.2.8
14+
15+
make
16+
17+
make install
18+
19+
cp /usr/program/redis-3.2.8/redis.conf /etc/
20+
21+
sed -i 's/daemonize no/daemonize yes/g' /etc/redis.conf
22+
23+
echo "/usr/local/bin/redis-server /etc/redis.conf" >> /etc/rc.local
24+
25+
iptables -I INPUT -p tcp -m tcp --dport 6379 -j ACCEPT
26+
27+
service iptables save
28+
29+
service iptables restart
30+
31+
rm -rf /usr/program/redis-3.2.8
32+
33+
echo "安装结束"

0 commit comments

Comments
 (0)