2.nginx
2.1.安装PCRE库
[root@hadoop001 ~]# cd /usr/local/
[root@hadoop001 local]# tar -zxvf pcre-8.36.tar.gz
[root@hadoop001 local]# cd pcre-8.36
[root@hadoop001 pcre-8.36]# ./configure
[root@hadoop001 pcre-8.36]# make
[root@hadoop001 pcre-8.36]# make install
2.2.安装zlib库
[root@hadoop001 local]# cd /usr/local/
[root@hadoop001 local]# tar -zxvf zlib-1.2.8.tar.gz
[root@hadoop001 local]# cd zlib-1.2.8
[root@hadoop001 zlib-1.2.8]# ./configure
[root@hadoop001 zlib-1.2.8]# make
[root@hadoop001 zlib-1.2.8]# make install
#2.3.安装ssl
[root@hadoop001 local]# cd /usr/local/
[root@hadoop001 local]# tar -zxvf openssl-1.0.1j.tar.gz
[root@hadoop001 local]# cd openssl-1.0.1j
[root@hadoop001 openssl-1.0.1j]# ./config
[root@hadoop001 openssl-1.0.1j]# make
[root@hadoop001 openssl-1.0.1j]# make install
2.4.安装nginx
[root@hadoop001 local]# wget http://nginx.org/download/nginx-1.8.0.tar.gz
[root@hadoop001 local]# tar -zxvf nginx-1.8.0.tar.gz
[root@hadoop001 local]# cd nginx-1.8.0
[root@hadoop001 nginx-1.8.0]# ./configure --prefix=/usr/local/nginx --with-pcre=/usr/local/pcre-8.36 --with-zlib=/usr/local/zlib-1.2.8
[root@hadoop001 nginx-1.8.0]# make
[root@hadoop001 nginx-1.8.0]# make install
Configuration summary
+ using system PCRE library
+ OpenSSL library is not used
+ md5: using system crypto library
+ sha1: using system crypto library
+ using system zlib library
nginx path prefix: "/usr/local/nginx"
nginx binary file: "/usr/local/nginx/sbin/nginx"
nginx configuration prefix: "/usr/local/nginx/conf"
nginx configuration file: "/usr/local/nginx/conf/nginx.conf"
nginx pid file: "/usr/local/nginx/logs/nginx.pid"
nginx error log file: "/usr/local/nginx/logs/error.log"
nginx http access log file: "/usr/local/nginx/logs/access.log"
nginx http client request body temporary files: "client_body_temp"
nginx http proxy temporary files: "proxy_temp"
nginx http fastcgi temporary files: "fastcgi_temp"
nginx http uwsgi temporary files: "uwsgi_temp"
nginx http scgi temporary files: "scgi_temp"
停止httpd服务,启动Nginx:
[root@hadoop001 ~]# /usr/local/nginx/sbin/nginx
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] still could not bind()
[root@hadoop001 ~]# service httpd status
httpd (pid 2180) is running...
[root@hadoop001 ~]# service httpd stop
Stopping httpd: [ OK ]
启动:
[root@hadoop001 ~]# /usr/local/nginx/sbin/nginx
重启:
$ /usr/local/nginx/sbin/nginx -s reload
停止:
$ /usr/local/nginx/sbin/nginx -s stop
测试配置文件是否正常:
[root@hadoop001 ~]# /usr/local/nginx/sbin/nginx -t
nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful
[root@hadoop001 ~]#
强制关闭:
$ pkill nginx
kill -9 $(pgrep -f nginx)
浏览器打开:
http://192.168.137.131/
查看日志:
[root@hadoop001 logs]# tail -F access.log
修改nginx.conf,去掉以下参数,重启Nginx
[root@hadoop001 conf]# vi nginx.conf
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log logs/access.log main;
[root@hadoop001 conf]#/usr/local/nginx/sbin/nginx -s reload
3.ElasticSearch安装
创建elkuser用户
[root@hadoop001 ~]# useradd elkuser
[root@hadoop001 software]# java -version
java version "1.8.0_45"
Java(TM) SE Runtime Environment (build 1.8.0_45-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.45-b02, mixed mode)
[root@hadoop001 software]# wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.0.0.tar.gz
[root@hadoop001 software]# tar -xzf elasticsearch-5.4.0.tar.gz
[root@hadoop001 software]# cd elasticsearch-6.0.0
[root@hadoop001 elasticsearch-6.0.0]# ll
total 240
drwxr-xr-x. 2 root root 4096 Nov 25 13:42 bin
drwxr-xr-x. 2 root root 4096 Nov 11 02:42 config
drwxr-xr-x. 2 root root 4096 Nov 11 02:42 lib
-rw-r--r--. 1 root root 11358 Nov 11 02:39 LICENSE.txt
drwxr-xr-x. 14 root root 4096 Nov 11 02:42 modules
-rw-r--r--. 1 root root 193097 Nov 11 02:42 NOTICE.txt
drwxr-xr-x. 2 root root 4096 Nov 11 02:42 plugins
-rw-r--r--. 1 root root 9326 Nov 11 02:39 README.textile
[root@hadoop001 elasticsearch-6.0.0]# mkdir data logs
[root@hadoop001 elasticsearch-6.0.0]# cd config/
[root@hadoop001 config]# ll
total 16
-rw-rw----. 1 root root 2854 Nov 11 02:40 elasticsearch.yml
-rw-rw----. 1 root root 2672 Nov 11 02:40 jvm.options
-rw-rw----. 1 root root 5091 Nov 11 02:40 log4j2.properties
[root@hadoop001 config]# vi elasticsearch.yml
cluster.name: ruozedata_cluster
node.name: node131
path.data: /opt/software/elasticsearch-6.0.0/data
path.logs: /opt/software/elasticsearch-6.0.0/logs
network.host: 192.168.137.131
# ----------------------------------- Memory -----------------------------------
#
# Lock the memory on startup:
#
bootstrap.memory_lock: false
bootstrap.system_call_filter: false
# bin/elasticsearch 执行后会报错(解决办法如下:)
# useradd elkuser
# chown -R elkuser:elkuser elasticsearch-6.0.0
更改用户的家目录:
# vim /etc/passwd
elkuser:x:501:501::/opt/elk/elasticsearch-6.0.0:/bin/bash
[root@hadoop001 software]# su - elkuser
[elkuser@hadoop001 ~]$ cd /opt/software/elasticsearch-6.0.0/
[elkuser@hadoop001 elasticsearch-6.0.0]$ ./bin/elasticsearch -d
[elkuser@hadoop001 elasticsearch-6.0.0]$
[elkuser@hadoop001 elasticsearch-6.0.0]$
[elkuser@hadoop001 elasticsearch-6.0.0]$ curl -XGET '192.168.137.131:9200/?pretty'
{
"name" : "node131",
"cluster_name" : "ruozedata_cluster",
"cluster_uuid" : "oNbp-qMARf2m1pblJn6I4w",
"version" : {
"number" : "6.0.0",
"build_hash" : "8f0685b",
"build_date" : "2017-11-10T18:41:22.859Z",
"build_snapshot" : false,
"lucene_version" : "7.0.1",
"minimum_wire_compatibility_version" : "5.6.0",
"minimum_index_compatibility_version" : "5.0.0"
},
"tagline" : "You Know, for Search"
}
[elkuser@hadoop001 elasticsearch-6.0.0]$
[root@hadoop001 logs]# ps -ef|grep elastic
elkuser 3455 1 62 14:52 pts/1 00:00:22 /usr/java/jdk1.8.0_45/bin/java -Xms1g -Xmx1g -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:+AlwaysPreTouch -server -Xss1m -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Djna.nosys=true -XX:-OmitStackTraceInFastThrow -Dio.netty.noUnsafe=true -Dio.netty.noKeySetOptimization=true -Dio.netty.recycler.maxCapacityPerThread=0 -Dlog4j.shutdownHookEnabled=false -Dlog4j2.disable.jmx=true -XX:+HeapDumpOnOutOfMemoryError -Des.path.home=/opt/software/elasticsearch-6.0.0 -Des.path.conf=/opt/software/elasticsearch-6.0.0/config -cp /opt/software/elasticsearch-6.0.0/lib/* org.elasticsearch.bootstrap.Elasticsearch -d
root 3502 3367 0 14:53 pts/0 00:00:00 grep elastic
[root@hadoop001 logs]#
[root@hadoop001 logs]#
[root@hadoop001 logs]# netstat -nlp|grep 3455
tcp 0 0 ::ffff:192.168.137.131:9200 :::* LISTEN 3455/java
tcp 0 0 ::ffff:192.168.137.131:9300 :::* LISTEN 3455/java
[root@hadoop001 logs]#
2.1.安装PCRE库
[root@hadoop001 ~]# cd /usr/local/
[root@hadoop001 local]# tar -zxvf pcre-8.36.tar.gz
[root@hadoop001 local]# cd pcre-8.36
[root@hadoop001 pcre-8.36]# ./configure
[root@hadoop001 pcre-8.36]# make
[root@hadoop001 pcre-8.36]# make install
2.2.安装zlib库
[root@hadoop001 local]# cd /usr/local/
[root@hadoop001 local]# tar -zxvf zlib-1.2.8.tar.gz
[root@hadoop001 local]# cd zlib-1.2.8
[root@hadoop001 zlib-1.2.8]# ./configure
[root@hadoop001 zlib-1.2.8]# make
[root@hadoop001 zlib-1.2.8]# make install
#2.3.安装ssl
[root@hadoop001 local]# cd /usr/local/
[root@hadoop001 local]# tar -zxvf openssl-1.0.1j.tar.gz
[root@hadoop001 local]# cd openssl-1.0.1j
[root@hadoop001 openssl-1.0.1j]# ./config
[root@hadoop001 openssl-1.0.1j]# make
[root@hadoop001 openssl-1.0.1j]# make install
2.4.安装nginx
[root@hadoop001 local]# wget http://nginx.org/download/nginx-1.8.0.tar.gz
[root@hadoop001 local]# tar -zxvf nginx-1.8.0.tar.gz
[root@hadoop001 local]# cd nginx-1.8.0
[root@hadoop001 nginx-1.8.0]# ./configure --prefix=/usr/local/nginx --with-pcre=/usr/local/pcre-8.36 --with-zlib=/usr/local/zlib-1.2.8
[root@hadoop001 nginx-1.8.0]# make
[root@hadoop001 nginx-1.8.0]# make install
Configuration summary
+ using system PCRE library
+ OpenSSL library is not used
+ md5: using system crypto library
+ sha1: using system crypto library
+ using system zlib library
nginx path prefix: "/usr/local/nginx"
nginx binary file: "/usr/local/nginx/sbin/nginx"
nginx configuration prefix: "/usr/local/nginx/conf"
nginx configuration file: "/usr/local/nginx/conf/nginx.conf"
nginx pid file: "/usr/local/nginx/logs/nginx.pid"
nginx error log file: "/usr/local/nginx/logs/error.log"
nginx http access log file: "/usr/local/nginx/logs/access.log"
nginx http client request body temporary files: "client_body_temp"
nginx http proxy temporary files: "proxy_temp"
nginx http fastcgi temporary files: "fastcgi_temp"
nginx http uwsgi temporary files: "uwsgi_temp"
nginx http scgi temporary files: "scgi_temp"
停止httpd服务,启动Nginx:
[root@hadoop001 ~]# /usr/local/nginx/sbin/nginx
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] still could not bind()
[root@hadoop001 ~]# service httpd status
httpd (pid 2180) is running...
[root@hadoop001 ~]# service httpd stop
Stopping httpd: [ OK ]
启动:
[root@hadoop001 ~]# /usr/local/nginx/sbin/nginx
重启:
$ /usr/local/nginx/sbin/nginx -s reload
停止:
$ /usr/local/nginx/sbin/nginx -s stop
测试配置文件是否正常:
[root@hadoop001 ~]# /usr/local/nginx/sbin/nginx -t
nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful
[root@hadoop001 ~]#
强制关闭:
$ pkill nginx
kill -9 $(pgrep -f nginx)
浏览器打开:
http://192.168.137.131/
查看日志:
[root@hadoop001 logs]# tail -F access.log
修改nginx.conf,去掉以下参数,重启Nginx
[root@hadoop001 conf]# vi nginx.conf
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log logs/access.log main;
[root@hadoop001 conf]#/usr/local/nginx/sbin/nginx -s reload
3.ElasticSearch安装
创建elkuser用户
[root@hadoop001 ~]# useradd elkuser
[root@hadoop001 software]# java -version
java version "1.8.0_45"
Java(TM) SE Runtime Environment (build 1.8.0_45-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.45-b02, mixed mode)
[root@hadoop001 software]# wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.0.0.tar.gz
[root@hadoop001 software]# tar -xzf elasticsearch-5.4.0.tar.gz
[root@hadoop001 software]# cd elasticsearch-6.0.0
[root@hadoop001 elasticsearch-6.0.0]# ll
total 240
drwxr-xr-x. 2 root root 4096 Nov 25 13:42 bin
drwxr-xr-x. 2 root root 4096 Nov 11 02:42 config
drwxr-xr-x. 2 root root 4096 Nov 11 02:42 lib
-rw-r--r--. 1 root root 11358 Nov 11 02:39 LICENSE.txt
drwxr-xr-x. 14 root root 4096 Nov 11 02:42 modules
-rw-r--r--. 1 root root 193097 Nov 11 02:42 NOTICE.txt
drwxr-xr-x. 2 root root 4096 Nov 11 02:42 plugins
-rw-r--r--. 1 root root 9326 Nov 11 02:39 README.textile
[root@hadoop001 elasticsearch-6.0.0]# mkdir data logs
[root@hadoop001 elasticsearch-6.0.0]# cd config/
[root@hadoop001 config]# ll
total 16
-rw-rw----. 1 root root 2854 Nov 11 02:40 elasticsearch.yml
-rw-rw----. 1 root root 2672 Nov 11 02:40 jvm.options
-rw-rw----. 1 root root 5091 Nov 11 02:40 log4j2.properties
[root@hadoop001 config]# vi elasticsearch.yml
cluster.name: ruozedata_cluster
node.name: node131
path.data: /opt/software/elasticsearch-6.0.0/data
path.logs: /opt/software/elasticsearch-6.0.0/logs
network.host: 192.168.137.131
# ----------------------------------- Memory -----------------------------------
#
# Lock the memory on startup:
#
bootstrap.memory_lock: false
bootstrap.system_call_filter: false
# bin/elasticsearch 执行后会报错(解决办法如下:)
# useradd elkuser
# chown -R elkuser:elkuser elasticsearch-6.0.0
更改用户的家目录:
# vim /etc/passwd
elkuser:x:501:501::/opt/elk/elasticsearch-6.0.0:/bin/bash
[root@hadoop001 software]# su - elkuser
[elkuser@hadoop001 ~]$ cd /opt/software/elasticsearch-6.0.0/
[elkuser@hadoop001 elasticsearch-6.0.0]$ ./bin/elasticsearch -d
[elkuser@hadoop001 elasticsearch-6.0.0]$
[elkuser@hadoop001 elasticsearch-6.0.0]$
[elkuser@hadoop001 elasticsearch-6.0.0]$ curl -XGET '192.168.137.131:9200/?pretty'
{
"name" : "node131",
"cluster_name" : "ruozedata_cluster",
"cluster_uuid" : "oNbp-qMARf2m1pblJn6I4w",
"version" : {
"number" : "6.0.0",
"build_hash" : "8f0685b",
"build_date" : "2017-11-10T18:41:22.859Z",
"build_snapshot" : false,
"lucene_version" : "7.0.1",
"minimum_wire_compatibility_version" : "5.6.0",
"minimum_index_compatibility_version" : "5.0.0"
},
"tagline" : "You Know, for Search"
}
[elkuser@hadoop001 elasticsearch-6.0.0]$
[root@hadoop001 logs]# ps -ef|grep elastic
elkuser 3455 1 62 14:52 pts/1 00:00:22 /usr/java/jdk1.8.0_45/bin/java -Xms1g -Xmx1g -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:+AlwaysPreTouch -server -Xss1m -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Djna.nosys=true -XX:-OmitStackTraceInFastThrow -Dio.netty.noUnsafe=true -Dio.netty.noKeySetOptimization=true -Dio.netty.recycler.maxCapacityPerThread=0 -Dlog4j.shutdownHookEnabled=false -Dlog4j2.disable.jmx=true -XX:+HeapDumpOnOutOfMemoryError -Des.path.home=/opt/software/elasticsearch-6.0.0 -Des.path.conf=/opt/software/elasticsearch-6.0.0/config -cp /opt/software/elasticsearch-6.0.0/lib/* org.elasticsearch.bootstrap.Elasticsearch -d
root 3502 3367 0 14:53 pts/0 00:00:00 grep elastic
[root@hadoop001 logs]#
[root@hadoop001 logs]#
[root@hadoop001 logs]# netstat -nlp|grep 3455
tcp 0 0 ::ffff:192.168.137.131:9200 :::* LISTEN 3455/java
tcp 0 0 ::ffff:192.168.137.131:9300 :::* LISTEN 3455/java
[root@hadoop001 logs]#