diff --git a/db.py b/db.py index 606f4da..83701c6 100644 --- a/db.py +++ b/db.py @@ -14,7 +14,7 @@ from schemas import mc_s from os import getenv from time import sleep -configuration = manticoresearch.Configuration(host="http://monolith_db:9308") +configuration = manticoresearch.Configuration(host="http://127.0.0.1:9308") api_client = manticoresearch.ApiClient(configuration) api_instance = manticoresearch.IndexApi(api_client) @@ -23,17 +23,21 @@ log = util.get_logger("db") # Redis (legacy) # r = StrictRedis(unix_socket_path="/var/run/redis/redis.sock", db=0) r = StrictRedis( - host="ssdb_monolith", # Replace with your Redis server's IP address + host="127.0.0.1", # Replace with your Redis server's IP address port=1289, # Replace with your Redis server's port db=0 # Database number ) # AIORedis # ar = aioredis.from_url("unix:///var/run/redis/redis.sock", db=0) ar = aioredis.from_url( - "redis://ssdb_monolith:1289", + "redis://127.0.0.1:1289", db=0 ) -pr = aioredis.from_url("redis://redis_neptune:6379", db=10, password=getenv("REDIS_PASSWORD")) + +# /var/run/neptune-redis.sock +# db = 10 +pr = aioredis.from_url("unix://var/run/neptune-redis.sock", db=10) +#pr = aioredis.from_url("redis://redis_neptune:6379", db=10, password=getenv("REDIS_PASSWORD")) KEYNAME = "queue" MESSAGE_KEY = "messages" @@ -157,19 +161,20 @@ async def store_batch(data): body_post = "" for item in total: - print("ITEM", item) + #print("ITEM", item) body_post += orjson.dumps(item).decode("utf-8") body_post += "\n" - # print(body_post) + #print("BODY POST INDEX", index, body_post) try: # Bulk index operations api_response = api_instance.bulk(body_post) # , async_req=True except ApiException as e: - print("Exception when calling IndexApi->bulk: %s\n" % e) - print(f"Completed ingest to MC of length {len(total)}") + log.error("Exception when calling IndexApi->bulk: %s\n" % e) + log.error("body_post attempted to send", body_post) + log.info(f"Completed ingest to MC of length {len(total)}") # END MESSAGES IN SPLIT diff --git a/docker/redis.conf b/docker/redis.conf index b4acb37..d91fec2 100644 --- a/docker/redis.conf +++ b/docker/redis.conf @@ -1,4 +1,5 @@ -# unixsocket /var/run/socks/redis.sock -# unixsocketperm 777 -port 6379 -requirepass changeme \ No newline at end of file +unixsocket /var/run/monolith-redis.sock +unixsocketperm 777 +port 0 +# port 6379 +# requirepass changeme \ No newline at end of file