For example, with spark-redis 2.3.1, you get spark-redis-2.3.1-SNAPSHOT-jar-with- dependencies.jar. The stack for Spark SQL and Redisįirst, you need to download spark-redis and build the library to get the jar file. In other words, you can insert, update and query data using SQL commands, but the data is internally mapped to Redis data structures.įigure 2. Spark-Redis library allows you to use the DataFrame APIs to store and access Redis data. Now, if you want to maintain the SQL interface in your solutions and only change the underlying data store to Redis to make it faster, then you can do so by using Apache Spark and Spark-Redis library. HGETALL product:10003 Use DataFrames to automatically map your tables to Redis data structures Select * from Product where price < 300 Redis: Select * from Products where id = 10200 Redis: HMSET product:10200 name ZXYW desc “Description for ZXYW” price 300 Insert into Products (id, name, description, price) Below are some examples of SQL and Redis equivalent commands: With this option, you need to make changes to your code to use Redis queries instead of SQL commands. But before we go any further, we have a Redis Hackathon contestant who created his own app that allows you to query data in Redis with SQL.įigure 1. There are a number of ways you can run a Redis query and introduce Redis into your architecture without disrupting your current SQL-based solution. Now, if you’re in the same situation as my friend, we have good news for you. Can Redis help here? Keep in mind that we can’t rip and replace our SQL-based solution all at once. However, sometimes it takes minutes to get the results. We have use cases where we need to record data and perform analytical operations in real-time. “ We have a pain point with our data warehousing solutions. We began talking about Redis’ queries once he explained a problem that he was facing. I actually raised this point a few years ago when speaking to a friend who manages data warehousing solutions at a retail company. Running a Redis SQL query doesn’t have to be difficult. Related E-Book download: The Importance of In-Memory NoSQL Databases
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |