开发者社区 > 云原生 > 正文

Centos 部署Tair 社区版,使用 Python 和 Tair SDK 连接 Ta连接存在问题

1、检验部署
(venv) [root@slave1 tair_bin]# ./sbin/tairclient -c 192.168.60.101:5198 -g group_test
TAIR> put name foo
put: success
TAIR> get name
KEY: name, LEN: 3
raw data: fo, \66\6F\6F
TAIR>

2、使用 Python 和 Tair SDK 连接 Tair
```>>> from tair import Tair

host = "192.168.60.101"
port = 5198
password = None
client = Tair(host=host, port=port, password=password)
client.set("name", "Tair Example")
Traceback (most recent call last):
File "", line 1, in
File "/opt/cyber/securityrange/venv/lib/python3.9/site-packages/redis/commands/core.py", line 2302, in set
return self.execute_command("SET", pieces, *options)
File "/opt/cyber/securityrange/venv/lib/python3.9/site-packages/redis/client.py", line 1258, in execute_command
return conn.retry.call_with_retry(
File "/opt/cyber/securityrange/venv/lib/python3.9/site-packages/redis/retry.py", line 49, in call_with_retry
fail(error)
File "/opt/cyber/securityrange/venv/lib/python3.9/site-packages/redis/client.py", line 1262, in
lambda error: self._disconnect_raise(conn, error),
File "/opt/cyber/securityrange/venv/lib/python3.9/site-packages/redis/client.py", line 1248, in _disconnect_raise
raise error
File "/opt/cyber/securityrange/venv/lib/python3.9/site-packages/redis/retry.py", line 46, in call_with_retry
return do()
File "/opt/cyber/securityrange/venv/lib/python3.9/site-packages/redis/client.py", line 1259, in
lambda: self._send_command_parse_response(
File "/opt/cyber/securityrange/venv/lib/python3.9/site-packages/redis/client.py", line 1235, in _send_command_parse_response
return self.parse_response(conn, command_name,
options)
File "/opt/cyber/securityrange/venv/lib/python3.9/site-packages/redis/client.py", line 1275, in parse_response
response = connection.read_response()
File "/opt/cyber/securityrange/venv/lib/python3.9/site-packages/redis/connection.py", line 848, in read_response
response = self._parser.read_response(disable_decoding=disable_decoding)
File "/opt/cyber/securityrange/venv/lib/python3.9/site-packages/redis/connection.py", line 482, in read_response
self.read_from_socket()
File "/opt/cyber/securityrange/venv/lib/python3.9/site-packages/redis/connection.py", line 444, in read_from_socket
raise ConnectionError(SERVER_CLOSED_CONNECTION_ERROR)
redis.exceptions.ConnectionError: Connection closed by server.


3、日志记录

[root@slave1 ~]# tail -f /root/tair_bin/logs/config.log
[2024-11-21 09:45:44.679037] ERROR decode_cb (packet_factory.cpp:90) [139698103080704] decoding failed: flag=707988746, len=170144781, m->status=0, pcode=1397052429
[2024-11-21 09:45:44.678] easy_connection.c:952(tid:7f0dffcf5700) decode error, [::ffff:192.168.60.101]:55366_30_0x7f0df00013b0 m=0x7f0df00030b0, cnt=0
[2024-11-21 09:49:00.399246] ERROR decode_cb (packet_factory.cpp:90) [139698103080704] decoding failed: flag=707988746, len=170144781, m->status=0, pcode=1397052429
[2024-11-21 09:49:00.399] easy_connection.c:952(tid:7f0dffcf5700) decode error, [::ffff:192.168.60.101]:55398_30_0x7f0df00013b0 m=0x7f0df00030b0, cnt=0

```

展开
收起
游客lvcvbvpvqqay6 2024-11-21 09:51:49 9 1
0 条回答
写回答
取消 提交回答

阿里云拥有国内全面的云原生产品技术以及大规模的云原生应用实践,通过全面容器化、核心技术互联网化、应用 Serverless 化三大范式,助力制造业企业高效上云,实现系统稳定、应用敏捷智能。拥抱云原生,让创新无处不在。

相关电子书

更多
低代码开发师(初级)实战教程 立即下载
冬季实战营第三期:MySQL数据库进阶实战 立即下载
阿里巴巴DevOps 最佳实践手册 立即下载