
5 changed files with 27 additions and 9 deletions
@ -0,0 +1,16 @@
@@ -0,0 +1,16 @@
|
||||
#!/usr/bin/python3 |
||||
import tarantool |
||||
import random |
||||
|
||||
def tarantool_connect(): |
||||
availble_db = ["db-tarantool", "db-tarantool2"] |
||||
random.shuffle(availble_db) # for load balancing |
||||
try: |
||||
connection = tarantool.connect(availble_db[0], 3301) |
||||
return connection.space('maindb') |
||||
except: |
||||
connection = tarantool.connect(availble_db[1], 3301) |
||||
return connection.space('maindb') |
||||
|
||||
|
||||
|
Loading…
Reference in new issue