在homestead 的homestead.yml 配置文件中添加php
features: - elasticsearch: version: 7
开启homestead 中的 elasticsearch css
由于须要安装软件因此须要设置国内的镜像laravel
打开 homestead/scripts/features/elasticssearch.sh文件git
将apt-get 安装的内容替换为github
sed -i "s@http://.*archive.ubuntu.com@http://mirrors.huaweicloud.com@g" /etc/apt/sources.list sed -i "s@http://.*security.ubuntu.com@http://mirrors.huaweicloud.com@g" /etc/apt/sources.list sudo apt-get update wget https://mirrors.huaweicloud.com/elasticsearch/7.6.1/elasticsearch-7.6.1-amd64.deb sudo apt-get -y install openjdk-11-jre # sudo apt-get -y install elasticsearch"$installVersion" sudo dpkg -i elasticsearch-7.6.1-amd64.deb # Start Elasticsearch on boot sudo update-rc.d elasticsearch defaults 95 10
设置国内的镜像shell
在 /etc/elasticsearch/elasticsearch.yml 中添加ubuntu
network.host: 0.0.0.0 discovery.seed_hosts: ["127.0.0.1", "::1"]
重启elasticsearchcomposer
sudo service elasticsearch restart
打开 /usr/share/elasticsearch/pluginselasticsearch
建立 文件夹工具
sudo mkdir ik
将下载的 https://github.com/medcl/elas... 解压到 ik文件夹中
unzip xxx.zip
重启服务
sudo service elasticsearch restart
kibana 是一款界面管理工具 官方出品的
composer require tamayo/laravel-scout-elastic composer require laravel/scout //版本可能不兼容 具体看composer中的兼容版本 php artisan vendor:publish //选择其中的配置文件发布
发布配置文件后须要对配置文件进行更改
'driver' => env('SCOUT_DRIVER', 'algolia'), //在env 中 添加 elasticsearch
在 scount.php 中添加
'elasticsearch' => [ 'index' => env('ELASTICSEARCH_INDEX', 'products'), 'hosts' => [ env('ELASTICSEARCH_HOST', 'http://localhost'), ] ]
具体的配置看我的的配置进行
到如今基本上算是配置完成了 详细使用说明可看