{"id":866,"date":"2020-11-19T11:14:26","date_gmt":"2020-11-19T03:14:26","guid":{"rendered":"https:\/\/www.linuxdevops.cn\/?p=866"},"modified":"2022-06-24T11:10:15","modified_gmt":"2022-06-24T03:10:15","slug":"configuration-of-archery-sql-audit-system","status":"publish","type":"post","link":"https:\/\/www.linuxdevops.cn\/2020\/11\/configuration-of-archery-sql-audit-system\/","title":{"rendered":"Archery SQL\u5ba1\u8ba1\u7cfb\u7edf\u642d\u5efa\u914d\u7f6e"},"content":{"rendered":"
curl -fsSL https:\/\/get.docker.com -o get-docker.sh | sudo sh<\/code><\/pre>\n\n- \u5b89\u88c5 Docker Compose<\/a><\/li>\n<\/ul>\n
sudo curl -L "https:\/\/github.com\/docker\/compose\/releases\/download\/1.24.1\/docker-compose-$(uname -s)-$(uname -m)" -o \/usr\/local\/bin\/docker-compose\nsudo chmod +x \/usr\/local\/bin\/docker-compose<\/code><\/pre>\n\u51c6\u5907\u8fd0\u884c\u914d\u7f6e\u00b6<\/a><\/h2>\n\u5177\u4f53\u53ef\u53c2\u8003\uff1ahttps:\/\/github.com\/hhyo\/Archery\/tree\/master\/src\/docker-compose<\/a><\/p>\ndocker-compose.yml\u6587\u4ef6\u5185\u7684services\u53ef\u6309\u7167\u672c\u8eab\u7684\u8fd0\u884c\u73af\u5883\u6765\u8c03\u6574\uff0c\u540c\u65f6\u6ce8\u610f\u68c0\u67e5\u7248\u672c\u53f7\u662f\u5426\u6b63\u786e\uff0c\u6bd4\u5982\u8bf4\u5916\u90e8\u5df2\u7ecf\u88c5\u597d\u4e86mysql\u3001redis\u3001inception\uff0c\u5c31\u53ef\u4ee5\u5c06\u5bf9\u5e94\u7684services\u5220\u9664\uff0c\u4f46\u662f\u9700\u8981\u6ce8\u610f\u4fee\u6539settings.py\u6587\u4ef6\u7684\u76f8\u5173\u914d\u7f6e\uff0c\u5177\u4f53\u53ef\u4ee5\u53c2\u8003\u4fee\u6539\u914d\u7f6e<\/a><\/p>\n\u542f\u52a8\u00b6<\/a><\/h2>\n\u4e0b\u8f7d Releases<\/a>\u6587\u4ef6\uff0c\u89e3\u538b\u540e\u8fdb\u5165docker-compose\u6587\u4ef6\u5939<\/p>\n# \u542f\u52a8\ndocker-compose -f docker-compose.yml up -d\n\n# \u8868\u7ed3\u6784\u521d\u59cb\u5316\ndocker exec -ti archery \/bin\/bash\ncd \/opt\/archery\nsource \/opt\/venv4archery\/bin\/activate\npython3 manage.py makemigrations sql \npython3 manage.py migrate \n\n# \u6570\u636e\u521d\u59cb\u5316\npython3 manage.py dbshell<sql\/fixtures\/auth_group.sql\npython3 manage.py dbshell<src\/init_sql\/mysql_slow_query_review.sql\n\n# \u521b\u5efa\u7ba1\u7406\u7528\u6237\npython3 manage.py createsuperuser\n\n# \u91cd\u542f\ndocker restart archery\n\n# \u65e5\u5fd7\u67e5\u770b\u548c\u95ee\u9898\u6392\u67e5\ndocker logs archery -f --tail=50<\/code><\/pre>\n\u8bbf\u95ee\u00b6<\/a><\/h2>\nhttp:\/\/127.0.0.1:9123<\/a><\/p>\n\u542f\u52a8\u540e\u914d\u7f6e\u00b6<\/a><\/h2>\n\u5728\u542f\u52a8\u540e Archery \u6709\u4e00\u4e9b\u914d\u7f6e(\u5982Inception , \u8d44\u6e90\u7ec4, \u6743\u9650\u7ec4\u7b49)\u9700\u8981\u6309\u9700\u914d\u7f6e, <\/p>\n
2. \u7cfb\u7edf\u914d\u7f6e\u00b6<\/a><\/h1>\n<\/p>\n
Inception\u914d\u7f6e\u00b6<\/a><\/h2>\nINCEPTION\u00b6<\/a><\/h5>\n\u662f\u5426\u542f\u7528Inception\u66ff\u6362goInception\uff0c\u5f00\u542f\u540e\u9700\u8981\u914d\u7f6eInception\u7684\u8fde\u63a5\u4fe1\u606f\uff0c\u5907\u4efd\u5e93\u7684\u914d\u7f6e\u5730\u5740\u53ef\u590d\u7528\uff0c\u5c06\u4f1a\u4f7f\u7528Inception\u6765\u66ff\u4ee3goInception\u5bf9MySQL\u8fdb\u884c\u5ba1\u6838\u548c\u6267\u884c<\/p>\n
GO_INCEPTION_HOST\u00b6<\/a><\/h5>\ngoInception\u7684\u8fde\u63a5\u5730\u5740\uff0c\u7528\u4e8eMySQL\u5ba1\u6838\u6267\u884c\uff0cdocker-compose\u542f\u52a8\u7684\u8bf7\u914d\u7f6e\u4e3a\u5bb9\u5668\u540d\uff0c\u6bd4\u5982goinception\uff0c\u53c2\u8003\u6587\u6863\uff1ahttps:\/\/github.com\/hanchuanchuan\/goInception<\/a><\/p>\nGO_INCEPTION_PORT\u00b6<\/a><\/h5>\ngoInception\u7684\u8fde\u63a5\u7aef\u53e3\uff0c\u9ed8\u8ba44000<\/p>\n
INCEPTION_HOST\u00b6<\/a><\/h5>\nInception\u8fde\u63a5HOST\uff0c\u7528\u4e8eSQL\u67e5\u8be2\u8bed\u6cd5\u89e3\u6790\uff0cdocker-compose\u542f\u52a8\u7684\u8bf7\u914d\u7f6e\u4e3a\u5bb9\u5668\u540d\uff0c\u6bd4\u5982inception\uff0c\u53c2\u8003\u6587\u6863 \uff1ahttps:\/\/github.com\/hhyo\/inception<\/a><\/p>\nINCEPTION_PORT\u00b6<\/a><\/h5>\nInception\u8fde\u63a5\u7aef\u53e3\uff0c\u5373Inception\u914d\u7f6e\u6587\u4ef6inc.cnf\u5185\u7684port<\/p>\n
REMOTE_BACKUP_HOST\u00b6<\/a><\/h5>\ngoInception\/Inception\u7684\u5907\u4efd\u5e93\u94fe\u63a5HOST\uff0c\u7528\u4e8e\u9875\u9762\u5c55\u793a\u56de\u6eda\u8bed\u53e5 - goInception\u548c\u914d\u7f6e\u6587\u4ef6config.toml\u5185\u7684backup_host<\/a>\u4fdd\u6301\u4e00\u81f4 - Inception\u548c\u914d\u7f6e\u6587\u4ef6inc.cnf\u5185\u7684inception_remote_backup_host<\/a>\u4fdd\u6301\u4e00\u81f4\uff0c\u5177\u4f53\u8bf4\u660e\u53ef\u53c2\u8003Inception \u5907\u4efd\u529f\u80fd\u8bf4\u660e<\/a><\/p>\nREMOTE_BACKUP_PORT\u00b6<\/a><\/h5>\ngoInception\/Inception\u7684\u5907\u4efd\u5e93\u94fe\u63a5\u7aef\u53e3 - goInception\u548c\u914d\u7f6e\u6587\u4ef6config.toml\u5185\u7684backup_port<\/a>\u4fdd\u6301\u4e00\u81f4 - Inception\u548c\u914d\u7f6e\u6587\u4ef6inc.cnf\u5185\u7684inception_remote_backup_port<\/a>\u4fdd\u6301\u4e00\u81f4<\/p>\nREMOTE_BACKUP_USER\u00b6<\/a><\/h5>\ngoInception\/Inception\u7684\u5907\u4efd\u5e93\u94fe\u63a5\u7528\u6237 - goInception\u548c\u914d\u7f6e\u6587\u4ef6config.toml\u5185\u7684backup_user<\/a>\u4fdd\u6301\u4e00\u81f4 - Inception\u548c\u914d\u7f6e\u6587\u4ef6inc.cnf\u5185\u7684inception_remote_system_user<\/a>\u4fdd\u6301\u4e00\u81f4<\/p>\n-- \u5efa\u8bae\u8d4b\u4e88\u7528\u6237\u6743\u9650\nGRANT SELECT, INSERT, CREATE ON *.* TO 'inception_bak'<\/code><\/pre>\nREMOTE_BACKUP_PASSWORD\u00b6<\/a><\/h5>\ngoInception\/Inception\u7684\u5907\u4efd\u5e93\u94fe\u63a5\u7528\u6237 - goInception\u548c\u914d\u7f6e\u6587\u4ef6config.toml\u5185\u7684backup_password<\/a>\u4fdd\u6301\u4e00\u81f4 - Inception\u548c\u914d\u7f6e\u6587\u4ef6inc.cnf\u5185\u7684inception_remote_system_password<\/a>\u4fdd\u6301\u4e00\u81f4<\/p>\n\u9700\u8981\u6ce8\u610f\u7684\u662f\uff0c\u8be5\u914d\u7f6e\u4fe1\u606f\uff0c\u4ec5\u4ec5\u7528\u4e8earchery\u4ece\u5907\u4efd\u5e93\u67e5\u8be2\u56de\u6eda\u8bed\u53e5\u4f7f\u7528\uff0c\u8be5\u914d\u7f6e\u4fe1\u606f\u4e0d\u4f1a\u88abgoInception\u670d\u52a1\u4f7f\u7528\uff0cgoInception\u8fde\u63a5\u5907\u4efd\u5e93\u4f7f\u7528\u7684\u6570\u636e\u5e93\u8fde\u63a5\u4fe1\u606f\u5e94\u5728\u5176\u81ea\u8eab\u7684config.toml\u4e2d\u914d\u7f6e\u3002<\/strong><\/p>\nSQL\u4e0a\u7ebf\u00b6<\/a><\/h2>\nCRITICAL_DDL_REGEX\u00b6<\/a><\/h5>\n<\/p>\n
\u9ad8\u5371SQL\u8bed\u53e5\u6b63\u5219\u5224\u65ad\u6761\u4ef6\uff0c\u7528\u4e8e\u63a7\u5236\u7981\u6b62\u63d0\u4ea4\u7684\u8bed\u53e5\uff0c\u5339\u914d\u7684\u8bed\u53e5\u4f1a\u7981\u6b62\u63d0\u4ea4\uff0c\u4f8b\u5982^truncate|^rename|^delete<\/code>\u5219\u4f1a\u7981\u6b62\u63d0\u4ea4\u6e05\u7a7a\u8868\u3001\u4fee\u6539\u8868\u540d\u3001\u5220\u9664\u64cd\u4f5c\u7684SQL\u8bed\u53e5\uff0c\u524d\u7aef\u5c55\u73b0\u5982\u4e0b <\/p>\nAUTO_REVIEW_WRONG\u00b6<\/a><\/h5>\n\u7528\u4e8e\u63a7\u5236\u81ea\u52a8\u9a73\u56de\u7684\u7b49\u7ea7\uff0c\u9a73\u56de\u7684\u5de5\u5355\u4e0d\u4f1a\u901a\u77e5\u5ba1\u6838\u4eba\uff0c\u4f1a\u7cfb\u7edf\u76f4\u63a5\u5ba1\u6838\u4e0d\u901a\u8fc7\u30021\u8868\u793aSQL\u4e0a\u7ebf\u5ba1\u6838\u51fa\u73b0\u8b66\u544a\u4fe1\u606f\u5c31\u9a73\u56de\uff0c2\u548c\u7a7a\u8868\u793a\u51fa\u73b0\u9519\u8bef\u624d\u9a73\u56de\uff0c\u5176\u4ed6\u8bbe\u7f6e\u8868\u793a\u4e0d\u9a73\u56de\uff0c\u5ba1\u6838\u89c4\u5219\u8bf7\u53c2\u8003Inception\u6240\u652f\u6301\u7684\u53c2\u6570\u53d8\u91cf<\/a>\uff0c\u524d\u7aef\u5c55\u73b0\u5982\u4e0b <\/p>\nENABLE_BACKUP_SWITCH\u00b6<\/a><\/h5>\n\u662f\u5426\u5f00\u542f\u5907\u4efd\u9009\u9879\uff0c\u672a\u5f00\u542f\u65f6\u63d0\u4ea4SQL\u5de5\u5355\uff0c\u5c06\u4e0d\u4f1a\u663e\u793a\u662f\u5426\u5907\u4efd\u9009\u62e9\u9879\uff0c\u7cfb\u7edf\u4f1a\u5f3a\u5236\u5907\u4efd<\/p>\n
AUTO_REVIEW\u00b6<\/a><\/h5>\n\u662f\u5426\u5f00\u542fSQL\u4e0a\u7ebf\u81ea\u52a8\u5ba1\u6279\uff0c\u5f00\u542f\u81ea\u52a8\u5ba1\u6279\u540e\uff0c\u5f53\u63d0\u4ea4\u7684SQL\u8bed\u53e5\u4e0d\u5339\u914dAUTO_REVIEW_REGEX\u89c4\u5219\uff0c\u5e76\u4e14update\u8bed\u53e5\u7684\u603b\u5f71\u54cd\u884c\u6570\u4f4e\u4e8eMAX_UPDATE_ROWS\u65f6\uff0c\u7cfb\u7edf\u5219\u4f1a\u81ea\u52a8\u5ba1\u6279\u901a\u8fc7\uff0c\u524d\u7aef\u5c55\u73b0\u5982\u4e0b <\/p>\n
AUTO_REVIEW_REGEX\u00b6<\/a><\/h5>\n\u6b63\u5219\u6761\u4ef6\uff0c\u7528\u4e8e\u8fc7\u6ee4\u90e8\u5206\u9700\u8981\u4eba\u5de5\u5ba1\u6838\u7684\u8bed\u53e5\uff0c\u5f00\u542f\u81ea\u52a8\u5ba1\u6279\u540e\uff0c\u5f53\u5de5\u5355\u4e2d\u5b58\u5728\u5339\u914d\u7684\u8bed\u53e5\u65f6\u5219\u9700\u8981\u4eba\u5de5\u5ba1\u6279\uff0c\u4f8b\u5982^create<\/code>\u5219\u8868\u793a\u5efa\u8868\u8bed\u53e5\u9700\u8981\u4eba\u5de5\u5ba1\u6279<\/p>\nMAX_UPDATE_ROWS\u00b6<\/a><\/h5>\n\u81ea\u52a8\u5ba1\u6279\u5141\u8bb8\u5de5\u5355\u6700\u5927\u66f4\u65b0\u884c\u6570\uff0c\u7cfb\u7edf\u4f1a\u904d\u5386\u5de5\u5355\u5185\u6240\u6709update\u8bed\u53e5\uff0c\u4f7f\u7528explain\u9884\u4f30\u5f71\u54cd\u884c\u6570\uff0c\u5f53\u5f71\u54cd\u51fd\u6570\u8d85\u8fc7\u8be5\u503c\u65f6\u5219\u5de5\u5355\u9700\u8981\u4eba\u5de5\u5ba1\u6279<\/p>\n
MANNUAL\u00b6<\/a><\/h4>\n\u662f\u5426\u5f00\u542fSQL\u4e0a\u7ebf\u624b\u5de5\u6267\u884c\u786e\u8ba4\uff0c\u5f00\u542f\u540e\u5728\u5ba1\u6838\u901a\u8fc7\u7684\u5de5\u5355\u8be6\u60c5\u4e2d\u4f1a\u51fa\u73b0\u624b\u5de5\u786e\u8ba4\u6309\u94ae\uff0c\u53ef\u4ee5\u4ec5\u4ec5\u4f9d\u9760Archery\u8d70\u5de5\u5355\u6d41\u7a0b\uff0cDBA\u7ebf\u4e0b\u624b\u52a8\u6267\u884c\u8bed\u53e5\u5e76\u4e14\u786e\u8ba4\u6267\u884c\u7ed3\u675f<\/p>\n
SQL\u67e5\u8be2\u00b6<\/a><\/h2>\nQUERY_CHECK\u00b6<\/a><\/h5>\n\u76f8\u5173issues: https:\/\/github.com\/hhyo\/Archery\/issues\/145<\/a><\/p>\n<\/p>\n
\u662f\u5426\u5f00\u542fSQL\u67e5\u8be2\u8131\u654f\u7684Inception\u68c0\u6d4b\uff0c\u5e73\u53f0\u7684SQL\u67e5\u8be2\u529f\u80fd\u4f9d\u9760Inception\u7684\u8bed\u6cd5\u6811\u6253\u5370<\/a>\u6765\u89e3\u6790\u67e5\u8be2\u8bed\u53e5\u4e2d\u5305\u542b\u7684\u5e93\u3001\u8868\u3001\u5b57\u6bb5\u4fe1\u606f\uff0c\u4ece\u800c\u8fdb\u884c\u6570\u636e\u8131\u654f<\/p>\n\n- \u5f00\u542fQUERY_CHECK\u540e\uff0c\u5982\u679c\u9047\u5230Inception\u65e0\u6cd5\u89e3\u6790\u7684\u8bed\u53e5\uff0c\u5219\u4f1a\u76f4\u63a5\u629b\u51fa\u9519\u8bef\u4fe1\u606f\uff0c\u7981\u6b62\u67e5\u8be2<\/li>\n
- \u5173\u95edQUERY_CHECK\u540e\uff0c\u5982\u679c\u9047\u5230Inception\u65e0\u6cd5\u89e3\u6790\u7684\u8bed\u53e5\uff0c\u7cfb\u7edf\u4e0d\u518d\u8fdb\u884c\u6570\u636e\u8131\u654f\uff0c\u4f1a\u6709\u6570\u636e\u6cc4\u9732\u7684\u98ce\u9669\uff0c\u8bf7\u8c28\u614e\u9009\u62e9<\/li>\n
- \u52a8\u6001\u8131\u654f\u4e0d\u652f\u6301\u7684\u8bed\u6cd5\uff1a\u5d4c\u5957\u5b50\u67e5\u8be2\u3001\u90e8\u5206\u975e\u5355\u5b57\u6bb5\u51fd\u6570\uff0c\u5982
concat(phone,',')\u3001max(id+num)<\/code><\/li>\n<\/ul>\nDATA_MASKING\u00b6<\/a><\/h5>\n\u662f\u5426\u5f00\u542f\u52a8\u6001\u8131\u654f\uff0c\u4f1a\u5229\u7528inception\u8bed\u6cd5\u6811\u6253\u5370\uff0c\u7ed3\u5408\u540e\u53f0\u8bbe\u7f6e\u7684\u8131\u654f\u5b57\u6bb5\u548c\u8131\u654f\u89c4\u5219\uff0c\u5bf9\u67e5\u8be2\u6570\u636e\u8fdb\u884c\u8131\u654f\u3002\u9047\u5230\u65e0\u6cd5\u89e3\u6790\u7684\u8bed\u53e5\u662f\u62a5\u9519\u8fd8\u662f\u8fd4\u56de\u672a\u8131\u654f\u7684\u6570\u636e\u540c\u6837\u7531QUERY_CHECK\u53c2\u6570\u63a7\u5236 \u6b63\u5e38\u8131\u654f\uff1a <\/em> \u5f00\u542fQUERY_CHECK\u540e\u6267\u884c\u4e0d\u652f\u6301\u8bed\u53e5 * \u5173\u95edQUERY_CHECK\u540e\u6267\u884c\u4e0d\u652f\u6301\u8bed\u53e5 <\/p>\nMAX_EXECUTION_TIME\u00b6<\/a><\/h5>\n\u5728\u7ebf\u67e5\u8be2\u8d85\u65f6\u65f6\u95f4\u9608\u503c\uff0c\u5355\u4f4d\u79d2\uff0c\u9ed8\u8ba460\uff0c\u8d85\u65f6\u7684\u8bed\u53e5\u4f1a\u88ab\u7ec8\u6b62\u5e76\u8fd4\u56de\u63d0\u793a\u4fe1\u606f\uff0c\u76ee\u524d\u4ec5\u652f\u6301MySQL<\/p>\n
ADMIN_QUERY_LIMIT\u00b6<\/a><\/h5>\n\u8d85\u7ea7\u7ba1\u7406\u5458\u7684\u67e5\u8be2\u9650\u5236\u884c\u6570\uff0c\u8d85\u7ea7\u7ba1\u7406\u5458\u67e5\u8be2\u6570\u636e\u65f6\u4e0d\u505a\u6743\u9650\u6821\u9a8c\uff0c\u4ec5\u7531\u8be5\u53c2\u6570\u8bbe\u7f6e\u6700\u5927\u884c\u6570<\/p>\n
SQL\u4f18\u5316\u00b6<\/a><\/h2>\nSQLADVISOR_PATH\u00b6<\/a><\/h5>\n<\/p>\n
SQLAdvisor\u7684\u53ef\u6267\u884c\u6587\u4ef6\u8def\u5f84\uff0c\u8def\u5f84\u9700\u8981\u5b8c\u6574\uff0cdocker\u955c\u50cf\u5185\u5df2\u7ecf\u96c6\u6210 1.4.0\u4ee5\u524d\u7684docker\u7248\u672c\u914d\u7f6e\u6210\/opt\/sqladvisor<\/code> <\/em> 1.4.0\u4ee5\u4ee5\u540e\u7684docker\u7248\u672c\u914d\u7f6e\u6210\/opt\/archery\/src\/plugins\/sqladvisor<\/code><\/p>\nSOAR_PATH\u00b6<\/a><\/h5>\nSOAR\u7684\u53ef\u6267\u884c\u6587\u4ef6\u8def\u5f84\uff0c\u8def\u5f84\u9700\u8981\u5b8c\u6574\uff0cdocker\u955c\u50cf\u5185\u5df2\u7ecf\u96c6\u6210\uff0cdocker\u955c\u50cf\u5185\u5df2\u7ecf\u96c6\u6210 1.4.0\u4ee5\u524d\u7684docker\u7248\u672c\u914d\u7f6e\u6210\/opt\/soar<\/code> <\/em> 1.4.0\u4ee5\u4ee5\u540e\u7684docker\u7248\u672c\u914d\u7f6e\u6210\/opt\/archery\/src\/plugins\/soar<\/code><\/p>\nSOAR_TEST_DSN\u00b6<\/a><\/h5>\n\u53c2\u8003SOAR\u6587\u6863\uff1a\u547d\u4ee4\u884c\u53c2\u6570\u914d\u7f6eDSN<\/a><\/p>\n\u901a\u77e5\u00b6<\/a><\/h2>\nARCHERY_BASE_URL\u00b6<\/a><\/h5>\n\u7cfb\u7edf\u9996\u9875\u5730\u5740, \u7528\u4e8e\u9489\u9489\u548c\u90ae\u4ef6\u53d1\u9001\u94fe\u63a5\u4f7f\u7528\uff0c\u5982https:\/\/archery.xx.com\/<\/p>\n
DDL_NOTIFY_AUTH_GROUP\u00b6<\/a><\/h5>\nDDL\u5de5\u5355\u901a\u77e5\u6743\u9650\u7ec4\u540d\uff0c\u5bf9\u5e94\u6743\u9650\u7ec4\u7ba1\u7406\u9875\u9762\u7684\u540d\u79f0\uff0c\u4e3a\u7a7a\u5219\u4e0d\u901a\u77e5\uff0c\u4ec5DDL\u5de5\u5355\u6267\u884c\u5b8c\u6bd5\u65f6\u4f1a\u8fdb\u884c\u901a\u77e5 <\/p>\n
MAIL\u00b6<\/a><\/h3>\n\u662f\u5426\u5f00\u542f\u90ae\u4ef6\u901a\u77e5<\/p>\n
MAIL_SSL\u00b6<\/a><\/h5>\n\u662f\u5426\u4f7f\u7528SSL\u8fde\u63a5<\/p>\n
MAIL_SMTP_SERVER\u00b6<\/a><\/h5>\n\u90ae\u4ef6SMTP\u670d\u52a1\u5730\u5740\uff0c\u53ef\u53c2\u8003\u5404\u90ae\u7bb1\u5bf9\u5e94\u7684\u8bbe\u7f6e\u5e2e\u52a9\uff0c\u4f8b\u5982QQ\u90ae\u7bb1\u7684\u5982\u4f55\u4f7f\u7528IMAP\u670d\u52a1\uff1f<\/a><\/p>\nMAIL_SMTP_PORT\u00b6<\/a><\/h5>\n\u90ae\u4ef6SMTP\u670d\u52a1\u7aef\u53e3<\/p>\n
MAIL_SMTP_USER\u00b6<\/a><\/h5>\n\u90ae\u4ef6\u7528\u6237\u540d<\/p>\n
MAIL_SMTP_PASSWORD\u00b6<\/a><\/h5>\n\u90ae\u4ef6\u5bc6\u7801\uff0c\u4e00\u822c\u4e3a\u751f\u6210\u7684\u6388\u6743\u7801<\/p>\n
DING\u00b6<\/a><\/h3>\n\u662f\u5426\u5f00\u542f\u9489\u9489\u901a\u77e5\uff0c\u5f00\u542f\u540e\u9700\u8981\u914d\u7f6e\u8d44\u6e90\u7ec4\u7684\u673a\u5668\u4ebawebhook\u8fde\u63a5\uff0c\u8d44\u6e90\u7ec4\u5185\u7684\u6240\u6709\u901a\u77e5\u90fd\u4f1a\u901a\u8fc7\u673a\u5668\u4eba\u63a8\u9001<\/p>\n
DING_TO_PERSON\u00b6<\/a><\/h5>\n\u662f\u5426\u5f00\u542f\u9489\u9489\u4e2a\u4eba\u901a\u77e5\uff0c\u4f7f\u7528\u5fae\u5e94\u7528\uff0b\u5de5\u4f5c\u901a\u77e5\u5b9e\u73b0<\/p>\n
\u4f01\u4e1a\u5fae\u4fe1\u00b6<\/a><\/h3>\n\u53c2\u8003\u4f01\u4e1a\u5fae\u4fe1\u63a5\u5165\u5f00\u53d1\u6587\u6863\uff0c\u914d\u7f6e\u6210\u529f\u540e\u6d88\u606f\u4f1a\u901a\u8fc7\u4f01\u4e1a\u5fae\u4fe1\u901a\u77e5<\/p>\n
\u5176\u4ed6\u914d\u7f6e\u00b6<\/a><\/h2>\n<\/p>\n
\u963f\u91cc\u4e91\u8ba4\u8bc1\u4fe1\u606f\u00b6<\/a><\/h3>\n\u5b9e\u4f8b\u5173\u8054RDS\u5b9e\u4f8bID\u540e\uff0c\u4f1a\u8c03\u7528RDS\u63a5\u53e3\u83b7\u53d6\u6162\u65e5\u5fd7\u3001\u8fdb\u7a0b\u3001\u8868\u7a7a\u95f4\uff0c\u5176\u4e2d\u8fdb\u7a0b\u548c\u8868\u7a7a\u95f4\u7684\u83b7\u53d6\u9700\u8981\u7ba1\u7406\u6743\u9650\u7684key<\/p>\n
INDEX_PATH_URL\u00b6<\/a><\/h5>\n\u7cfb\u7edf\u9996\u9875\u8def\u5f84\uff0c\u9ed8\u8ba4\u662fSQL\u5de5\u5355\u9875\u9762<\/p>\n
BINLOG2SQL\u00b6<\/a><\/h5>\nBINLOG2SQL\u8c03\u7528\u8def\u5f84\uff0c\u7528\u4e8e\u5b9e\u73b0binlog2sql\u89e3\u6790\u7684\u529f\u80fd\uff0cdocker\u955c\u50cf\u5185\u5df2\u7ecf\u96c6\u6210 * docker\u90e8\u7f72\u8bf7\u914d\u7f6e\u4e3a\/opt\/archery\/src\/plugins\/binlog2sql\/binlog2sql.py<\/code><\/p>\nDEFAULT_AUTH_GROUP\u00b6<\/a><\/h5>\n\u9ed8\u8ba4\u6743\u9650\u7ec4\u540d\uff0c\u65b0\u7528\u6237\u9996\u6b21\u767b\u5f55\u81ea\u52a8\u5173\u8054, \u8001\u7528\u6237\u8bf7\u624b\u52a8\u914d\u7f6e<\/p>\n
DEFAULT_RESOURCE_GROUP\u00b6<\/a><\/h5>\n\u9ed8\u8ba4\u8d44\u6e90\u7ec4\u540d\uff0c\u65b0\u7528\u6237\u9996\u6b21\u767b\u5f55\u81ea\u52a8\u5173\u8054, \u8001\u7528\u6237\u8bf7\u624b\u52a8\u914d\u7f6e<\/p>\n
LOCK_TIME_THRESHOLD\u00b6<\/a><\/h5>\n\u8d26\u6237\u767b\u5f55\u5931\u8d25\u9501\u5b9a\u65f6\u95f4(\u79d2)<\/p>\n
LOCK_CNT_THRESHOLD\u00b6<\/a><\/h5>\n\u8d26\u6237\u767b\u5f55\u5931\u8d25\u51e0\u6b21\u9501\u8d26\u6237<\/p>\n
SIGN_UP_ENABLED\u00b6<\/a><\/h5>\n\u662f\u5426\u5f00\u542f\u6ce8\u518c\u529f\u80fd\uff0c\u5173\u95ed\u540e\u5c06\u65e0\u6cd5\u81ea\u4e3b\u6ce8\u518c\u7528\u6237<\/p>\n
3. \u914d\u7f6e\u6743\u9650\u7ec4<\/h2>\n\narchery \u6743\u9650\u914d\u7f6e\u601d\u8def\u4e3a\uff0c\u6743\u9650\u7ec4\u9650\u5236\u7528\u6237\u63d0\u4ea4\uff0c\u67e5\u8be2\uff0c\u5ba1\u6279\u7b49\u6743\u9650\uff0c\u8d44\u6e90\u7ec4\u9650\u5236\u7528\u6237\u53ef\u4ee5\u64cd\u4f5c\u54ea\u4e9b\u6570\u636e\u5e93\u8d44\u6e90\u3002\u8fd9\u4e9b\u5728\u6dfb\u52a0\u7528\u6237\u7684\u65f6\u5019\u53ef\u4ee5\u9009\u62e9\u7528\u6237\u6dfb\u52a0\u54ea\u4e9b\u6743\u9650\uff0c\u6570\u636e\u5e93\u8d44\u6e90\u3002<\/p>\n<\/blockquote>\n
\n- \u914d\u7f6eDBA\u7ba1\u7406\u5ba1\u6838\u6743\u9650\u7ec4<\/li>\n<\/ul>\n
<\/p>\n
\n- \u914d\u7f6e\u666e\u901a\u7528\u6237\u7ec4\uff0c\u666e\u901a\u7528\u6237\u5177\u6709\u67e5\u8be2\uff0csql\u4e0a\u7ebf\u6743\u9650<\/li>\n<\/ul>\n
<\/p>\n
<\/p>\n
<\/p>\n
4.\u914d\u7f6e\u8d44\u6e90\u7ec4<\/h2>\n\n\u8fd9\u91cc\u6dfb\u52a0\u4e24\u4e2a\u8d44\u6e90\u7ec4\uff0c\u5bf9\u5e94\u751f\u4ea7\u73af\u5883\u548c\u6d4b\u8bd5\u73af\u5883\u6570\u636e\u5e93\u8d44\u6e90\u3002<\/p>\n<\/blockquote>\n
<\/p>\n
5.\u6dfb\u52a0\u6570\u636e\u5e93\u5b9e\u4f8b<\/h2>\n\n\u8d44\u6e90\u7ec4\uff1a\u6dfb\u52a0\u6570\u636e\u5e93\u5b9e\u4f8b\u65f6\u9700\u9009\u62e9\u8d44\u6e90\u7ec4<\/p>\n
\u5b9e\u4f8b\u6807\u7b7e\uff1a \u63a7\u5236\u6b64\u5b9e\u4f8b\u4e0a\u7ebf\uff0c\u67e5\u8be2\u6743\u9650\u3002<\/p>\n<\/blockquote>\n
<\/p>\n
<\/p>\n
6.\u6dfb\u52a0\u7528\u6237<\/h2>\n\n\u6743\u9650\u4fe1\u606f\uff1a\u6dfb\u52a0\u666e\u901a\u7528\u6237\u65f6\u52fe\u6743\u9650\u4fe1\u606f\u4e3a\u9009\u4eba\u5458\u72b6\u6001\uff0c\u5426\u5219\u7528\u6237\u767b\u5f55\u540e\u6ca1\u6709\u6743\u9650\u6253\u5f00\u540e\u53f0\u7ba1\u7406\u754c\u9762\u4fee\u4e2a\u4e2a\u4eba\u5bc6\u7801\u3002<\/p>\n
\u7ec4\uff1a \u5c06\u7528\u6237\u52a0\u5165\u6743\u9650\u7ec4\uff0c\u9644\u52a0\u7528\u6237\u6743\u9650\u3002<\/p>\n
\u7528\u6237\u6743\u9650\uff1a\u672c\u793a\u4f8b\u4e2d\u4f7f\u7528\u6743\u9650\u7ec4\u63a7\u5236\u7528\u6237\u6743\u9650\uff0c\u8fd9\u4e2a\u53ef\u4ee5\u4e0d\u9009\u62e9\u6743\u9650\uff0c\u5982\u679c\u60f3\u9644\u52a0\u67d0\u4e9b\u6743\u9650\u7ed9\u7279\u5b9a\u4eba\u7684\u8bdd\u53ef\u4ee5\u5728\u8fd9\u9009\u62e9\u3002<\/p>\n
\u8d44\u6e90\u7ec4\uff1a \u5c06\u7528\u6237\u52a0\u5165\u8d44\u6e90\u7ec4\uff0c\u63a7\u5236\u7528\u6237\u53ef\u4ee5\u64cd\u4f5c\u54ea\u4e9b\u6570\u636e\u5e93\u8d44\u6e90\u3002<\/p>\n<\/blockquote>\n
<\/p>\n
<\/p>\n
7.\u914d\u7f6e\u5de5\u5355\u5ba1\u6279\u6d41\u7a0b<\/h2>\n\n\u89c4\u5219\uff1a\u9009\u62e9\u591a\u4e2a\u6743\u9650\u7ec4\u5373\u5ba1\u6279\u6d41\u7a0b\u4e3a\u591a\u7ea7\u5ba1\u6838\uff0c\u6309\u7167\u9009\u62e9\u987a\u5e8f\u8fdb\u884c\u6d41\u8f6c\uff0c\u6743\u9650\u7ec4\u5185\u7528\u6237\u90fd\u53ef\u5ba1\u6838<\/strong><\/p>\n<\/blockquote>\n<\/p>\n
8.\u4f18\u5316\u914d\u7f6e<\/h2>\n\n- \u914d\u7f6eSQL\u4e0a\u7ebf\u65f6\u663e\u793a\u771f\u5b9e\u5f71\u54cd\u884c\u6570<\/li>\n<\/ul>\n
\nInception\u548cgoInception\u5ba1\u6838\u8fd4\u56de\u7684\u5f71\u54cd\u884c\u6570\u9ed8\u8ba4\u90fd\u662fexplain\u7684\u7ed3\u679c\uff0c
\n\u548cinnodb\u7edf\u8ba1\u6570\u636e\u3001\u8bed\u53e5\u662f\u5426\u547d\u4e2d\u7d22\u5f15\u7b49\u90fd\u6709\u6bd4\u8f83\u5927\u7684\u5173\u7cfb\uff0c
\ngoInception\u6709\u63d0\u4f9b\u83b7\u53d6\u771f\u5b9e\u884c\u6570\u7684\u9009\u9879\uff0c\u8003\u8651\u5230count\u7684\u6548\u7387\u95ee\u9898\uff0c\u9ed8\u8ba4\u672a\u5f15\u7528\u6b64\u9009\u9879\uff0c<\/p>\n<\/blockquote>\n
`archery \u4fee\u6539\u771f\u5b9e\u5f71\u54cd\u884c\u6570 --real_row_count = "true"`\n vim \/opt\/archery\/sql\/engines\/goinception.py\n inception_sql = f"""\/*--user='{instance.user}';--password='{instance.password}';--host='{instance.host}';--port={instance.port};--check=1;--real_row_count = "true"*\/ <\/code><\/pre>\n\n- Redis \u6267\u884c\u547d\u4ee4\u914d\u7f6e\n
#\u6587\u4ef6sql\/engines\/redis.py \u4fee\u6539safe_cmd \u5217\u8868\uff0c\u6dfb\u52a0\u53ef\u6267\u884c\u547d\u4ee4\u3002<\/code><\/pre>\n<\/p>\n<\/li>\n<\/ul>\n
\u914d\u7f6eSSH\u96a7\u9053\u540e\u65e0\u6cd5\u8fde\u63a5github issues<\/a><\/h2>\n\u9700\u8981\u5728Archery\/src\/docker\/startup.sh \u6587\u4ef6\u4e2d \uff0c\u4fee\u6539\u5e76\u53d1\u65b9\u5f0f\u4e3async\u6a21\u5f0f\uff0c\u5982\u4e0b\u6240\u793a\uff1a<\/p>\n
echo \u542f\u52a8\u670d\u52a1\n#gunicorn -w 4 -k gevent -b 127.0.0.1:8888 --timeout 600 archery.wsgi:application\ngunicorn -w 4 -k sync-b 127.0.0.1:8000 --timeout 600 archery.wsgi:application\n<\/code><\/pre>\ndocker-compose \u670d\u52a1\u8fd0\u884c\u6a21\u5f0f\u6539\u4e3a\u4e3b\u673a\u7f51\u7edc\u6a21\u5f0f\uff0c\u52a0\u4e24\u4e2a\u57df\u540d\u89e3\u6790\u3002<\/p>\n
version: '3'\n\nservices:\n redis:\n image: redis:5\n container_name: redis\n restart: always\n network_mode: "host"\n command: redis-server --requirepass 123456\n expose:\n - "6379"\n\n mysql:\n image: mysql:5.7\n container_name: mysql\n restart: always\n network_mode: "host"\n ports:\n - "3306:3306"\n volumes:\n - ".\/mysql\/my.cnf:\/etc\/mysql\/my.cnf"\n - ".\/mysql\/datadir:\/var\/lib\/mysql"\n environment:\n MYSQL_DATABASE: archery\n MYSQL_ROOT_PASSWORD: 123456\n\n inception:\n image: hhyo\/inception\n container_name: inception\n restart: always\n network_mode: "host"\n expose:\n - "6669"\n volumes:\n - ".\/inception\/inc.cnf:\/etc\/inc.cnf"\n\n goinception:\n image: hanchuanchuan\/goinception\n container_name: goinception\n restart: always\n network_mode: "host"\n expose:\n - "4000"\n volumes:\n - ".\/inception\/config.toml:\/etc\/config.toml"\n archery:\n image: hhyo\/archery:1.8.0\n container_name: archery\n restart: always\n network_mode: "host"\n ports:\n - "9123:9123"\n volumes:\n - ".\/archery\/settings.py:\/opt\/archery\/archery\/settings.py"\n - ".\/archery\/soar.yaml:\/etc\/soar.yaml"\n - ".\/archery\/docs.md:\/opt\/archery\/docs\/docs.md"\n - ".\/archery\/downloads:\/opt\/archery\/downloads"\n - ".\/archery\/sql\/migrations:\/opt\/archery\/sql\/migrations"\n - ".\/archery\/logs:\/opt\/archery\/logs"\n entrypoint: "dockerize -wait tcp:\/\/mysql:3306 -wait tcp:\/\/mysql:6379 -timeout 60s \/opt\/archery\/src\/docker\/startup.sh"\n environment:\n NGINX_PORT: 9123\n<\/code><\/pre>\n\u589e\u52a0\u57df\u540d\u89e3\u6790\u7528\u4e8e\u8fde\u63a5\u6570\u636e\u5e93redis (\u6bd4\u6539\u914d\u7f6e\u6587\u4ef6\u7b80\u5355\u3002\u3002\u3002\u3002)<\/p>\n
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4\n::1 localhost localhost.localdomain localhost6 localhost6.localdomain6\n127.0.0.1 redis\n127.0.0.1 mysql\n127.0.0.1 goinception\n127.0.0.1 inception\n<\/code><\/pre>\n\n- SQL \u4e0a\u7ebf\u5ba1\u6838\u9009\u9879\u4f18\u5316\u914d\u7f6e: https:\/\/hanchuanchuan.github.io\/goInception\/options.html<\/a><\/li>\n<\/ul>\n
\u5b98\u65b9\u6587\u6863<\/a><\/h2>\n","protected":false},"excerpt":{"rendered":"1. docker\u90e8\u7f72\u00b6 \u5b89\u88c5docker\u00b6 \u5b89\u88c5 Docker curl -fsSL https:\/\/get<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[17,18],"tags":[],"yoast_head":"\n
Archery SQL\u5ba1\u8ba1\u7cfb\u7edf\u642d\u5efa\u914d\u7f6e - Linux\u81ea\u52a8\u5316\u8fd0\u7ef4<\/title>\n\n\n\n\n\n\n\n\n\n\n\n\n\n