12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- import pymysql
- class db_config:
- def __init__(self):
- self.db_ip = "192.168.1.200" # 数据库IP地址
- self.db_port = 3306 # 端口号
- self.db_name = "xm_project" # 数据库名
- self.db_user = "zx" # 用户名
- self.db_password = "123456" # 用户密码
- self.db_charset = "utf8" # 数据库连接编码
- self.db_mincached = 10 # mincached : 启动时开启的闲置连接数量(缺省值 0 开始时不创建连接)
- self.db_maxcached = 10 # maxcached : 连接池中允许的闲置的最多连接数量(缺省值 0 代表不闲置连接池大小)
- self.db_maxshared = 20 # maxshared : 共享连接数允许的最大数量(缺省值 0 代表所有连接都是专用的)如果达到了最大数量,被请求为共享的连接将会被共享使用
- self.db_maxconnecyions = 100 # maxconnecyions : 创建连接池的最大数量(缺省值 0 代表不限制)
- self.db_blocking = True # blocking : 设置在连接池达到最大数量时的行为(缺省值 0 或 False 代表返回一个错误<toMany......> 其他代表阻塞直到连接数减少,连接被分配)
- self.db_maxusage = 0 # maxusage : 单个连接的最大允许复用次数(缺省值 0 或 False 代表不限制的复用).当达到最大数时,连接会自动重新连接(关闭和重新打开)
- self.db_setsession = None # setsession : 一个可选的SQL命令列表用于准备每个会话,如["set datestyle to german", ...]
- self.db_creator = pymysql # creator : 使用连接数据库的模块
- DB_CONFIG = db_config()
- class mq_config:
- def __init__(self):
- self.mq_ip = "192.168.1.200" # rabbitmq服务器ip地址
- self.mq_port = 5672 # 端口
- self.mq_user = "zx" # 用户名
- self.mq_password = "123456" # 用户密码
- self.mq_command_exchange_name = "command_ex" # 指令交换机名
- self.mq_statu_exchange_name = "statu_ex" # 状态交换机名
- self.mq_statu_exchange_keys = [[self.mq_statu_exchange_name, "dispatch_11_statu_port"],
- [self.mq_statu_exchange_name, "dispatch_12_statu_port"],
- [self.mq_statu_exchange_name, "dispatch_13_statu_port"],
- [self.mq_statu_exchange_name, "dispatch_14_statu_port"],
- [self.mq_statu_exchange_name, "dispatch_21_statu_port"],
- [self.mq_statu_exchange_name, "dispatch_22_statu_port"],
- [self.mq_statu_exchange_name, "dispatch_23_statu_port"],
- [self.mq_statu_exchange_name, "dispatch_24_statu_port"],
- [self.mq_statu_exchange_name, "dispatch_25_statu_port"],
- [self.mq_statu_exchange_name, "dispatch_31_statu_port"],
- [self.mq_statu_exchange_name, "dispatch_32_statu_port"]] # 状态交换机需要订阅的端口列表
- MQ_CONFIG = mq_config()
|