Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

supervisorctl配置 mongo aws apigateway #12

Open
maiff opened this issue Jun 26, 2018 · 0 comments
Open

supervisorctl配置 mongo aws apigateway #12

maiff opened this issue Jun 26, 2018 · 0 comments
Labels

Comments

@maiff
Copy link
Owner

maiff commented Jun 26, 2018

supervisorctl配置 mongo

supervisorctl出现 unix:///var/run/supervisor.sock refuseing error

把这个文件删掉 ,然后重新运行

supervisord -c /etc/supervisord.conf

[program:song] ;
;directory = /home/ubuntu/songSpider;
command = python3 /home/ubuntu/songSpider/getPlayList.py ;
startsecs = 10        ;
redirect_stderr = true  ;
autorestart = true   ;
stdout_logfile_maxbytes = 50MB  ;
stdout_logfile = /home/ubuntu/super_song.log
[supervisorctl]
serverurl=unix:///tmp/supervisor.sock ; use a unix:// URL  for a unix socket

mongo第一次运行的时候可能没有/data/db文件,然后添加登录验证

db.createUser({user: "simpleUser",pwd: "simplePass",roles: ["root" ]})
mongo --port 27017 -u "adminUser" -p "adminPass" --authenticationDatabase "admin"
mongod --auth --port 27017 --dbpath /data/db1

关闭mongo

pkill mongod

python连接

import pymongo
connection = pymongo.MongoClient('mongodb://xxx:pwd@localhost:27017/')
print('连接成功')
# user_info_db = connection.user_info
db = connection.song
user_info_coll = db.user_info
songs_coll = db['songlist' + songlistID]

注意 mongo的概念先db 在collection 再document

Body Mapping Templates

{
    "address": "$input.params('address')",
    "content": "$input.params('content')",
    "title": "$input.params('title')"
}

注意双引号!

@maiff maiff added the blog label Jun 26, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant