原创 怎麼使用 javascript 循環在 mongodb 中查入數據

插入數據的方式 mongo <myip>:27017 < db_parse.js cat db_parse.js use <db_name> var collection = db.DATA.find(); while(coll

原创 Cannot open output file: Permission denied 的處理方式

1、文件本身所屬用戶和所屬組不合適 2、文件本身的權限不合適 3、如果滿足上述還是報該錯,則檢查其父目錄的所屬用戶所屬組和權限,還報錯就再往上 4、配置文件需要有可執行權限才能使用,比如 etcd 的配置文件  

原创 ansible 怎麼檢查文件是否存在

詳細的具體方案見  https://stackoverflow.com/questions/35654286/how-to-check-if-a-file-exists-in-ansible 這裏舉出其中最具代表性的例子 - name:

原创 ansible 如何將 list 中的元素連接起來

見 https://stackoverflow.com/questions/47244834/how-to-join-a-list-of-strings-in-ansible 使用函數 # 使用 '\n' 將 my_list 中的元素連

原创 ansible 中如何通過用戶名和密碼登錄到主機

可以通過在配置文件中指定 # 這裏以 ubuntu 用戶名、Password 密碼來登錄ip 爲 192.168.0.3 的主機 [all] ansible_host=192.168.0.3 ip=192.168.0.3 ansible

原创 配置 rsyslog,使得可以通過 rsyslog 服務來在遠程主機間傳輸日誌

見 https://www.thegeekdiary.com/configuring-remote-logging-using-rsyslog-in-centos-rhel/ Once the central log host is co

原创 nginx + gunicorn + supervisor 部署django 項目

https://www.zmrenwu.com/courses/hellodjango-blog-tutorial/materials/74/

原创 獲取當前頁面的所有鏈接的四種方法對比(python 爬蟲,包含 selenium 獲取的方式)

''' 得到當前頁面所有連接 ''' import requests import re from bs4 import BeautifulSoup from lxml import etree from selenium impo

原创 django 2.0 中各表 on_delete 的意義

見 https://blog.csdn.net/buxianghejiu/article/details/79086011

原创 Best way to update Ansible on Ubuntu

詳情見 https://www.reddit.com/r/ansible/comments/9gnnli/best_way_to_update_ansible_on_ubuntu/ Hi all I'm looking for instr

原创 mongo replSet 怎麼修改 replSet 的名稱

親測有效的見 https://stackoverflow.com/questions/11265997/can-i-change-the-name-of-my-replica-set-while-mongod-processes-are-

原创 mongo 創建 root 用戶

http://www.fwebcn.com/?p=87

原创 python 環境安裝 hashlib 包

wget https://files.pythonhosted.org/packages/74/bb/9003d081345e9f0451884146e9ea2cff6e4cc4deac9ffd4a9ee98b318a49/hashli

原创 docker registry 的搭建和使用

docker registry 的搭建見 https://docs.docker.com/registry/deploying/   cat /etc/docker/daemon.json { "registry-mirrors"

原创 mongo repliset 的用戶名和配置是存儲在哪個數據庫的集合中的

用戶信息:admin 數據庫中的集合 system.users  配置信息:  local 數據庫中的 system.replset,其中的_id 需要跟 replSet 的名稱一致