使用 ping cmd的redis:
import redisfrom redis import ConnectionErrorimport logginglogging.basicConfig()logger = logging.getLogger('redis')rs = redis.Redis("localhost")try: rs.ping()except ConnectionError: logger.error("Redis isn't running. try `/etc/init.d/redis-server restart`") exit(0)
ERROR:redis:Redis isn't running. try `/etc/init.d/redis-server restart`
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)