Problem description

stay Azure Redis In the official documents of , This paper introduces the in Windows Next , How to use redis-cli.exe Connect Redis, Contains how to configure stunnel Made by 6380,SSL Way to connect to Redis Cache. The quotation is as follows :

by redis-cli.exe Enable access

Use Azure Cache for Redis when , Only... Is enabled by default TLS port (6380). redis-cli.exe  Command line tools do not support TLS.  The command line tool can be used in two configuration ways :

  1. Enable non TLS port (6379) - This configuration is not recommended , Because in this configuration , The system goes through TCP Send the access key in clear text .  This change may affect access to the cache .  Consider this configuration only when accessing the test cache .

  2. Download and install  stunnel.

    function stunnel GUI Start To start the server .

    Right click stunnel The server's taskbar icon , And then click “ Show log window ” .

    stay stunnel“ Log window ” Menu , single click “ To configure ” > “ Edit the configuration ”, Open the current profile .

    stay “ Service definition ” Part of it goes down redis-cli.exe Add the following .  take  yourcachename  Replace with the actual cache name .

    [redis-cli]
    client = yes
    accept = 127.0.0.1:6380
    connect = yourcachename.redis.cache.chinacloudapi.cn:6380

    Save and close the profile .

    stay stunnel“ Log window ” The menu , single click “ To configure ” > “ Reload configuration ” .

This paper is faced with the following situation : Use Linux VM How to connect to Azure Redis, adopt SSL The way (6380) Or not SSL The way (6379)

Preparation conditions

  • Azure Redis
  • Linux VM
  • redis-cli
  • stunnel4

Operation steps

First step : install Redis-cli

sudo apt-get update

sudo apt-get install redis-tools

notes :redis-tools It contains redis-cli Tools and others reids Tools

The second step : install stunnel4

because redis-cli.exe  The tool does not support TLS( adopt 6380 Port connection ), So use stunnel To connect to Redis Of 6380 port . The current use is the second 4 Version of stunnel, stay Linux The installation commands in are as follows :

sudo apt-get install stunnel4

Be careful :

If you want to use non SSL port 6379 function Redis, under these circumstances , You do not need to use stunnel, And you can Azure Redis Turn on non SSL Port, directly use the following command to access :

redis-cli -p 6379 -a <access key> -h <yourcachename.redis.cache.chinacloudapi.cn>

The third step : Turn on Stunnel service , stay VM Start automatically at startup

modify /etc/default/stunnel4 The configuration file , Modify the file ENABLED The value of is 1. Use nano Edit the file , The order is :

sudo nano /etc/default/stunnel4

Move to the arrow below through the keyboard direction key , modify ENABLED by 1 after , Use CRTL + X after , Input Y, To save the current changes . Then go back to Linux Command window .

Step four : stay stunnel Add redis-cli Configuration item for

stay Stunnel Add redis Configuration file for , Use the following command to add a file and configure Redis-cli Link information for

sudo nano /etc/stunnel/redis.conf

After opening the file , Enter the configuration content :

[redis-cli]
client = yes
accept = 127.0.0.1:6380
connect = yourredisname.redis.cache.chinacloudapi.cn:6380

Use CTRL + X, Input Y, Return to save

Step five : restart Stunnel service , load Redis To configure , The use command is

sudo systemctl restart stunnel4.service

Step six : Check stunnel Have you monitored 6380 port , Use command

sudo netstat -plunt

Step seven : Use Redis-cli adopt 6380(SSL The way ) Connect to Redis, Connection command

redis-cli -p 6380 -a <your redis access key>  

here , You can see that the connection is successful and start managing Redis.

[ above , I hope it will be of some help to you .]

Reference material :

Use Redis Command line tools to connect : https://docs.azure.cn/zh-cn/azure-cache-for-redis/cache-how-to-redis-cli-tool#enable-access-for-redis-cliexe
Connect to Azure Cache for Redis using SSL Port 6380 from Linux VM: https://techcommunity.microsoft.com/t5/azure-paas-blog/connect-to-azure-cache-for-redis-using-ssl-port-6380-from-linux/ba-p/1186109

【Azure Redis cache 】Linux Used in virtual machines 6380 port (SSL The way ) Connect Azure Redis (redis-cli & stunnel) More articles about

  1. linux Each service port and configuration file path in the virtual machine

    Query port status command : netstat -an| grep Port number Query service status ( Whether the service is on ) command :systemctl  status service name Open service command :systemctl  start  service name ...

  2. Set up Windows Azure Linux In the virtual machine root Account

    Use Windows Azure Create good Linux After virtual machine , If you log in with the default user password root You can't , As shown in the figure below : The reason is Windows Azure establish Linux Virtual machine is not set at the same time root The secret ...

  3. linux Install in virtual machine mongodb

    In today's linux The virtual machine has mongodb database , The installation process mainly refers to a document on the Internet , Most places don't make much difference , It's just a change in some details . It's my reference document :http://my.oschina.net/ ...

  4. How to be in VMware ubuntu linux Install in virtual machine VMware tools

    VMware Tools Can be implemented on the host <-> Copy text between virtual machines . File and other functions . This article talks about how to VMware ubuntu linux Install in virtual machine VMware tools. Test environment : VMwa ...

  5. 39、 Fresh e-commerce platform -redis Design and architecture cached in merchandise

    explain :Java Open source fresh e-commerce platform -redis Design and architecture cached in merchandise . 1. All kinds of counting , Commodity dimension count and user dimension count Speaking of e-commerce , You can't do without goods , And there are all kinds of counts for the attached goods ( Liking number , comments , Identification number , Browse the number ,etc ...

  6. Java Fresh e-commerce platform -redis Design and architecture cached in merchandise

    Java Fresh e-commerce platform -redis Design and architecture cached in merchandise explain :Java Open source fresh e-commerce platform -redis Design and architecture cached in merchandise . 1. All kinds of counting , Commodity dimension count and user dimension count Speaking of e-commerce , You can't do without goods , and ...

  7. stay windows Use in Navicat Connect Linux In the virtual machine mysql database

    I want to use navicat Remote connection to virtual machine MySQL database , I can't connect to , I searched the Internet for , The reason for the discovery is MySQL Authorization of remote user login . Here's my solution .( My little white ) First , I use navicat Go far ...

  8. Linux In the virtual machine Node.js Development environment construction

    Node.js Development environment construction : 1. download CentOS Image files and VMWare Virtual machine program ; 2. install VMWare——> Add virtual machines ——> choice CentOS Image files can be installed with desktop by default Linux virtual ...

  9. [ primary ]Windows Azure Development of Linux virtual machine

      Windows Azure It's a collection of Microsoft's cloud services , It is used to provide the operating system and basic storage and management platform for cloud online services , It's one of the core components of Microsoft's cloud computing . among windows azure One of the most important services provided is virtual ...

  10. Windows Azure Development of Linux virtual machine

     Windows Azure It's a collection of Microsoft's cloud services , It is used to provide the operating system and basic storage and management platform for cloud online services , It's one of the core components of Microsoft's cloud computing . among windows azure One of the most important services provided is ...

Random recommendation

  1. When using master pages JavaScript The client gets the server control Id

    When using MasterPage.UserControl Wait for the container , To avoid duplicate naming of controls ,asp.net The control in the container will be automatically generated into a ClientID(Control Tree Can be generated in , Otherwise, it will not generate ). J ...

  2. Non blocking in network programming connect To write

    One .connect Non blocking writing TCP The establishment of a connection involves a process of three handshakes , And socket in connect The function needs to wait until the customer receives a SYN Of ACK So far , This means that every individual connect Functions always ...

  3. course : About how to pass through Maven Warehouse installation Spire Series of Java product

    Spire Published in the series library Java There are currently three products , namely Spire.PDF for Java.Spire.Presentation for Java.Spire.Barcode for Java. Use this J ...

  4. linux_shell_ Array

    shell Arrays are similar to C Language , Array subscript by 0 Numbered starting . To get the elements in an array, use the subscript . 1. First, define the array stay shell in , Use parentheses to represent arrays , For array elements “ Space ” Symbol split . Column : name=("d& ...

  5. c# Written questions and reference answers

    http://blog.csdn.net/smileberry1/article/details/3958670

  6. promote Android ListView Several techniques of performance

    ListView How it works ? ListView It's where design is applied for scalability and high performance requirements . actually , That means ListView There are the following 2 Requirements : Create as little as possible View: It's just drawing and laying out subimages that are visible on the screen Vi ...

  7. maven-surefire-plugin Of forkMode analysis

    Maven When running test cases , By calling maven Of surefire Plug in and fork A child process to execute the use case .forkmode Property to create a process for each test , Or are all tests done in the same process . <p ...

  8. Vue Grammar notes

    Vue.js At the heart of this is a simple template syntax that allows declarative rendering of data into DOM: Event monitoring :v-on Instruction binding an event listener   abbreviation [@]   v-on:click User input , Data binding :v-model ...

  9. close PhpStorm Spelling mistakes

  10. XtraFinder

    About System Integrity Protection in OS X 10.11 Apple's article . System Integrity Protection blocks ...