我在dart中使用redis库。每次出错:
从Redis检索数据时出错:RedisRuntimeError(得到了无法解析的元素)
当我运行函数时:
static void connect() {
final url = _IP;
RedisConnection conn = new RedisConnection();
conn.connect('localhost', 3022).then((Command command) {
command.get("TEST").then((var response) {
var xx = response;
print(response);
}).catchError((error) {
print("Error retrieving data from Redis: $error");
});
}).catchError((error) {
print("Error connecting to Redis: $error");
});
}
字符串
Redis只是正常设置。我将redis server .conf-File中的ip改为0.0.0.0-该端口是.conf文件中的默认端口(6379)-但我目前正在Oracle VM中运行redis,因此我需要从隧道中输入端口3022。在ssh在命令工具在windows(虚拟机运行Ubuntu)我可以正常访问服务器-也服务器正在运行-这是启动信息:
1225:C 24 Jul 2023 12:38:46.303 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
1225:C 24 Jul 2023 12:38:46.306 # Redis version=7.0.4, bits=64, commit=00000000, modified=0, pid=1225, just started
1225:C 24 Jul 2023 12:38:46.307 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf
1225:M 24 Jul 2023 12:38:46.307 * Increased maximum number of open files to 10032 (it was originally set to 1024).
1225:M 24 Jul 2023 12:38:46.308 * monotonic clock: POSIX clock_gettime
_._
_.-``__ ''-._
_.-`` `. `_. ''-._ Redis 7.0.4 (00000000/0) 64 bit
.-`` .-```. ```\/ _.,_ ''-._
( ' , .-` | `, ) Running in standalone mode
|`-._`-...-` __...-.``-._|'` _.-'| Port: 6379
| `-._ `._ / _.-' | PID: 1225
`-._ `-._ `-./ _.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' | https://redis.io
`-._ `-._`-.__.-'_.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' |
`-._ `-._`-.__.-'_.-' _.-'
`-._ `-.__.-' _.-'
`-._ _.-'
`-.__.-'
1225:M 24 Jul 2023 12:38:46.312 # Server initialized
1225:M 24 Jul 2023 12:38:46.313 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
1225:M 24 Jul 2023 12:38:46.314 * Ready to accept connections
1225:M 24 Jul 2023 14:35:18.278 * 1 changes in 3600 seconds. Saving...
1225:M 24 Jul 2023 14:35:18.302 * Background saving started by pid 1392
1392:C 24 Jul 2023 14:35:18.321 * DB saved on disk
1392:C 24 Jul 2023 14:35:18.324 * Fork CoW for RDB: current 0 MB, peak 0 MB, average 0 MB
1225:M 24 Jul 2023 14:35:18.404 * Background saving terminated with success
型
当我在命令提示符下使用GET TEST
时,我得到的值是"999"
有谁知道,这是怎么回事?
1条答案
按热度按时间50few1ms1#
好的,问题解决了:在Oracle VM中,未配置端口隧道-我必须将隧道从6379设置为6379,并将代码更改为6379