简体   繁体   English

ElasticSearch和Mysql

[英]ElasticSearch and Mysql

I have to decide in my next app between NoSQL and Relational Database. 我必须在NoSQL和Relational Database之间确定下一个应用程序。 The App will be written using ReactJS and ExpressJS. 该应用程序将使用ReactJS和ExpressJS编写。

I have some relational data like videos that have tags and users that like videos and I need to keep track the users that like the videos to disable multiple votes on the same video. 我有一些关系数据,例如带有标签的视频和喜欢视频的用户,我需要跟踪喜欢视频的用户以禁用同一视频的多个投票。

A little image of the beginning of the database : 数据库开始的小图像:

在此处输入图片说明

So It seems that NoSQL doesn't fit well for that. 因此,似乎NoSQL不太适合这样做。 But I want to have the ability to filter the videos and ElasticSearch seems to do the job well with high flexibly but the sync between Mysql and ElasticSearch is harder to maintain I didn't find a lot : This one seems good jprante/elasticsearch-jdbc. 但是我想具有过滤视频的能力,ElasticSearch似乎可以灵活地很好地完成工作,但是Mysql和ElasticSearch之间的同步很难维护,我没有找到很多东西:这个看起来不错jprante / elasticsearch-jdbc 。

But I keep asking myself some questions : 但是我一直在问自己一些问题:

  • How the relation will be imported in elastic search ? 该关系将如何在弹性搜索中导入?
  • If I only need to filter some part like videos do I need to sync all the tables ? 如果只需要过滤视频等部分,是否需要同步所有表格?

So do I need to go with NoSQL or not ? 那么我是否需要使用NoSQL? I never use NoSQL or ElasticSearch before. 我以前从未使用过NoSQL或ElasticSearch。

It seems like you know how to use relational databases, but when you consider NoSQL you come to it from a relational point of view. 似乎您知道如何使用关系数据库,但是当您考虑使用NoSQL时,便是从关系的角度来看它。

The NoSQL world is big and different databases offer different advantages and disadvantages. NoSQL世界很大,不同的数据库具有不同的优点和缺点。

For example: Using solr/elasticsearch/mongo could allow you to store data and query it rather efficiently, while other databases, such as key-value big-data databases (cassandra and Hbase, to name a few) will provide even better performance, but you will be limited to "exact-match" queries. 例如:使用solr / elasticsearch / mongo可以让您存储数据并相当有效地进行查询,而其他数据库(例如键值大数据数据库(cassandra和Hbase等)将提供更好的性能,但您将只能使用“完全匹配”查询。

Personally, I'm a strong believer in using relational databases as long as the amount of data being stored isn't too much for it to handle. 就个人而言,我坚信使用关系数据库,只要所存储的数据量不会太多即可处理。 Relational DBs are very mature and robust. 关系数据库非常成熟且健壮。

(Also, if you ARE going to go with a relational DB, may I suggest PostgreSQL). (此外,如果要使用关系数据库,我可以建议使用PostgreSQL)。

Regarding the questions you've asked, the answer depends greatly on the NoSQL database you're going to choose. 关于您所问的问题,答案很大程度上取决于您要选择的NoSQL数据库。 Lots of best practices related to big-data databases don't necessary use JOIN operations (at least not to the same extent as relational dbs) and this is mainly because when it comes to distributed databases, storage is cheap but JOINs on huge datasets in really really expensive. 与大数据数据库有关的许多最佳实践都没有必要使用JOIN操作(至少与关系数据库的使用程度不同),这主要是因为在涉及分布式数据库时,存储很便宜,但是在大型数据集上使用JOIN真的真的很贵。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM