add-apt-repository ppa:openjdk-r/ppa
apt-get update
apt-get install -y openjdk-8-jdk unzip
java -version #检查版本
vi /etc/security/limits.conf #底部增加,如果已有65535要改为65536
* soft nofile 65536
* hard nofile 131072
* soft nproc 65535
* hard nproc 65535
echo "vm.max_map_count = 655360" >>/etc/sysctl.conf
sysctl -p
wget http://mirror.xrk.org/elk/elasticsearch-6.3.2.tar.gz
tar zxvf elasticsearch-6.3.2.tar.gz && mkdir /data
mv elasticsearch-6.3.2 elasticsearch && mv elasticsearch /data/
useradd elastic && mkdir /home/elastic
passwd elastic
vi /data/elasticsearch/config/elasticsearch.yml #修改以下配置
path.data: /path/to/data #数据存放路径,默认软件目录下data
path.logs: /path/to/logs #日志存放路径,默认软件目录下logs
network.host: 0.0.0.0
http.port: 9200
-Xms3g
-Xmx3g
chown -R elastic:elastic /data/elasticsearch/
su - elastic -c "/data/elasticsearch/bin/elasticsearch -d"
tail -f /data/elasticsearch/logs/elasticsearch.log
curl localhost:9200
wget http://mirror.cnop.net/elk/kibana-6.3.2-linux-x86_64.tar.gz
tar zxvf kibana-6.3.2-linux-x86_64.tar.gz
mv kibana-6.3.2-linux-x86_64 /data/kibana
vi /data/kibana/config/kibana.yml #去除下面注释
server.port: 5601 #监听的端口
server.host: "0.0.0.0" #监听的地址
elasticsearch.url: "http://localhost:9200" #elasticsearch访问的URL地址
chown -R elastic:elastic /data/kibana
su - elastic -c " /data/kibana/bin/kibana &"
http://ip:5601
xpack.security.enabled: false #关闭x-pack
{"license":{"uid":"72ee62fb-865a-4887-9c87-168fe12a1265","type":"platinum","issue_date_in_millis":1530230400000,"expiry_date_in_millis":4102329600000,"max_nodes":100,"issued_to":"jin king (ccn)","issuer":"Web Form","signature":"AAAAAwAAAA02Dgj8/hUDfzKEQ2nrAAABmC9ZN0hjZDBGYnVyRXpCOW5Bb3FjZDAxOWpSbTVoMVZwUzRxVk1PSmkxaktJRVl5MUYvUWh3bHZVUTllbXNPbzBUemtnbWpBbmlWRmRZb25KNFlBR2x0TXc2K2p1Y1VtMG1UQU9TRGZVSGRwaEJGUjE3bXd3LzRqZ05iLzRteWFNekdxRGpIYlFwYkJiNUs0U1hTVlJKNVlXekMrSlVUdFIvV0FNeWdOYnlESDc3MWhlY3hSQmdKSjJ2ZTcvYlBFOHhPQlV3ZHdDQ0tHcG5uOElCaDJ4K1hob29xSG85N0kvTWV3THhlQk9NL01VMFRjNDZpZEVXeUtUMXIyMlIveFpJUkk2WUdveEZaME9XWitGUi9WNTZVQW1FMG1DenhZU0ZmeXlZakVEMjZFT2NvOWxpZGlqVmlHNC8rWVVUYzMwRGVySHpIdURzKzFiRDl4TmM1TUp2VTBOUlJZUlAyV0ZVL2kvVk10L0NsbXNFYVZwT3NSU082dFNNa2prQ0ZsclZ4NTltbU1CVE5lR09Bck93V2J1Y3c9PQAAAQAXQpVbyDECAris6ObPj0P88cyrfD5sCQjMTLn0Jm1Yr0+qPXmqlk2F8KiOU8XoEtk0hAtTRvD9e/aFVGliOJYxF6d5YOIuG3gbMsz1/jhj5boQkczr/fhTcLDC+3myoEswo9QhZmsLqgqfAeXr/Uj0T09/TUHQCi/GfhIg7jEvthlQeMyzvYoSFIe6/gmCib01Mwb2UyaWnTkgCnE3v3ZvwEV5nW884esGOJ6dAmrqCnaqddDKa4N0CfNq49yPQVlJktAcuVViZF3eaIzA2+XhKLVvvvtdrxPvWeUNUxvJf9vbfaThbhleK9aR4Ym9QSNDwfhVww9nt21+UW2xESHw","start_date_in_millis":1534809600000}}
su - elastic -c "/data/elasticsearch/bin/elasticsearch -d"
curl -XPUT -u elastic 'http://localhost:9200/_xpack/license' -H "Content-Type: application/json" -d @license.json
#xpack.security.enabled: false
xpack.security.transport.ssl.enabled: true
su - elastic -c "/data/elasticsearch/bin/elasticsearch -d"
Changed password for user kibana
PASSWORD kibana = 8OStjU6EOwGt5IfI0TOY
Changed password for user logstash_system
PASSWORD logstash_system = eeukJVPaIJ5eIWKaRlbr
Changed password for user beats_system
PASSWORD beats_system = dd6df7p25RIgyFMQ3s7q
Changed password for user elastic
PASSWORD elastic = aGFf5WYVqd5juGxvgjDP
找到:
#elasticsearch.username: "user"
#elasticsearch.password: "pass"
替换成:
elasticsearch.username: "elastic"
elasticsearch.password: "aGFf5WYVqd5juGxvgjDP" #就是上一步生成的elastic的账号和密码
su - elastic -c " /data/kibana/bin/kibana &"
POST /indextest/_doc
{
"field1": "indextest this test field1",
"field2": "indextest this test field2"
}
yellow
GET /_cat/shards?h=index,shard,prirep,state,unassigned.reason| grep UNASSIGNED
PUT _settings
{
"number_of_replicas":0
}
[Unit]
Description=/etc/rc.local Compatibility
ConditionPathExists=/etc/rc.local
[Service]
Type=forking
ExecStart=/etc/rc.local start
TimeoutSec=0
StandardOutput=tty
RemainAfterExit=yes
SysVStartPriority=99
[Install]
WantedBy=multi-user.target
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
su - elastic -c "/data/elasticsearch/bin/elasticsearch -d"
su - elastic -c "/data/kibana/bin/kibana &"
exit 0
chmod 755 /etc/rc.local && systemctl enable rc-local && systemctl start rc-local.service
附件下载: https://www.cnop.net/uploadfile/2020/0611/20200611052432281.pdfreboot #重启下系统,查看是否开机启动。