小程序模板做视频网站,北京优化网站方法,什么学做网站,图书宣传推广方案目录
一、文件下载
二、创建linux es用户
三、上传、解压canal、es、kibana
四、配置es通讯证书#xff08;生成证书给es配置使用#xff09;
五、配置elastisearch
六、修改系统配置
七、添加ik分词器支持#xff08;可选#xff09;
八、给文件赋值权限
九、设置…目录
一、文件下载
二、创建linux es用户
三、上传、解压canal、es、kibana
四、配置es通讯证书生成证书给es配置使用
五、配置elastisearch
六、修改系统配置
七、添加ik分词器支持可选
八、给文件赋值权限
九、设置密码
十、启动
十一、测试 一、文件下载
canal.adapter-1.1.5canal.deployer-1.1.5canal.admin-1.1.5elasticsearch-7.9.0kibana-7.9.0elasticsearch-analysis-ik-7.9.0.zip
二、创建linux es用户
因为安全问题Elasticsearch 不允许 root 用户直接运行所以要在每个节点中创建新用户在 root 用户中创建新用户。
#新增 es-cluster 用户
useradd es-cluster
#为 es-cluster 用户设置密码
passwd es-cluster
#如果错了可以删除再加
userdel -r es-cluster
#文件夹所有者
chown -R es-cluster:es-cluster /data/es-cluster 三、上传、解压canal、es、kibana到linux目录/data/soft/es-cluster下
## 解压文件到指定文件夹
tar -zxvf xx.tar.gz -C /data/soft/es-cluster
把解压的elasticsearch-7.9.0复制两份一主二从复制到 /data/soft/es-cluster/es-node分别命名为elasticsearch-7.9.0-node-1、elasticsearch-7.9.0-node-2、elasticsearch-7.9.0-node-3 四、配置es通讯证书生成证书给es配置使用
进到 /data/soft/es-cluster/es-node/elasticsearch-7.9.0-node-1/bin目录下执行以下代码生成ca证书默认生成的ca默认放在es根目录ca.zip
./elasticsearch-certutil ca --pem --out ca.zip --days 365000 -s
解压ca.zip到 es根目录/ca (命令unzip ca.zip)里边有两个文件ca.key、ca.crt。进到 /data/soft/es-cluster/es-node/elasticsearch-7.9.0-node-1/bin目录下执行以下命令生成za.test.zip文件
./elasticsearch-certutil cert --ca-cert ca/ca.crt --ca-key ca/ca.key --pem --name za-test --out za-test.zip --days 365000 -s
解压za.test.zip文件把这个文件里的所有文件分别复制到/data/soft/es-cluster/es-node/elasticsearch-7.9.0-node-1/config/certs、data/soft/es-cluster/es-node/elasticsearch-7.9.0-node-2/config/certs、data/soft/es-cluster/es-node/elasticsearch-7.9.0-node-3/config/certs下(没有certs目录,自己建一个)查看证书有效期
openssl x509 -in ca.crt -noout -dates
五、配置elastisearch
修改es配置文件 /data/soft/es-cluster/es-node/elasticsearch-7.9.0-node-1/config/elasticsearch.yml
#集群名称(随便起但是需要跟其他两个节点保持一致)
cluster.name: cluster-es
#节点名称每个节点的名称不能重复
node.name: node-1
#ip 地址每个节点的地址不能重复(填localhost访问不了)
network.host: 111.111.11.111
#是不是有资格主节点
node.master: true
node.data: true
http.port: 9201
transport.tcp.port: 9301
# head 插件需要这打开这两个配置
http.cors.allow-origin: *
http.cors.enabled: true
http.max_content_length: 200mb
#es7.x 之后新增的配置初始化一个新的集群时需要此配置来选举 master.(子节点不需要配置)
cluster.initial_master_nodes: [node-1]
#es7.x 之后新增的配置节点发现localhost节点没法找到主节点无法加入集群。因为是在同一台机器搭建集群所以用端口区分如果在不同的机器可以保持端口一致。
discovery.seed_hosts: [111.111.111.11:9301,111.111.111.11:9302,111.111.11.111:9303]
gateway.recover_after_nodes: 2
network.tcp.keep_alive: true
network.tcp.no_delay: true
transport.tcp.compress: true
#集群内同时启动的数据任务个数默认是 2 个
cluster.routing.allocation.cluster_concurrent_rebalance: 16
#添加或删除节点及负载均衡时并发恢复的线程个数默认 4 个
cluster.routing.allocation.node_concurrent_recoveries: 16
#初始化数据恢复时并发恢复线程的个数默认 4 个
cluster.routing.allocation.node_initial_primaries_recoveries: 16
#索引自動創建
action.auto_create_index: first*,-canal_*,.watches*,.triggered_watches,.watcher-history-*,.kibana*,.ilm*,.tasks*,.apm*
#配置密碼(开始密码校验下边的验证模式使用certificate然后配置上边第四点生成的ca证书
xpack.security.enabled: true
#xpack.license.self_generated.type: basic
xpack.security.transport.ssl.enabled: true
xpack.security.transport.ssl.verification_mode: certificate
xpack.security.transport.ssl.key: certs/za-test.key
xpack.security.transport.ssl.certificate: certs/za-test.crt
xpack.security.transport.ssl.certificate_authorities: certs/ca.crt
复制该配置到elasticsearch-7.9.0-node-2下替换config/elasticsearch.yml文件。替换后做以下修改
#集群名称
cluster.name: cluster-es
#节点名称每个节点的名称不能重复
node.name: node-2
#ip 地址每个节点的地址不能重复根据实际填写
network.host: 111.111.11.111
#是不是有资格主节点
node.master: true
node.data: true
http.port: 9202
transport.tcp.port: 9302
# head 插件需要这打开这两个配置
http.cors.allow-origin: *
http.cors.enabled: true
http.max_content_length: 200mb
#es7.x 之后新增的配置初始化一个新的集群时需要此配置来选举 master
#cluster.initial_master_nodes: [node-1]
#es7.x 之后新增的配置节点发现
discovery.seed_hosts: [111.111.11.111:9301,111.111.11.111:9302,111.111.11.111:9303]
gateway.recover_after_nodes: 2
network.tcp.keep_alive: true
network.tcp.no_delay: true
transport.tcp.compress: true
#集群内同时启动的数据任务个数默认是 2 个
cluster.routing.allocation.cluster_concurrent_rebalance: 16
#添加或删除节点及负载均衡时并发恢复的线程个数默认 4 个
cluster.routing.allocation.node_concurrent_recoveries: 16
#初始化数据恢复时并发恢复线程的个数默认 4 个
cluster.routing.allocation.node_initial_primaries_recoveries: 16
action.auto_create_index: first*,-canal_*,.watches*,.triggered_watches,.watcher-history-*,.kibana*,.ilm*,.tasks*,.apm*#配置密碼
xpack.security.enabled: true
#xpack.license.self_generated.type: basic
xpack.security.transport.ssl.enabled: true
xpack.security.transport.ssl.verification_mode: certificate
xpack.security.transport.ssl.key: certs/za-test.key
xpack.security.transport.ssl.certificate: certs/za-test.crt
xpack.security.transport.ssl.certificate_authorities: certs/ca.crt
data/soft/es-cluster/es-node/elasticsearch-7.9.0-node-3修改同理。
六、修改系统配置
修改/etc/security/limits.conf
# 注* 带表 Linux 所有用户名称
* soft nofile 65535
* hard nofile 65535
或者指定用户
es-cluster soft nofile 65535
es-cluster hard nofile 65535
修改/etc/security/limits.d/20-nproc.conf
es-cluster soft nofile 65536
es-cluster hard nofile 65536
* hard nproc 4096
修改/etc/sysctl.conf
# 在文件中增加下面内容
vm.max_map_count655360
重新加载配置
sysctl -p
七、添加ik分词器支持可选
解压elasticsearch-analysis-ik-7.9.0.zip文件到 ES 根目录下的 plugins 目录下重启 ES 即可使用。
使用ik分词器放进去后需要用root用户执行chown -R es-cluster:es-cluster /data/soft/es-cluster 如果某些内容需要自定义分词效果可以进行以下操作 首先进入 ES 根目录中的 plugins 文件夹下的 ik 文件夹进入 config 目录创建 custom.dic 文件写入你想要自定义分词的 词组。同时打开 IKAnalyzer.cfg.xml 文件将新建的custom.dic配置其中重启 ES 服务器。 ik分词器使用 GET http://localhost:9200/_analyze { text:测试单词, analyzer:ik_max_word } 或者在映射时候指定。
八、给文件赋值权限
# 文件夹所有者
chown -R es-cluster:es-cluster /data/es-cluster
切换es-cluster用户
su es-cluster
依次启动es注意首次启动因为没有log文件报错暂停切换root执行chown -R es-cluster:es-cluster /data/soft/es-cluster在切换回es用户启动即可
九、设置密码 在bin目录下执行./elasticsearch-setup-passwords interactive 依次设置密码es123456
十、启动# 启动
bin/elasticsearch
# 后台启动
bin/elasticsearch -d
十一、测试 浏览器访问111.111.11.111:9201/_cat/nodes
如果没法访问开放防火墙端口
firewall-cmd --zonepublic --add-port9201/tcp --permanent
firewall-cmd --reload
# 查看端口使用情况
netstat -ntlp //查看当前所有tcp端口·
netstat -ntulp |grep 8888 //查看所有1935端口使用情况·
第二章安装kibana待放置链接
第三章canal搭建待放置链接 文章转载自: http://www.morning.brzlp.cn.gov.cn.brzlp.cn http://www.morning.lgrkr.cn.gov.cn.lgrkr.cn http://www.morning.lqjlg.cn.gov.cn.lqjlg.cn http://www.morning.rgxcd.cn.gov.cn.rgxcd.cn http://www.morning.mjmtm.cn.gov.cn.mjmtm.cn http://www.morning.xstfp.cn.gov.cn.xstfp.cn http://www.morning.tthmg.cn.gov.cn.tthmg.cn http://www.morning.wfysn.cn.gov.cn.wfysn.cn http://www.morning.sfwfk.cn.gov.cn.sfwfk.cn http://www.morning.btmwd.cn.gov.cn.btmwd.cn http://www.morning.mwkwg.cn.gov.cn.mwkwg.cn http://www.morning.csjps.cn.gov.cn.csjps.cn http://www.morning.mllmm.cn.gov.cn.mllmm.cn http://www.morning.fgsct.cn.gov.cn.fgsct.cn http://www.morning.kjrlp.cn.gov.cn.kjrlp.cn http://www.morning.yodajy.cn.gov.cn.yodajy.cn http://www.morning.ckntb.cn.gov.cn.ckntb.cn http://www.morning.qbtkg.cn.gov.cn.qbtkg.cn http://www.morning.brld.cn.gov.cn.brld.cn http://www.morning.fbxlj.cn.gov.cn.fbxlj.cn http://www.morning.xpwdf.cn.gov.cn.xpwdf.cn http://www.morning.addai.cn.gov.cn.addai.cn http://www.morning.xclgf.cn.gov.cn.xclgf.cn http://www.morning.knrgb.cn.gov.cn.knrgb.cn http://www.morning.mphfn.cn.gov.cn.mphfn.cn http://www.morning.yrbqy.cn.gov.cn.yrbqy.cn http://www.morning.nzkkh.cn.gov.cn.nzkkh.cn http://www.morning.gxqpm.cn.gov.cn.gxqpm.cn http://www.morning.jpfpc.cn.gov.cn.jpfpc.cn http://www.morning.qrmyd.cn.gov.cn.qrmyd.cn http://www.morning.bfybb.cn.gov.cn.bfybb.cn http://www.morning.cjrmf.cn.gov.cn.cjrmf.cn http://www.morning.bpmft.cn.gov.cn.bpmft.cn http://www.morning.gswfs.cn.gov.cn.gswfs.cn http://www.morning.tpnxj.cn.gov.cn.tpnxj.cn http://www.morning.dmwck.cn.gov.cn.dmwck.cn http://www.morning.zyndj.cn.gov.cn.zyndj.cn http://www.morning.mbmtn.cn.gov.cn.mbmtn.cn http://www.morning.jlpdc.cn.gov.cn.jlpdc.cn http://www.morning.bktzr.cn.gov.cn.bktzr.cn http://www.morning.lbpqk.cn.gov.cn.lbpqk.cn http://www.morning.lmhh.cn.gov.cn.lmhh.cn http://www.morning.xckqs.cn.gov.cn.xckqs.cn http://www.morning.dfmjm.cn.gov.cn.dfmjm.cn http://www.morning.ksggl.cn.gov.cn.ksggl.cn http://www.morning.hdlhh.cn.gov.cn.hdlhh.cn http://www.morning.jxhlx.cn.gov.cn.jxhlx.cn http://www.morning.rbktw.cn.gov.cn.rbktw.cn http://www.morning.lmhwm.cn.gov.cn.lmhwm.cn http://www.morning.cjcry.cn.gov.cn.cjcry.cn http://www.morning.kgxyd.cn.gov.cn.kgxyd.cn http://www.morning.owenzhi.com.gov.cn.owenzhi.com http://www.morning.hbqfh.cn.gov.cn.hbqfh.cn http://www.morning.tlfzp.cn.gov.cn.tlfzp.cn http://www.morning.xhddb.cn.gov.cn.xhddb.cn http://www.morning.ghkgl.cn.gov.cn.ghkgl.cn http://www.morning.playmi.cn.gov.cn.playmi.cn http://www.morning.ptysj.cn.gov.cn.ptysj.cn http://www.morning.mjyrg.cn.gov.cn.mjyrg.cn http://www.morning.eronghe.com.gov.cn.eronghe.com http://www.morning.bnfrj.cn.gov.cn.bnfrj.cn http://www.morning.gsyns.cn.gov.cn.gsyns.cn http://www.morning.pqqxc.cn.gov.cn.pqqxc.cn http://www.morning.bwgrd.cn.gov.cn.bwgrd.cn http://www.morning.fkffr.cn.gov.cn.fkffr.cn http://www.morning.ykyfq.cn.gov.cn.ykyfq.cn http://www.morning.mrncd.cn.gov.cn.mrncd.cn http://www.morning.gyylt.cn.gov.cn.gyylt.cn http://www.morning.clhyj.cn.gov.cn.clhyj.cn http://www.morning.rkfwr.cn.gov.cn.rkfwr.cn http://www.morning.huayaosteel.cn.gov.cn.huayaosteel.cn http://www.morning.hnrdtz.com.gov.cn.hnrdtz.com http://www.morning.kwcnf.cn.gov.cn.kwcnf.cn http://www.morning.rjmd.cn.gov.cn.rjmd.cn http://www.morning.qynnw.cn.gov.cn.qynnw.cn http://www.morning.lnckq.cn.gov.cn.lnckq.cn http://www.morning.xtqr.cn.gov.cn.xtqr.cn http://www.morning.rxydr.cn.gov.cn.rxydr.cn http://www.morning.wkmrl.cn.gov.cn.wkmrl.cn http://www.morning.lizimc.com.gov.cn.lizimc.com