首页 \ 问答 \ 哨兵在保护模式下运行(How to configure Redis 3.4 and above in master/slave config to resolve error Sentinel running on protected mode?)

哨兵在保护模式下运行(How to configure Redis 3.4 and above in master/slave config to resolve error Sentinel running on protected mode?)

我正在使用redis 3.2并在连接到来自不同机器的标记时出现以下错误:

Trying 10.5.205.105...
Connected to 10.5.205.105.
Escape character is '^]'.
-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.
Connection closed by foreign host.

有人能帮我解决这个问题吗?


I am working with Redis 3.2 and while connecting to the sentinel from a differnt machine I get the following error:

Trying X.X.X.X...
Connected to X.X.X.X.
Escape character is '^]'.
-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.
Connection closed by foreign host.

Can somene help me resolve this?


原文:https://stackoverflow.com/questions/41223618
更新时间:2023-05-08 22:05

最满意答案

这里发生的事情就是所谓的currying - 转换一个函数,该函数需要n个多重参数,这样才能称为函数链

让我们考虑一个函数f,它带有2个参数,即f(x,y)。 存在使得f(x,y)= g(x)(y)=(g(x))(y)的一元函数g。 函数g被称为f的curried版本。

g是期望一个参数的函数,(x),g(x)的值也是一个参数y的函数。

让我们考虑一个curried-add函数:

(define curried-add 
  (lambda (x) 
    (lambda (y) (+ x y))))

((curried-add 1) 5)

对(curried-add 1)的调用将返回一个函数,该函数接受一个参数,在我们的例子5中,并将其添加到1,给出和输出6。

我们可以将这些咖喱酱添加到一起以获得:

((curried-add ((curried-add 1) 2)) 3)

会产生6的输出。这是因为(curried-add 1)会返回一个期望一个参数的函数,在这种情况下是2.因此,1被添加到2并产生一个函数,期望一个参数可以被添加到3我们刚刚制造。

在这种情况下,你的真实和错误的功能。

True是: (define t (lambda (x) (lambda (y) x)))

False是:( (define f (lambda (x) (lambda (y) y)))

true函数接受两个参数并返回第一个参数,false函数返回两个参数中的第二个参数。


What is happening here is something known as currying - transforming a function which takes n multiple arguments in such a way that it can be called as a chain of functions

Let us consider a function f which takes 2 arguments, i.e. f(x,y). There exists a unary function g such that f(x,y) = g(x)(y) =(g(x))(y). The function g is known as the curried version of f.

g is a function which expects one argument, (x) and the value of g(x) is also a function of one argument, y.

Let us consider a curried-add function:

(define curried-add 
  (lambda (x) 
    (lambda (y) (+ x y))))

((curried-add 1) 5)

The call to (curried-add 1) would return a function which takes one argument, in our case 5 and adds it to 1, giving and output of 6.

We can chain these curried-adds together to get:

((curried-add ((curried-add 1) 2)) 3)

Would produce an output of 6. This is because (curried-add 1) would return a function expecting one argument, in this case 2. Therefore 1 is added to 2 and produces a function which is expecting one argument which can be added to the 3 we've just made.

In this case of your true and false functions.

True is : (define t (lambda (x) (lambda (y) x)))

False is: (define f (lambda (x) (lambda (y) y)))

The true function takes two arguments and returns the first one, the false function returns the second of the two arguments.

相关问答

更多
  • Boo支持lambda表达式语法: foo = {x|x+2} seven = foo(5) def TakeLambda(expr as callable(int) as int): return expr(10) twelve = TakeLambda(foo) 在这个例子中, foo是一个接受数字x并返回x + 2的函数。因此调用foo(5)将返回数字7. TakeLambda是一个接受foo并在10处对其进行求值的函数。 Boo does support lambda expression ...
  • 这里没问题。 使用lambda的数据访问与具有命名函数的数据访问,通过内联代码,传统函子,使用bind制作的或任何其他方式没有区别。 只要一次只从一个线程调用lambda,我就看不到任何与线程相关的问题的证据。 There's no problem here. A data access with a lambda is no different to a data access with a named function, through inline code, a traditional functo ...
  • 这里发生的事情就是所谓的currying - 转换一个函数,该函数需要n个多重参数,这样才能称为函数链 让我们考虑一个函数f,它带有2个参数,即f(x,y)。 存在使得f(x,y)= g(x)(y)=(g(x))(y)的一元函数g。 函数g被称为f的curried版本。 g是期望一个参数的函数,(x),g(x)的值也是一个参数y的函数。 让我们考虑一个curried-add函数: (define curried-add (lambda (x) (lambda (y) (+ x y)))) ...
  • 简短的回答:不,lambda通常不会完成。 更长的答案:parallel_for_each将请求排队到GPU,然后你的CPU线程继续到第二个parallel_for_each并排队,然后你的CPU线程继续执行其他CPU代码。 同时,以非确定性的方式,计算将在您排队的加速器上执行(如果在默认加速器上,第一个计算将执行,然后第二个计算将执行)。 在执行计算之间,或者甚至在两次计算之后,如果在任何时候你试图访问任何计算的结果,那么CPU线程将在等待结果被复制时阻塞(如果需要,等待执行完成)。 一种方法是通过在传递 ...
  • 以下是您在查询语法和lambda语法中引用的帖子的代码段: https : //stackoverflow.com/a/12324116/670028 : LINQ查询语法: var listOfString = new List() { "String1", "String2" }; var customers = ( from a in session.Query() from b in a.B from c in b.C where a.Stat ...
  • 你应该明白这一点 (lambda () 42) 和 '(lambda () 42) 不是一回事。 第一个被评估时会返回一个可调用对象,当被调用时返回42,第二个返回时返回一个列表,其中第一个元素是符号lambda ,第二个元素是空列表,第三个元素是数字42。 您的代码将abc定义为包含列表的列表,其中第一个元素是符号lambda ,而不是包含可调用函数的列表。 为此,你需要写 (define abc (list (lambda (x) (* x x)))) 换句话说,需要对lambda表单进行求值以提 ...
  • 这两个定义没有区别 - 前者是后者的语法糖。 你喜欢哪一个是风格问题,但我的印象是前者通常是定义函数的首选方式,因为它更简洁,也许更具可读性。 介绍性文本经常使用后者来清楚地表明命名函数只是一个持有lambda的变量 - 这在使用第一个变量时并不是那么清楚。 There is no difference between the two definitions - the former is syntactic sugar for the latter. Which one you prefer is a m ...
  • 这取决于背景和你所教的内容。 如果您发布更多上下文,您很可能会得到更好的答案。 但是,首先请注意 (define (foo x) (+ x 1)) 相当于 (define foo (lambda (x) (+ x 1))). 摆脱letrec将其重写为内部定义。 It depends on the context and what you have been taught. If you post more context, you'll most likely get a better answer ...
  • 如果你命名为lambdas,也许更容易看到发生了什么。 例如, (define (f x y) (+ (x * y) (x + y))) (define (g a b) (a b b)) 然后表达式((lambda (xy) (+ (x * y) (x + y))) (lambda (ab) (abb)) 3)变为: (f g 3) 它评估为: (f g 3) => (+ (g * 3) (g + 3)) => (+ (* 3 3) (+ 3 3)) => (+ 9 6) => 15 Per ...
  • 两个版本通过产生相同的结果来工作,但是一个返回可以在高阶函数中使用的部分应用程序。 想象一下,您想要在列表中添加常量和方块元素。 我们可以轻松地使用您的第一个版本: (define (add4 n) (+ n 4)) (map add-4-and-square (square-a-procedure add4) '(0 1 2 3)) ; ==> (16 25 36 49) 除非我们将它包裹在一个实际上和第一个完全相同的lambda中,否则我们无 ...

相关文章

更多

最新问答

更多
  • 如何在Laravel 5.2中使用paginate与关系?(How to use paginate with relationships in Laravel 5.2?)
  • linux的常用命令干什么用的
  • 由于有四个新控制器,Auth刀片是否有任何变化?(Are there any changes in Auth blades due to four new controllers?)
  • 如何交换返回集中的行?(How to swap rows in a return set?)
  • 在ios 7中的UITableView部分周围绘制边界线(draw borderline around UITableView section in ios 7)
  • 使用Boost.Spirit Qi和Lex时的空白队长(Whitespace skipper when using Boost.Spirit Qi and Lex)
  • Java中的不可变类(Immutable class in Java)
  • WordPress发布查询(WordPress post query)
  • 如何在关系数据库中存储与IPv6兼容的地址(How to store IPv6-compatible address in a relational database)
  • 是否可以检查对象值的条件并返回密钥?(Is it possible to check the condition of a value of an object and JUST return the key?)
  • GEP分段错误LLVM C ++ API(GEP segmentation fault LLVM C++ API)
  • 绑定属性设置器未被调用(Bound Property Setter not getting Called)
  • linux ubuntu14.04版没有那个文件或目录
  • 如何使用JSF EL表达式在param中迭代变量(How to iterate over variable in param using JSF EL expression)
  • 是否有可能在WPF中的一个单独的进程中隔离一些控件?(Is it possible to isolate some controls in a separate process in WPF?)
  • 使用Python 2.7的MSI安装的默认安装目录是什么?(What is the default installation directory with an MSI install of Python 2.7?)
  • 寻求多次出现的表达式(Seeking for more than one occurrence of an expression)
  • ckeditor config.protectedSource不适用于editor.insertHtml上的html元素属性(ckeditor config.protectedSource dont work for html element attributes on editor.insertHtml)
  • linux只知道文件名,不知道在哪个目录,怎么找到文件所在目录
  • Actionscript:检查字符串是否包含域或子域(Actionscript: check if string contains domain or subdomain)
  • 将CouchDB与AJAX一起使用是否安全?(Is it safe to use CouchDB with AJAX?)
  • 懒惰地初始化AutoMapper(Lazily initializing AutoMapper)
  • 使用hasclass为多个div与一个按钮问题(using hasclass for multiple divs with one button Problems)
  • Windows Phone 7:检查资源是否存在(Windows Phone 7: Check If Resource Exists)
  • 无法在新线程中从FREContext调用getActivity()?(Can't call getActivity() from FREContext in a new thread?)
  • 在Alpine上升级到postgres96(/ usr / bin / pg_dump:没有这样的文件或目录)(Upgrade to postgres96 on Alpine (/usr/bin/pg_dump: No such file or directory))
  • 如何按部门显示报告(How to display a report by Department wise)
  • Facebook墙贴在需要访问令牌密钥后无法正常工作(Facebook wall post not working after access token key required)
  • Javascript - 如何在不擦除输入的情况下更改标签的innerText(Javascript - how to change innerText of label while not wiping out the input)
  • WooCommerce / WordPress - 不显示具有特定标题的产品(WooCommerce/WordPress - Products with specific titles are not displayed)