麋鹿与Laravel的整合
我是麋鹿的初学者,我已经在MySQL后端开发了Laravel的应用程序。
现在,我想将弹性搜索与现有应用程序集成在一起。如果用户在应用程序上更新任何内容,则应立即在弹性搜索上反思。
请指导我。
I am very beginner to ELK, I have developed an application in Laravel with Mysql backend.
Now, I would like to integrate the Elastic search with the existing app & if the user updates anything on the app then it should reflect immediately on the Elastic search.
Please guide me on this.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
将 ELK 集成到您的应用程序中需要几个步骤,甚至您必须决定如何/在哪里运行 es 和 kb 等。有一些可用的选项。您可以在虚拟机中创建自我管理实例,在这种情况下您可以使用 kb 、 es 等的 docker 镜像。
Elastic 提供 ECK(K8s 上的 Elastic Cloud),您可以在 K8s 环境中安装 ECK 操作员,这也将为您启动 kibana 和 elasticsearch。
假设您的应用程序在本地主机中运行:
希望这能为您提供一些背景知识。
ELK integration into your application will require few steps before even that you must decide how/where you want to run the es and kb etc. There a some options available. You can create your self managed instances in VMs in that case you may use the docker images for kb , es etc.
Elastic offers ECK (Elastic Cloud on K8s) you could install the ECK operator in a K8s environment and that will also spin up kibana and elasticsearch for you.
Assuming that your app is running in localhost:
Hope this gives you some background.
您可以通过创建模型观察者来做到这一点。
在当时使用模型雄辩查询创建或更新条目时,特定的模型观察者运行,您可以从观察者函数设置调度作业以供弹性搜索。
从作业执行中,您将在弹性搜索作业中获得该记录的输入,从那里您将添加或更新特定数据以及MySQL DB同步。
例子 :
您需要在 app \ Providers \ AppServiceProvider.php 中设置观察者以使用此方法。
假设您有博客模型。
blog.php
您拥有您的 app \ observers \ blogobserver.php
您的工作文件 app \ app \ jobs \ indexblogelasticsearchjob.php
You can do this by creating an Observer of Models.
When an entry is created or updated with Model Eloquent query at that time the particular Model Observer run and you can set dispatch job for elastic search from observer functions.
And from job execution, you will get an entry of that record inside the Elastic search job and from there you will add or update particular data along with MySQL DB synchronized.
Example :
You need to setup Observer inside app\Providers\AppServiceProvider.php for use this methods.
Suppose you have Blog Model.
Blog.php
You have your app\Observers\BlogObserver.php
You have job file for elastic search changes inside app\Jobs\IndexBlogElasticsearchJob.php