You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This time I'm running a redis-plus-plus client on a different machine than server, However i think i've not installed redis-plus-plus correctly, i tried multiple times and download multiple versions of hiredis to make this work, but every time i compile the client with below command, i get this result as shown below:
root@user-HP-Pavilion-Notebook:/home/user/tests/redisclient# g++ -std=c++11 -o hclient hclient.cpp -lredis++ -lhiredis
/usr/bin/ld: warning: libhiredis.so.1.0.1-dev, needed by /usr/local/lib/libredis++.so, may conflict with libhiredis.so.0.14
and while running the client, I get this error:
terminate called after throwing an instance of 'sw::redis::ProtoError'
what(): A null status reply
Aborted (core dumped)
As my client is using OptionalString so I tried compiling it with -stdc++=17:
root@user-HP-Pavilion-Notebook:/home/user/tests/redisclient# g++ -std=c++17 -o hclient hclient.cpp -lredis++ -lhiredis
/usr/bin/ld: warning: libhiredis.so.1.0.1-dev, needed by /usr/local/lib/libredis++.so, may conflict with libhiredis.so.0.14
/usr/bin/ld: /tmp/ccug3Swh.o: in function `sw::redis::QueuedRedis<sw::redis::PipelineImpl>::set(std::basic_string_view<char, std::char_traits<char> > const&, std::basic_string_view<char, std::char_traits<char> > const&, std::chrono::duration<long, std::ratio<1l, 1000l> > const&, sw::redis::UpdateType)':
hclient.cpp:(.text._ZN2sw5redis11QueuedRedisINS0_12PipelineImplEE3setERKSt17basic_string_viewIcSt11char_traitsIcEES9_RKNSt6chrono8durationIlSt5ratioILl1ELl1000EEEENS0_10UpdateTypeE[_ZN2sw5redis11QueuedRedisINS0_12PipelineImplEE3setERKSt17basic_string_viewIcSt11char_traitsIcEES9_RKNSt6chrono8durationIlSt5ratioILl1ELl1000EEEENS0_10UpdateTypeE]+0x77): undefined reference to `sw::redis::cmd::set(sw::redis::Connection&, std::basic_string_view<char, std::char_traits<char> > const&, std::basic_string_view<char, std::char_traits<char> > const&, long long, sw::redis::UpdateType)'
collect2: error: ld returned 1 exit status
Redis-client:
#include <sw/redis++/redis++.h>
#include <bits/stdc++.h>
#include <unistd.h>
#define ll long long
using namespace std;
using namespace sw::redis;
int main(){
// ***** Pipeline *****
auto redis = Redis("tcp://192.168.122.36:6379");
// Create a pipeline.
// auto pipe = redis.pipeline(false);
int ep = 1;
while(true){
cout<<"========================"<<ep++<<"==================================================\n";
auto pipe = redis.pipeline(false);
for(int i=1; i<=1000; i++){
string s = to_string(i);
if(i%2 == 1){
pipe.set(s, s);
}
else {
string st = to_string(i-1);
pipe.get(st);
}
}
auto pipe_replies = pipe.exec();
for (int i=1; i<=1000; i++) {
if (i%2 == 1) {
auto set_result = pipe_replies.get<bool>(i-1);
cout<<set_result<<"\n";
} else {
OptionalString get_result = pipe_replies.get<OptionalString>(i-1);
if (get_result)
cout << *get_result << endl;
else
cout << "key does not exist" << endl;
}
}
pipe.discard();
}
return 0;
}
The text was updated successfully, but these errors were encountered:
If the code works in other environment, you'd better uninstall hiredis, and redis-plus-plus completely first, and then reinstall these libraries, and try again.
It seems that libhiredis.so.1.0.1-dev is installed with apt-get or yum, and libhiredis.so.0.14 is manually installed. Another option is to manually install hiredis at a non-default location, and depend on this version.
This time I'm running a redis-plus-plus client on a different machine than server, However i think i've not installed redis-plus-plus correctly, i tried multiple times and download multiple versions of hiredis to make this work, but every time i compile the client with below command, i get this result as shown below:
and while running the client, I get this error:
As my client is using
OptionalString
so I tried compiling it with-stdc++=17
:Redis-client:
The text was updated successfully, but these errors were encountered: