Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis viverra enim maximus ipsum sagittis, non accumsan sapien porttitor. Nullam neque magna, laoreet et ege ...
使用ServiceStack.Redis客户端版本4.0.44从远程服务器访问redis时获取“No Redis Sentinels可用”(Getting “No Redis Sentinels were available” when access redis from remote server using ServiceStack.Redis client version 4.0.44)
我们有一个带有两个redis服务器的redis配置。 我们还有3个哨兵来监控这两个实例并在需要时启动故障转移。
我们从一些应用程序中间歇性地得到以下问题:
ServiceStack.Redis.RedisException: No Redis Sentinels were available ---> ServiceStack.Redis.RedisException: Unable to Connect: sPort: 0
Unable to Connect: sPort: 0
部分可能表示它是ConnectTimeout问题(根据此问题: ServiceStack.Redis:无法连接:sPort:0 )。 但是,我不太相信这是问题,因为它说“没有Redis Sentinels可用”。虽然我们在某些应用程序上间歇性地遇到此问题,但还有其他应用程序(例如我们编写的一些控制台应用程序)似乎始终如一地解决问题。
任何人都可以阐明这个问题是如何解决的? 如果您使用Google“No Redis Sentinels”,那么您只能获得具有输出此消息的实际代码的ServiceStack.Redis GitHub页面。
We have a redis configuration with two redis servers. We also have 3 sentinels to monitor the two instances and initiate a fail over when needed.
We get the following issue intermittently from some of our applications:
ServiceStack.Redis.RedisException: No Redis Sentinels were available ---> ServiceStack.Redis.RedisException: Unable to Connect: sPort: 0
The
Unable to Connect: sPort: 0
portion may indicate that it is a ConnectTimeout issue (per this question: ServiceStack.Redis: Unable to Connect: sPort: 0). However, I'm less confident that this is the problem since it says "No Redis Sentinels were available".While we get this issue intermittently on some applications, there are others (e.g. some console apps we wrote) that seem to be getting the issue consistently.
Can anyone shed light into what this issue is an how to solve it? If you Google "No Redis Sentinels were available" you'll only get the ServiceStack.Redis GitHub page that has the actual code that outputs this message.
原文:https://stackoverflow.com/questions/33040280
最满意答案
你的困惑来自这样
:first-child
事实:first-child
和:last-child
是伪类 ,而不是伪元素。 它们中的每一个都分别表示其父项的第一个和最后一个子项,但您附加它们的元素代表子项 ,而不是父项 。 伪类是某个元素的描述 ,如果您愿意,就像ID选择器描述具有该ID的元素或属性选择器描述具有该属性的元素一样。 因此,选择器E:first-child
意味着E
是其父母的第一个孩子 - 不管该父母是什么 - 但不是E
的第一个孩子。选择器
#article1:first-child
应该匹配#article1
因为它是body
的第一个子#article1
,但它不会匹配#article1
的第一个子#article1
。#article1 :first-child
与div
匹配,因为它是第一个孩子,其父母碰巧是#article1
。另一方面,因为它们分别与每个元素的第一个字母和第一行相匹配,所以
:first-letter
和:first-line
work。 这就是伪元素的含义; 作为其他元素的成员生成的虚拟元素(未在DOM中表示)。请注意,这并不意味着您可以或不可以使用该空间。 您可以将任何组合器用于任何伪类或伪元素选择器,或将其附加到另一个简单选择器链。 当使用或不使用组合器时,它们只是意味着不同的事情,这就是为什么你会看到不同的结果。
伪类与伪元素的另一种解释可以在这里找到。
如果您不需要支持IE8及更高版本,则应使用双冒号来表示伪元素,以帮助您将它们与伪类区分开来,所以
::first-letter
和::first-line
而不是:first-letter
和:first-line
。 这个符号在新的选择器模块中引入。Your confusion comes from the fact that
:first-child
and:last-child
are pseudo-classes, not pseudo-elements. Each of them mean the first and last child of its parent respectively, but the element you attach them to represents the child, not the parent. A pseudo-class is a description of a certain element, if you will, just like an ID selector describes an element with that ID or an attribute selector describes an element with that attribute. So, the selectorE:first-child
meansE
that is the first child of its parent — whatever that parent may be — but not the first child ofE
.The selector
#article1:first-child
should match#article1
since it's the first child ofbody
, but it will not match thediv
that is the first child of#article1
.#article1 :first-child
matches thediv
because, well, it's the first child whose parent happens to be#article1
.On the other hand,
:first-letter
and:first-line
work because they match the first letter and first line of each element respectively. This is what is meant by a pseudo-element; a virtual element (not represented in the DOM) that's generated as a member of some other element.Note that this doesn't mean you can or cannot use the space with one or the other. You can use any combinator with any pseudo-class or pseudo-element selector, or attach it to another chain of simple selectors. They just mean different things when used with or without a combinator, which is why you're seeing different results.
Another explanation of pseudo-classes versus pseudo-elements can be found here.
If you don't need to support IE8 and older, you should represent pseudo-elements using double colons to help you distinguish them from pseudo-classes, so
::first-letter
and::first-line
instead of:first-letter
and:first-line
. This notation is introduced in the new Selectors module.
相关问答
更多-
第一个孩子不是.form-item-products ,而是#product-guide-wrapper ,所以你的选择器不匹配。 正如SLaks所提到的,CSS中没有:first选择器,比如jQuery。 但是,根据您的结构,您应该能够使用#product-guide-wrapper + .form-item-products 。 The first child is not a .form-item-products, but rather #product-guide-wrapper, so your ...
-
链接:first-child和:hover ,你在这里应该工作很好。 但是,如果使用IE6,则只能识别链中最后一个伪类。 换句话说,你做的正确。 Chaining :first-child and :hover as you do here should work just fine. If you're using IE6, however, only the last pseudo-class in the chain will be recognized. In other words, you're ...
-
涉及伪类first-child和dropcap的CSS选择器(CSS selector involving pseudo class first-child and dropcap)[2023-03-25]
如果您可以使用CSS3选择器,请尝试使用这些选项(分组在一起): /* Select the first child if it's not a .quote */ article > p:not(.quote):first-child:first-letter, /* Or, if the first child is a .quote, select the following one instead */ article > p.quote:first-child + p:first-letter ... -
这不是特异性问题。 你只是在这里处理不同的元素 - 被授予,其中一个只是一个伪元素,但仍然。 当几个规则匹配相同的元素时,特异性才会发挥作用 - 这不是这里的情况。 它几乎与您拥有以下内容相同: html .red { /* html in front to increase specificity */ color: red; background-color: grey; } .first-letter { /* replaced pseudo element with a clas ...
-
将伪元素语法与:first-child和first-letter混合使用(Baffling pseudo-element syntax with :first-child and :first-letter)[2022-03-10]
你的困惑来自这样:first-child事实:first-child和:last-child是伪类 ,而不是伪元素。 它们中的每一个都分别表示其父项的第一个和最后一个子项,但您附加它们的元素代表子项 ,而不是父项 。 伪类是某个元素的描述 ,如果您愿意,就像ID选择器描述具有该ID的元素或属性选择器描述具有该属性的元素一样。 因此,选择器E:first-child意味着E是其父母的第一个孩子 - 不管该父母是什么 - 但不是E的第一个孩子。 选择器#article1:first-child应该匹配#arti ... -
你的p标签不是第一个孩子。 那就是问题所在 尝试第一类 your p tag is not first child. That is the problem try first-of-type
-
article没有first-letter的first-letter ......但它内部的段落确实如此。 我很惊讶原版在任何浏览器中都有效。
-
根据SVG 1.1的规格 (强调我的) CSS2的动态伪类:hover,:active和:focus和伪类:first-child,:visited,:link和:lang([CSS2],第5.11节)。 其余的CSS2伪类 ,包括那些与生成内容有关的伪类 ([CSS2],第12章), 不是SVG语言定义的一部分。 所以nope, ::first-letter不应该在svg上运行。 请注意,您可以使用
元素和:first-child选择器来解决此问题。 .html-text { font- ... -
你错过了一个空间。 你想要的是第一个孩子的跨度,而不是第一个孩子的div。 找到第一个跨度: #messages > div :first-child 找到第一个div: #messages > div:first-child You're missing a space. You want the span that's the first child, not the div that's the first child. Finds the first span: #messages > div ...
-
您可以将它放在CSS中,而不是将您的“»”放在HTML中 http://jsfiddle.net/4DnKu/4/ a.one:before { content: "»"; color:#0F0; padding:0 5px 0 0; } 恕我直言,它不应该在HTML中,因为它实际上只是装饰。 所有主流浏览器都支持伪元素,只有一个你会遇到问题的是IE <8。 在那里你可以使用CSS表达式作为一种解决方法(谨慎处理!): a.one { *zoom: expression( ...