1、docker run -d –name elasticsearch -p 12000:9200 -p 13000:9300 -e “discovery.type=single-node” elasticsearch:7.3.0
2、docker run -d --name elasticsearch-head -p 10100:9100 mobz/elasticsearch-head:5
3、在浏览器打开:127.0.0.1:9100,连接不上,然后
修改es.yml文件
增加
# head插件设置
http.cors.enabled: true
http.cors.allow-origin: "*"
#设置可以访问的ip 这里全部设置通过
4、查询可能不成功,查询时报错{"error":"Content-Type header [application/x-www-form-urlencoded] is not supported","status":406}
5、安装vim:
备份source.list文件
mv /etc/apt/sources.list /etc/apt/sources.list.bak
替换为阿里云国内镜像
echo "deb http://mirrors.aliyun.com/debian/ stretch main non-free contrib" >> /etc/apt/sources.listecho "deb-src http://mirrors.aliyun.com/debian/ stretch main non-free contrib" >> /etc/apt/sources.listecho "deb http://mirrors.aliyun.com/debian-security stretch/updates main" >> /etc/apt/sources.listecho "deb-src http://mirrors.aliyun.com/debian-security stretch/updates main" >> /etc/apt/sources.listecho "deb http://mirrors.aliyun.com/debian/ stretch-updates main non-free contrib" >> /etc/apt/sources.listecho "deb-src http://mirrors.aliyun.com/debian/ stretch-updates main non-free contrib" >> /etc/apt/sources.listecho "deb http://mirrors.aliyun.com/debian/ stretch-backports main non-free contrib" >> /etc/apt/sources.listecho "deb-src http://mirrors.aliyun.com/debian/ stretch-backports main non-free contrib" >> /etc/apt/sources.list
更新安装源
apt-get update
安装 Vim
apt-get install vim
6、解决方法:
1、进入head安装目录;docker exec -it 名称 bash
2、打开文件夹_site,cd _site/
3、编辑vendor.js 共有两处
①. 6886行 contentType: "application/x-www-form-urlencoded
改成
contentType: "application/json;charset=UTF-8"
②. 7574行 var inspectData = s.contentType === "application/x-www-form-urlencoded" &&
改成
var inspectData = s.contentType === "application/json;charset=UTF-8" &&
4、退出容器exit 然后重启
5、重新查询,可以查出数据
