标签:aging analysis call 账号 use 制作 cas exec word
本篇文章记录下自己部署ES引擎的步骤。希望能给各位带来一点帮助。
yum install docker
默认docker镜像文件及数据文件存放位置在/var/lib/docker目录下面
若该磁盘下容量不大,修改docker的数据卷位置(例:迁移到/data/docker目录下):
systemctl disable docker
systemctl stop docker
mkdir /data/docker
cp -R /var/lib/docker /data/docker
vi /lib/systemd/system/docker.service
在ExecStart 后面添加 --graph /data/docker
systemctl daemon-reload
systemctl start docker
systemctl enable docker
可以通过docker info 查看Docker Root Dir 来查看是否修改成功
中文插件使用IK插件,使用Dockerfile来制作镜像文件,Dockerfile如下:
FROM elasticsearch:6.5.3
RUN ./bin/elasticsearch-plugin install -b https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v6.5.3/elasticsearch-analysis-ik-6.5.3.zip
EXPOSE 9200
EXPOSE 9300
docker build -t elasticsearch-ik:6.5.3 .
docker save -o elasticsearch-ik.tar containerID
docker load -i elasticsearch-ik.tar -o elasticserch-ik:6.5.3
直接使用docker run 可能会出现以下问题:
ERROR: [4] bootstrap checks failed
[1]: max file descriptors [4096] for elasticsearch process is too low, increase to at least [65536]
[2]: max number of threads [1024] for user [hadoop] is too low, increase to at least [2048]
[3]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
[4]: system call filters failed to install; check the logs and fix your configuration or disable system call filters at your own risk
# 会出现其中的一个或多个
解决方法:
[1]文件描述符 => 修改/etc/security/limits.conf配置
esuser soft nofile 65536 # soft表示为超过这个值就会有warnning
esuser hadr nofile 100000 # hard则表示不能超过这个值
[2]线程数 => 修改/etc/security/limits.conf配置
esuser soft nproc 2048 # soft表示为超过这个值就会有warnning
esuser hard nproc 4096 # hard则表示不能超过这个值
[3]虚拟内存 => 修改配置文件/etc/sysctl.conf
vm.max_map_count=262144
[4]system call filters =>
在elasticsearch.yml中配置bootstrap.system_call_filter为false,注意要在Memory下面:
bootstrap.memory_lock: false
bootstrap.system_call_filter: false
修改完毕之后重启虚拟机
esuser这个用户酌情修改
mkdir /data/es
cd /data/es
docker run -p 9200:9200 -p 9300:9300 --name es-ik -v $PWD/conf:/config -v $PWD/logs:/logs -v $PWD/data:/data --privileged=true -d containerID
docker pull mysql:5.7
mkdir /data/mysql
cd /data/mysql
docker run -p 3306:3306 --name mysql5.7 -v $PWD/conf:/etc/mysql/conf.d -v $PWD/logs:/logs -v $PWD/data:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=123456 --privileged=true -d containerID --lower_case_table_names=1
-e MYSQL_ROOT_PASSWORD=123456 初始化mysql root账号的密码,务必修改!!!务必修改!!!务必修改!!!
--lower_case_table_names=1 酌情添加,这个目的是为了让mysql不区分大小写,这里建议不添加,在my.cnf里面配置
使用logstash-input-jdbc插件来进行数据同步:
FROM logstash:6.5.3
RUN ./bin/logstash-plugin install logstash-input-jdbc
RUN sed -i ‘s/^/#&/g‘ config/logstash.yml
CMD ["-f", "/config/logstash-mysql.conf"]
docker build -t logstash-jdbc:6.5.3 .
docker save -o logstash-jdbc.tar containerID
docker load -i logstash-jdbc.tar -o logstash-jdbc:6.5.3
mkdir /usr/local/logstash/conf
cd /usr/local/logstash/conf
wget https://dev.mysql.com/get/Downloads/Connector-J/mysql-connector-java-5.1.47.zip
unzip mysql-connector-java-5.1.47.zip #解压缩
cd mysql-connector-java-5.1.47
mv mysql-connector-java-5.1.47-bin.jar ../conf
vi logstash-mysql.conf
input{
jdbc{
jdbc_driver_library => "/config/mysql-connector-java-5.1.47-bin.jar"
jdbc_driver_class => "com.mysql.jdbc.Driver"
jdbc_connection_string => "jdbc:mysql://mysqlIP:3306/table?characterEncoding=UTF-8&useSSL=false"
jdbc_user => "root"
jdbc_password => "123456"
jdbc_default_timezone => "Asia/Shanghai"
statement => "select field1,field2 from table where updateTime > :sql_last_value"
jdbc_paging_enabled => "true"
jdbc_page_size => "50000"
schedule => "0 4 * * *"
}
}
output{
stdout{
codec => json_lines
}
elasticsearch{
hosts => ["esip:9200"]
index => "index"
document_type => "document_type"
document_id => "%{uuid}"
}
}
mysqlIP 和esip可以通过docker inspect containerID 来查看,修改之
docker run -d -P --name logstash-jdbc --privileged=true -v /usr/local/logstash/conf:/config containerID
[1]:https://github.com/medcl/elasticsearch-analysis-ik
[2]:https://www.elastic.co/guide/en/logstash/current/plugins-inputs-jdbc.html
标签:aging analysis call 账号 use 制作 cas exec word
原文地址:https://www.cnblogs.com/chinalxx/p/10348297.html