Skip to content

Commit ceb8b3d

Browse files
committed
修改readme,增加挂起注释,增加elkf的删除
1 parent 90fe810 commit ceb8b3d

File tree

6 files changed

+216
-12
lines changed

6 files changed

+216
-12
lines changed

README.md

Lines changed: 61 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,18 @@ ubnutu 16.04
1818
- php (5.6.30 7.1.6)
1919
- redis (4.0.0)
2020
- mysql (5.6 5.7)
21-
2. 软件安装包存放在云盘,需要先下载到`./src/`的目录中
21+
2. 软件安装包存放在云盘,需要先下载到 `./src/` 的目录中
2222

2323

2424
# 安装说明
2525

2626

27-
1. /usr/local/xxx 安装目录
28-
2. /data/xxx 数据目录
29-
3. /usr/local/xxx/etc /usr/local/xxx/conf/ 配置目录
30-
4. /data/logs/xxx 日志
27+
1. `/usr/local/xxx` 安装目录
28+
2. `/data/xxx` 数据目录
29+
3. `/usr/local/xxx/etc` `/usr/local/xxx/conf/` 配置目录
30+
4. `/data/logs/xxx` 日志
3131

32-
> xxx指的是安装软件的名字,具体有(nginx,redis,php,mysql)
32+
> `xxx` 指的是安装软件的名字,具体有(nginx,redis,php,mysql)
3333
3434
# 具体操作
3535

@@ -48,7 +48,7 @@ git clone https://github.com/kamly/automated-operation.git
4848

4949
软件安装包存放在[云盘](https://pan.baidu.com/s/1jJYgAN0)
5050

51-
先下载到本地,然后上传到服务器的`./src/`目录中
51+
先下载到本地,然后上传到服务器的 `./src/` 目录中
5252

5353
## ./install.sh
5454

@@ -91,11 +91,64 @@ git clone https://github.com/kamly/automated-operation.git
9191
执行之后
9292
![](http://ww1.sinaimg.cn/large/8c2e9604gy1fob9txsejij21re14e4cg.jpg)
9393

94+
6. 是否安装 elasticsearxh
95+
96+
7. 是否安装 kibana
97+
98+
8. 是否安装 filebeat
99+
100+
9. 是否安装 logstash
101+
94102

95103
## ./uninstall.sh
96104

97-
执行卸载命令 ./uninstall.sh
105+
执行卸载命令 `./uninstall.sh`
98106

99107
选择
100108
![](http://ww1.sinaimg.cn/large/8c2e9604gy1foba8kkyl9j21rg0ycahh.jpg)
101109

110+
111+
## ./reset_mysql_pwd.sh
112+
113+
执行重置 mysql 密码命令 `./reset_mysql_pwd.sh`
114+
115+
## ./reset_redis_pwd.sh
116+
117+
执行重置 redis 密码命令 `./reset_redis_pwd.sh`
118+
119+
## ./mysql_back_import.sh
120+
121+
备份命令 `./mysql_backup_import.sh backup`
122+
123+
导入命令(指定日期) `./mysql_backup_import.sh import 20180211`
124+
125+
## ./redis_back_import.sh
126+
127+
备份命令 `./redis_backup_import.sh backup`
128+
129+
导入命令(指定日期) `./redis_backup_import.sh import 20180211`
130+
131+
132+
## ./vhost
133+
134+
添加域名 `./vhost.sh add`
135+
删除域名 `./vhost.sh del`
136+
137+
## ./is_crontab_on.sh
138+
139+
检查是否有 "xxx" 任务 `./is_crontab_on.sh "30 8 * * * /data/sh/start_daily_check.sh"`
140+
141+
## ./turn_on_crontab.sh
142+
143+
启动 "xxx" 任务 `./turn_on_crontab.sh "30 8 * * * /data/sh/start_daily_check.sh"`
144+
145+
## ./turn_off_crontab.sh
146+
147+
关闭 "xxx" 任务 `./turn_on_crontab.sh "30 8 * * * /data/sh/start_daily_check.sh"`
148+
149+
150+
## ./vim.sh
151+
152+
安装 vim 插件 Syntastic(语法检测),SimpylFold(折叠), NERDTree(文件树), VimAirLine(状态栏),Taglist(函数栏),Theme(主题) `./vim.sh -all`
153+
154+

include/common.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,8 @@ kibana_port=5601 # 默认端口
175175
kibana_gz="kibana-6.2.2-linux-x86_64.tar.gz" # 压缩包
176176
kibana_version="kibana-6.2.2-linux-x86_64" # 版本
177177

178+
kibana_log="/data/logs/kibana" # 日志
179+
178180
# filebeat
179181
# https://artifacts.elastic.co/downloads/beats/filebeat/filebeat-6.2.2-linux-x86_64.tar.gz 下载地址
180182

@@ -183,6 +185,8 @@ filebeat_install_dir="/usr/local/filebeat"
183185
filebeat_gz="filebeat-6.2.2-linux-x86_64.tar.gz" # 压缩包
184186
filebeat_version="filebeat-6.2.2-linux-x86_64" # 版本
185187

188+
filebeat_log="/data/logs/filebeat" # 日志
189+
186190
# logstash
187191
# https://artifacts.elastic.co/downloads/logstash/logstash-6.2.2.tar.gz
188192

@@ -191,5 +195,5 @@ logstash_install_dir="/usr/local/logstash"
191195
logstash_gz="logstash-6.2.2.tar.gz" # 压缩包
192196
logstash_version="logstash-6.2.2" # 版本
193197

194-
198+
logstash_log="/data/logs/logstash" # 日志
195199

include/filebeat.sh

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ popd # 切换
1313
# 复制配置文件
1414
cp ./conf/filebeat.yml $filebeat_install_dir/filebeat.yml
1515

16-
# 测试 ./filebeat -c ./filebeat.yml -configtest
17-
# 启动 ./filebeat -c ./filebeat.yml -e
16+
# 新建日志目录
17+
mkdir $filebeat_log
18+
19+
# 测试 /usr/local/filebeat/filebeat -c /usr/local/filebeat/filebeat.yml -configtest
20+
# 启动 /usr/local/filebeat/filebeat -c /usr/local/filebeat/filebeat.yml-e
21+
# 挂起 nohup /usr/local/filebeat/filebeat -e -c /usr/local/filebeat/filebeat.yml >> /data/logs/filebeat/`date -d "now" +%Y-%m-%d`.log 2>&1 &
1822

include/kibana.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,12 @@ mv $kibana_version $kibana_install_dir
1212
sed -i "s@#server.port: [email protected]: ${kibana_port}@g" $kibana_install_dir/config/kibana.yml # 端口
1313
sed -i "s@#server.host: \"localhost\"@#server.host: \"0.0.0.0\"@g" $kibana_install_dir/config/kibana.yml # 外网访问
1414

15+
# 新建日志目录
16+
mkdir $kibana_log
1517

1618
popd # 切换
1719

1820
# 需要 启动 elasticsearch 然后再启动 kibana ,访问 xxx:5601
1921
# 启动 ./bin/kibana
22+
# 挂起 nohup /usr/local/kibana/bin/kibana >> /data/logs/kibana/`date -d "now" +%Y-%m-%d`.log 2>&1 &
2023

include/logstash.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,15 @@ tar -zxvf $logstash_gz
88
# 移动目录 + 重命名
99
mv $logstash_version $logstash_install_dir
1010

11+
# 新建日志目录
12+
mkdir $logstash_log
13+
1114
popd # 切换
1215

1316
# 复制配置文件
1417
cp ./conf/logstash.conf $logstash_install_dir/logstash.conf
1518

1619
# 测试 ./bin/logstash -f ./config/logstash.conf -t
1720
# 启动 ./bin/logstash -f ./config/logstash.conf
18-
21+
# 挂起 nohup /usr/local/logstash/bin/logstash -f /usr/local/logstash/config/logstash.conf >> /data/logs/logstash/`date -d "now" +%Y-%m-%d`.log 2>&1 &
1922

uninstall.sh

Lines changed: 137 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,3 +210,140 @@ uninstall_mysql(){
210210
esac
211211
}
212212
uninstall_mysql
213+
214+
215+
216+
217+
# 卸载 elasticsearch
218+
uninstall_elasticsearch(){
219+
220+
echo -e "$YELLOW"
221+
read -p "Please Choose Uninstall elasticsearch or Not! ( y,Y/n,N )" uninstall_elasticsearch
222+
case $uninstall_elasticsearch in
223+
y|Y)
224+
if [ -d $elasticsearch_install_dir ];then # 确认该目录是否存在
225+
226+
ps aux | grep elasticsearch | grep -v grep | awk '{ print $2 }' | xargs kill -9
227+
228+
# 删除 /data/xxx data/logs/xxx /usr/local/xxx
229+
rm -rf /data/elasticsearch /data/logs/elasticsearch /usr/local/elasticsearch
230+
231+
echo "Uninstall elasticsearch successful!"
232+
else
233+
echo
234+
echo -e "No elasticsearch Server installed in your system!!"
235+
fi
236+
;;
237+
n|N)
238+
echo
239+
echo "You select not uninstall elasticsearch!"
240+
;;
241+
*)
242+
echo
243+
echo "Input error to uninstall elasticsearch!!! "
244+
;;
245+
esac
246+
}
247+
uninstall_elasticsearch
248+
249+
250+
# 卸载 kibana
251+
uninstall_kibana(){
252+
253+
echo -e "$YELLOW"
254+
read -p "Please Choose Uninstall kibana or Not! ( y,Y/n,N )" uninstall_kibana
255+
case $uninstall_kibana in
256+
y|Y)
257+
if [ -d $kibana_install_dir ];then # 确认该目录是否存在
258+
259+
ps aux | grep kibana | grep -v grep | awk '{ print $2 }' | xargs kill -9
260+
261+
# 删除 data/logs/xxx /usr/local/xxx
262+
rm -rf /data/logs/kibana /usr/local/kibana
263+
264+
echo "Uninstall kibana successful!"
265+
else
266+
echo
267+
echo -e "No kibana Server installed in your system!!"
268+
fi
269+
;;
270+
n|N)
271+
echo
272+
echo "You select not uninstall kibana!"
273+
;;
274+
*)
275+
echo
276+
echo "Input error to uninstall kibana!!! "
277+
;;
278+
esac
279+
}
280+
uninstall_kibana
281+
282+
283+
284+
# 卸载 filebeat
285+
uninstall_filebeat(){
286+
287+
echo -e "$YELLOW"
288+
read -p "Please Choose Uninstall filebeat or Not! ( y,Y/n,N )" uninstall_filebeat
289+
case $uninstall_filebeat in
290+
y|Y)
291+
if [ -d $filebeat_install_dir ];then # 确认该目录是否存在
292+
293+
ps aux | grep filebeat | grep -v grep | awk '{ print $2 }' | xargs kill -9
294+
295+
# 删除 data/logs/xxx /usr/local/xxx
296+
rm -rf /data/logs/filebeat /usr/local/filebeat
297+
298+
echo "Uninstall filebeat successful!"
299+
else
300+
echo
301+
echo -e "No filebeat Server installed in your system!!"
302+
fi
303+
;;
304+
n|N)
305+
echo
306+
echo "You select not uninstall filebeat!"
307+
;;
308+
*)
309+
echo
310+
echo "Input error to uninstall filebeat!!! "
311+
;;
312+
esac
313+
}
314+
uninstall_filebeat
315+
316+
317+
# 卸载 logstash
318+
uninstall_logstash(){
319+
320+
echo -e "$YELLOW"
321+
read -p "Please Choose Uninstall logstash or Not! ( y,Y/n,N )" uninstall_logstash
322+
case $uninstall_logstash in
323+
y|Y)
324+
if [ -d $logstash_install_dir ];then # 确认该目录是否存在
325+
326+
ps aux | grep logstash | grep -v grep | awk '{ print $2 }' | xargs kill -9
327+
328+
# 删除 data/logs/xxx /usr/local/xxx
329+
rm -rf /data/logs/logstash /usr/local/logstash
330+
331+
echo "Uninstall logstash successful!"
332+
else
333+
echo
334+
echo -e "No logstash Server installed in your system!!"
335+
fi
336+
;;
337+
n|N)
338+
echo
339+
echo "You select not uninstall logstash!"
340+
;;
341+
*)
342+
echo
343+
echo "Input error to uninstall logstash!!! "
344+
;;
345+
esac
346+
}
347+
uninstall_logstash
348+
349+

0 commit comments

Comments
 (0)