検索
ホームページデータベースRedisRedis にリモートからアクセスできるようにする方法

Redis にリモートからアクセスできるようにする方法

Feb 01, 2021 am 10:08 AM
redisリモートアクセス

Redis にリモートからアクセスできるようにする方法

はじめに:

redis がデフォルトでローカル アクセスのみを許可していることは誰もが知っていますが、redis へのリモート アクセスを有効にしたい場合はどうすればよいでしょうか?

具体的な方法:

redis.conf ファイルを開くと、NETWORK セクションに指示があります。

################################## NETWORK #####################################
 
# By default, if no "bind" configuration directive is specified, Redis listens
# for connections from all the network interfaces available on the server.
# It is possible to listen to just one or multiple selected interfaces using
# the "bind" configuration directive, followed by one or more IP addresses.
#
# Examples:
#
# bind 192.168.1.100 10.0.0.1
# bind 127.0.0.1 ::1
#
# ~~~ WARNING ~~~ If the computer running Redis is directly exposed to the
# internet, binding to all the interfaces is dangerous and will expose the
# instance to everybody on the internet. So by default we uncomment the
# following bind directive, that will force Redis to listen only into
# the IPv4 lookback interface address (this means Redis will be able to
# accept connections only from clients running into the same computer it
# is running).
#
# IF YOU ARE SURE YOU WANT YOUR INSTANCE TO LISTEN TO ALL THE INTERFACES
# JUST COMMENT THE FOLLOWING LINE.
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
bind 127.0.0.1

解決策: バインド 127.0.0.1 をコメントアウトして、すべての IP がアクセスできるようにします。 redis

すべての IP アクセスではなく、複数の IP アクセスを指定したい場合は、bind

Note

以下の説明もあります

# Protected mode is a layer of security protection, in order to avoid that
# Redis instances left open on the internet are accessed and exploited.
#
# When protected mode is on and if:
#
# 1) The server is not binding explicitly to a set of addresses using the
#    "bind" directive.
# 2) No password is configured.
#
# The server only accepts connections from clients connecting from the
# IPv4 and IPv6 loopback addresses 127.0.0.1 and ::1, and from Unix domain
# sockets.
#
# By default protected mode is enabled. You should disable it only if
# you are sure you want clients from other hosts to connect to Redis
# even if no authentication is configured, nor a specific set of interfaces
# are explicitly listed using the "bind" directive.
protected-mode yes

In redis3。2 以降、redis は保護モードを追加しました。このモードでは、bind 127.0.0.1 がコメントアウトされていても、次のように redisd にアクセスするとエラーが報告されます:

(error) DENIED Redis is running in protected mode because protected mode is enabled, no bind address was specified, no authentication password is requested to clients. In this mode connections are only accepted from the loopback interface. If you want to connect from external computers to Redis you may adopt one of the following solutions: 1) Just disable protected mode sending the command 'CONFIG SET protected-mode no' from the loopback interface by connecting to Redis from the same host the server is running, however MAKE SURE Redis is not publicly accessible from internet if you do so. Use CONFIG REWRITE to make this change permanent. 2) Alternatively you can just disable the protected mode by editing the Redis configuration file, and setting the protected mode option to 'no', and then restarting the server. 3) If you started the server manually just for testing, restart it with the '--protected-mode no' option. 4) Setup a bind address or an authentication password. NOTE: You only need to do one of the above things in order for the server to start accepting connections from the outside.

関連する推奨事項: redis データベースのチュートリアル

以上がRedis にリモートからアクセスできるようにする方法の詳細内容です。詳細については、PHP 中国語 Web サイトの他の関連記事を参照してください。

声明
この記事は博客园で複製されています。侵害がある場合は、admin@php.cn までご連絡ください。
RedisはSQLまたはNOSQLデータベースですか?答えが説明しましたRedisはSQLまたはNOSQLデータベースですか?答えが説明しましたApr 18, 2025 am 12:11 AM

redisisclassifiedsaNosqldatabasebasesakey-valuedataModelinsteaded ofthetraditionaldatabasemodel.itoffersspeedand andffficability、makingidealforreal-timeaplications andcaching、butmaynotbesbesutable fors cenariois requiring datientiantientioniity

Redis:アプリケーションのパフォーマンスとスケーラビリティの向上Redis:アプリケーションのパフォーマンスとスケーラビリティの向上Apr 17, 2025 am 12:16 AM

Redisは、データをキャッシュし、分散ロックとデータの持続性を実装することにより、アプリケーションのパフォーマンスとスケーラビリティを向上させます。 1)キャッシュデータ:Redisを使用して頻繁にアクセスしたデータをキャッシュして、データアクセス速度を向上させます。 2)分散ロック:Redisを使用して分散ロックを実装して、分散環境での操作のセキュリティを確保します。 3)データの持続性:データの損失を防ぐために、RDBおよびAOFメカニズムを介してデータセキュリティを確保します。

Redis:データモデルと構造の調査Redis:データモデルと構造の調査Apr 16, 2025 am 12:09 AM

Redisのデータモデルと構造には、5つの主要なタイプが含まれます。1。文字列:テキストまたはバイナリデータの保存に使用され、原子操作をサポートします。 2。リスト:キューとスタックに適した注文された要素コレクション。 3.セット:順序付けられていない一意の要素セット、セット操作をサポートします。 4。注文セット(sortedset):ランキングに適したスコアを持つ一意の要素セット。 5。ハッシュテーブル(ハッシュ):オブジェクトの保存に適したキー価値ペアのコレクション。

Redis:データベースアプローチの分類Redis:データベースアプローチの分類Apr 15, 2025 am 12:06 AM

Redisのデータベースメソッドには、メモリ内データベースとキー価値ストレージが含まれます。 1)Redisはデータをメモリに保存し、速く読み取り、書き込みます。 2)キー価値のペアを使用してデータを保存し、キャッシュやNOSQLデータベースに適したリスト、コレクション、ハッシュテーブル、注文コレクションなどの複雑なデータ構造をサポートします。

なぜRedisを使用するのですか?利点と利点なぜRedisを使用するのですか?利点と利点Apr 14, 2025 am 12:07 AM

Redisは、高速パフォーマンス、リッチデータ構造、高可用性とスケーラビリティ、持続性能力、幅広いエコシステムサポートを提供するため、強力なデータベースソリューションです。 1)非常に速いパフォーマンス:Redisのデータはメモリに保存され、非常に速い読み取り速度と書き込み速度が高く、高い並行性と低レイテンシアプリケーションに適しています。 2)豊富なデータ構造:さまざまなシナリオに適したリスト、コレクションなど、複数のデータ型をサポートします。 3)高可用性とスケーラビリティ:マスタースレーブの複製とクラスターモードをサポートして、高可用性と水平スケーラビリティを実現します。 4)持続性とデータセキュリティ:データの整合性と信頼性を確保するために、データの持続性がRDBとAOFを通じて達成されます。 5)幅広い生態系とコミュニティのサポート:巨大なエコシステムとアクティブなコミュニティにより、

NOSQLの理解:Redisの重要な機能NOSQLの理解:Redisの重要な機能Apr 13, 2025 am 12:17 AM

Redisの主な機能には、速度、柔軟性、豊富なデータ構造のサポートが含まれます。 1)速度:Redisはメモリ内データベースであり、読み取り操作はほとんど瞬間的で、キャッシュとセッション管理に適しています。 2)柔軟性:複雑なデータ処理に適した文字列、リスト、コレクションなど、複数のデータ構造をサポートします。 3)データ構造のサポート:さまざまなビジネスニーズに適した文字列、リスト、コレクション、ハッシュテーブルなどを提供します。

Redis:主要な機能を特定しますRedis:主要な機能を特定しますApr 12, 2025 am 12:01 AM

Redisのコア関数は、高性能のメモリ内データストレージおよび処理システムです。 1)高速データアクセス:Redisはデータをメモリに保存し、マイクロ秒レベルの読み取り速度と書き込み速度を提供します。 2)豊富なデータ構造:文字列、リスト、コレクションなどをサポートし、さまざまなアプリケーションシナリオに適応します。 3)永続性:RDBとAOFを介してディスクにデータを持続します。 4)サブスクリプションを公開:メッセージキューまたはリアルタイム通信システムで使用できます。

Redis:一般的なデータ構造のガイドRedis:一般的なデータ構造のガイドApr 11, 2025 am 12:04 AM

Redisは、次のようなさまざまなデータ構造をサポートしています。1。文字列、単一価値データの保存に適しています。 2。キューやスタックに適したリスト。 3.非重複データの保存に使用されるセット。 4。ランキングリストと優先キューに適した注文セット。 5。オブジェクトまたは構造化されたデータの保存に適したハッシュテーブル。

See all articles

ホットAIツール

Undresser.AI Undress

Undresser.AI Undress

リアルなヌード写真を作成する AI 搭載アプリ

AI Clothes Remover

AI Clothes Remover

写真から衣服を削除するオンライン AI ツール。

Undress AI Tool

Undress AI Tool

脱衣画像を無料で

Clothoff.io

Clothoff.io

AI衣類リムーバー

AI Hentai Generator

AI Hentai Generator

AIヘンタイを無料で生成します。

ホットツール

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

このプロジェクトは osdn.net/projects/mingw に移行中です。引き続きそこでフォローしていただけます。 MinGW: GNU Compiler Collection (GCC) のネイティブ Windows ポートであり、ネイティブ Windows アプリケーションを構築するための自由に配布可能なインポート ライブラリとヘッダー ファイルであり、C99 機能をサポートする MSVC ランタイムの拡張機能が含まれています。すべての MinGW ソフトウェアは 64 ビット Windows プラットフォームで実行できます。

SublimeText3 英語版

SublimeText3 英語版

推奨: Win バージョン、コードプロンプトをサポート!

SublimeText3 中国語版

SublimeText3 中国語版

中国語版、とても使いやすい

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Eclipse を SAP NetWeaver アプリケーション サーバーと統合します。

PhpStorm Mac バージョン

PhpStorm Mac バージョン

最新(2018.2.1)のプロフェッショナル向けPHP統合開発ツール