forked from docs/doc-exports
Reviewed-by: Hasko, Vladimir <vladimir.hasko@t-systems.com> Co-authored-by: Chen, Junjie <chenjunjie@huawei.com> Co-committed-by: Chen, Junjie <chenjunjie@huawei.com>
45 lines
7.7 KiB
HTML
45 lines
7.7 KiB
HTML
<a name="dcs-faq-0730006"></a><a name="dcs-faq-0730006"></a>
|
|
|
|
<h1 class="topictitle1">What Should I Do If an Error Is Returned When I Use the Jedis Connection Pool?</h1>
|
|
<div id="body1596093268949"><p id="dcs-faq-0730006__en-us_topic_0152099099_p1038812015818">The error message that will possibly be displayed when you <span class="keyword" id="dcs-faq-0730006__keyword39817314147">use the Jedis connection pool</span> is as follows:</p>
|
|
<pre class="screen" id="dcs-faq-0730006__en-us_topic_0152099099_screen2398182394217">redis.clients.jedis.exceptions.JedisConnectionException: Could not get a resource from the pool</pre>
|
|
<p id="dcs-faq-0730006__en-us_topic_0152099099_p129321946103813">If this error message is displayed, check whether your instance is running properly. If it is running properly, perform the following checks:</p>
|
|
<ol id="dcs-faq-0730006__en-us_topic_0152099099_ol980141914912"><li id="dcs-faq-0730006__en-us_topic_0152099099_li10802819590"><span>Network</span><p><ol type="a" id="dcs-faq-0730006__en-us_topic_0152099099_ol4963821184719"><li id="dcs-faq-0730006__en-us_topic_0152099099_li3963182119479">Check the IP address configurations.<p id="dcs-faq-0730006__en-us_topic_0152099099_p173211526174712"><a name="dcs-faq-0730006__en-us_topic_0152099099_li3963182119479"></a><a name="en-us_topic_0152099099_li3963182119479"></a>Check whether the IP address configured on the <span class="keyword" id="dcs-faq-0730006__keyword324316961418">Jedis client</span> is the same as the subnet address configured for your DCS instance. </p>
|
|
</li><li id="dcs-faq-0730006__en-us_topic_0152099099_li99631217478">Test the network.<p id="dcs-faq-0730006__en-us_topic_0152099099_p113161961483"><a name="dcs-faq-0730006__en-us_topic_0152099099_li99631217478"></a><a name="en-us_topic_0152099099_li99631217478"></a>Use the ping command and telnet on the client to test the network.</p>
|
|
<ul id="dcs-faq-0730006__en-us_topic_0152099099_ul97951811705"><li id="dcs-faq-0730006__en-us_topic_0152099099_li6637143813114">If the network cannot be pinged:<p id="dcs-faq-0730006__p8645128191212"><a name="dcs-faq-0730006__en-us_topic_0152099099_li6637143813114"></a><a name="en-us_topic_0152099099_li6637143813114"></a>For intra-VPC access to a DCS Redis 3.0 instance, ensure that the client and your DCS instance belong to the same VPC and security group, or the security group of your DCS instance allows access through port 6379. For details, see <a href="en-us_topic_0090662012.html">Security Group Configurations</a>.</p>
|
|
</li><li id="dcs-faq-0730006__en-us_topic_0152099099_li1799555071112">If the IP address can be pinged but telnet failed, restart your instance. If the problem persists after the restart, contact technical support.</li></ul>
|
|
</li></ol>
|
|
</p></li><li id="dcs-faq-0730006__en-us_topic_0152099099_li63411545691"><span>Check the number of connections.</span><p><p id="dcs-faq-0730006__en-us_topic_0152099099_p1594544203317">Check whether the number of established network connections exceeds the upper limit configured for the Jedis connection pool. If the number of established connections approaches the configured upper limit, restart the DCS service and check whether the problem persists. If the number of established connections is far below the upper limit, continue with the following checks.</p>
|
|
<p id="dcs-faq-0730006__en-us_topic_0152099099_p515384944111">In Unix or Linux, run the following command to query the number of established network connections:</p>
|
|
<p id="dcs-faq-0730006__en-us_topic_0152099099_p19169838112219"><strong id="dcs-faq-0730006__en-us_topic_0152099099_b0121205511435">netstat -an | grep 6379 | grep ESTABLISHED | wc -l</strong></p>
|
|
<p id="dcs-faq-0730006__en-us_topic_0152099099_p14884115514418">In Windows, run the following command to query the number of established network connections:</p>
|
|
<p id="dcs-faq-0730006__en-us_topic_0152099099_p13561849175510"><strong id="dcs-faq-0730006__en-us_topic_0152099099_b2037082414429">netstat -an | find "6379" | find "ESTABLISHED" /C</strong></p>
|
|
</p></li><li id="dcs-faq-0730006__en-us_topic_0152099099_li1283731212108"><span>Check the JedisPool code.</span><p><p id="dcs-faq-0730006__en-us_topic_0152099099_p172620265618">If the number of established connections approaches the upper limit, determine whether the problem is caused by service concurrency or incorrect usage of JedisPool.</p>
|
|
<p id="dcs-faq-0730006__en-us_topic_0152099099_p87131344163913">When using JedisPool, you must call <strong id="dcs-faq-0730006__b181141746121417">jedisPool.returnResource()</strong> or <strong id="dcs-faq-0730006__b811415461149">jedis.close()</strong> (recommended) to release the resources after you call <strong id="dcs-faq-0730006__b311594631414">jedisPool.getResource()</strong>.</p>
|
|
</p></li><li id="dcs-faq-0730006__en-us_topic_0152099099_li7328193913107"><span>Check the number of <span class="keyword" id="dcs-faq-0730006__keyword3174204712145">TIME_WAIT</span> connections.</span><p><p id="dcs-faq-0730006__en-us_topic_0152099099_p192786914011">Run the <strong id="dcs-faq-0730006__b289214488143">ss -s</strong> command to check whether there are too many <strong id="dcs-faq-0730006__b08932048141418">TIME_WAIT</strong> connections on the client.</p>
|
|
<p id="dcs-faq-0730006__en-us_topic_0152099099_p16614112484920"><span><img id="dcs-faq-0730006__en-us_topic_0152099099_image20133830143115" src="en-us_image_0266315615.png"></span></p>
|
|
<p id="dcs-faq-0730006__en-us_topic_0152099099_p1886034974910">If there are too many <strong id="dcs-faq-0730006__b177655506149">TIME_WAIT</strong> connections, modify the kernel parameters by running the <strong id="dcs-faq-0730006__b3766050111419">/etc/sysctl.conf</strong> command as follows:</p>
|
|
<pre class="screen" id="dcs-faq-0730006__en-us_topic_0152099099_screen1874851017377">##Uses cookies to prevent some SYN flood attacks when the SYN waiting queue overflows.
|
|
net.ipv4.tcp_syncookies = 1
|
|
##Reuses <strong id="dcs-faq-0730006__b12585125411141">TIME_WAIT</strong> sockets for new TCP connections.
|
|
net.ipv4.tcp_tw_reuse = 1
|
|
##Enables quick reclamation of <strong id="dcs-faq-0730006__b1937519562145">TIME_WAIT</strong> sockets in TCP connections.
|
|
net.ipv4.tcp_tw_recycle = 1
|
|
##Modifies the default timeout time of the system.
|
|
net.ipv4.tcp_fin_timeout = 30</pre>
|
|
<p id="dcs-faq-0730006__en-us_topic_0152099099_p1699145417363">After the modification, run the <strong id="dcs-faq-0730006__b19280508159">/sbin/sysctl -p</strong> command for the modification to take effect.</p>
|
|
</p></li><li id="dcs-faq-0730006__en-us_topic_0152099099_li0857976116"><span>If the problem persists after you perform the preceding checks, perform the following steps.</span><p><p id="dcs-faq-0730006__en-us_topic_0152099099_p1231215485513">Capture packets and send packet files along with the time and description of the exception to technical support for analysis.</p>
|
|
<p id="dcs-faq-0730006__en-us_topic_0152099099_p897110554515">Run the following command to capture packets:</p>
|
|
<p id="dcs-faq-0730006__en-us_topic_0152099099_p31223103512"><strong id="dcs-faq-0730006__en-us_topic_0152099099_b11679160115217">tcpdump -i eth0 tcp and port 6379 -n -nn -s 74 -w dump.pcap</strong></p>
|
|
<p id="dcs-faq-0730006__en-us_topic_0152099099_p87821548142">In Windows, you can also install the Wireshark tool to capture packets.</p>
|
|
<div class="note" id="dcs-faq-0730006__en-us_topic_0152099099_note1271424122719"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><p id="dcs-faq-0730006__en-us_topic_0152099099_p98189192712">Replace the NIC name to the actual one.</p>
|
|
</div></div>
|
|
</p></li></ol>
|
|
</div>
|
|
<div>
|
|
<div class="familylinks">
|
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="dcs-faq-0326020.html">Client and Network Connection</a></div>
|
|
</div>
|
|
</div>
|
|
|