当前位置:网站首页>How to operate redis on the IntelliJ idea database console

How to operate redis on the IntelliJ idea database console

2022-06-22 21:28:00 Flybook Technology

TIPS

  • This theory supports IntelliJ IDEA Family owned IDE( for example Data Grip etc. )、 All versions
  • The theory supports all based on JDBC Various GUI Tools !

Recently at work , Always operate to Redis, Despite the market Redis client GUI A lot , for example Redis Desktop Manager、AnotherRedisDesktopManager etc. .

But I am a IDEA flow , I hope I can IDEA Operate on the console Redis, So as to obtain a consistent R & D experience , You don't have to cut around the windows .

therefore , I try to find out if there is a suitable Redis plug-in unit , The result is either a charge , Or the experience is poor ; next , I also want to know about the official response to Redis Support intention , After seeing the following post , The heart is also cold .

  • Redis support : For the most part , Officials say the plan is to IDEA 2022 Version supports , However ,IDEA 2022 When it will be released is unknown .

here , It occurred to me that ,IDEA The database console allows you to use JDBC Drive to connect to any database , Then all I have to do is Redis To write JDBC drive , You can achieve your goal !

Redis JDBC

Do as you say , It took a day and a half , Wrote a Redis JDBC drive , Address :GitHub - eacdy/redis-jdbc , This is a base Jedis Of Redis JDBC drive , Allow us to use JDBC operation Redis And Redis Cluster, Support Jedis All commands supported .

Let's discuss how to IDEA use Redis JDBC link Redis.

TIPS

Here we use Redis JDBC 0.0.1 For example , When a new version is released in the future , Just change the version number in the connection .

Prepare the driver file

To configure IDEA Connect Redis

  • Go to IDEA - Database - Click on the plus sign - Click on Driver and Data Source

image.png

  • Click on User Driver - Click on Go to Driver, Here's the picture

image.png

  • In the pop-up driver configuration page , Operate according to the following figure . among :
  • Name: Is the driver name , Write casually , You can understand it yourself
  • Click on the plus sign , Add the driver you just downloaded JAR Package file
  • After adding JAR After package , Click on Class The drop-down menu on the right , You can see the driver class name . among ,RedisDriver Used to connect to the stand-alone version Redis,RedisClusterDriver Used to connect Redis Cluster

image.png

  • Click... In the upper left corner of the figure above Data Sources, Continue configuring the data source , Operate according to the following figure . among :
  • Name: The name of the data source , Write casually , You can understand it yourself
  • URL: Connect Redis The address of . If a single machine is connected Redis, Please use jdbc:redis://{hostname}:{port}/{dbIndex} In the form of ; If connected Redis Cluster, Please use jdbc:redis-cluster:///{hostname1}:{port1};{hostname2}:{port2};{hostname3}:{port3} In the form of , See redis-jdbc README . If you have an account number or password or something , Fill in as needed , I have no account number and password, so I left it blank
  • Click on Test Connection, Test whether the configuration is normal . Click on Apply OK that will do .

image.png

Use

In turn, the operating :

  • Click the data source just created
  • Click on QL Button
  • Click on New Query Console
  • On the left side. Console Written in Redis Instructions , Currently all instructions are supported
  • Click the execute button

such , You can see the results below !

image.png

Have a good time , Welcome to use 、Star、Follow、 Give me a request !

原网站

版权声明
本文为[Flybook Technology]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/173/202206221956571784.html