OS UBUNTU 12.04 32 bit GOLANG 1.9 On Monday, August 28, 2017 at 11:55:02 AM UTC+5:30, Vijay Kumar Giri wrote: > > package main > > > import ( > > "fmt" > > > "github.com/go-redis/redis" > > ) > > > func main() { > > > client := redis.NewClient(&redis.Options{ > > Addr: "localhost:6379", > > Password: "", // no password set > > DB: 0, // use default DB > > }) > > > info := client.ClusterInfo() > > fmt.Println("INFO::", info) > > > } > > > > Output:: INFO:: cluster info: ERR unknown command 'cluster' > > > root@vijay:~/g2agent/src# netstat -apn |grep redis > tcp 0 0 127.0.0.1:6379 0.0.0.0:* LISTEN > 1746/redis-server > > root@vijay:~/g2agent/src# redis-cli -p 6379 > > > redis 127.0.0.1:6379> cluster info > (error) ERR unknown command 'cluster' > > > After Searching I found --- > > > Your last error is "ERR unknown command 'cluster'" – The command is unknown, > and this error only happens on older Redis versions. > > > > But My question is how to achieve this in Redis server version 2.2.12 or > above using GOLANG, > > > IN python it is working fine > > > def getRedisConnection(self): > > import redis # @UnresolvedImport > > if not self.conn: > > //self.params ---- {'host': '127.0.0.1', 'port': 6379} > > self.conn = redis.Redis(**self.params) > > return self.conn > > > conn = self.getRedisConnection() > > info = conn.info() > > > info --- {'pubsub_channels': 0, 'aof_enabled': 0, 'bgrewriteaof_in_progress': > 0, 'connected_slaves': 0, 'uptime_in_days': 0, 'multiplexing_api': 'epoll', > 'lru_clock': 1492331, 'last_save_time': 1503898039, 'redis_version': > '2.2.12', 'redis_git_sha1': 0, 'loading': 0, 'connected_clients': 1, > 'keyspace_misses': 0, 'used_memory': 547516, 'vm_enabled': 0, > 'used_cpu_user_children': 0.0, 'role': 'master', 'total_commands_processed': > 6, 'used_memory_rss': 1105920, 'total_connections_received': 10, > 'pubsub_patterns': 0, 'used_cpu_sys': 1.1, 'used_memory_human': '534.68K', > 'used_cpu_sys_children': 0.0, 'blocked_clients': 0, 'used_cpu_user': 0.81, > 'use_tcmalloc': 0, 'client_biggest_input_buf': 0, 'arch_bits': 32, > 'redis_git_dirty': 0, 'expired_keys': 0, 'hash_max_zipmap_entries': 512, > 'evicted_keys': 0, 'bgsave_in_progress': 0, 'client_longest_output_list': 0, > 'hash_max_zipmap_value': 64, 'process_id': 1746, 'uptime_in_seconds': 3194, > 'changes_since_last_save': 0, 'mem_fragmentation_ratio': 2.02, > 'keyspace_hits': 0} > {'isInstance': 0, 'poll_time': 1503901233.751573, 'monitor': > 'redis.pubsub.patterns', 'perf_data': [{'perfdata': 'pubsub_patterns=0', > 'state': '0', 'description': 'pubsub_patterns: 0'}]} > > > > Thanks > > Vijay > > >
-- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.