1. 程式人生 > >遠端連線 騰訊雲 redis 伺服器

遠端連線 騰訊雲 redis 伺服器

今天有需求,本地遠端連線 騰訊雲redis 伺服器,伺服器運維知識有限,搜尋了不少文章,總算嘗試出來了,記錄下。(模模糊糊記得之前好像操作 aliyun 就做過類似這種的)

	參考文章:
		https://cloud.tencent.com/developer/ask/120909
	
	1.騰訊雲伺服器,配置安全策略(預設好像就是開放所有埠)
		https://cloud.tencent.com/document/product/213/18197#typical


	2.伺服器 iptables 配置,需要開放 6379 埠(這一步,可能有些系統不需要,我的需要)
		iptables -I INPUT -p tcp --dport 6379 -j ACCEPT
		service iptables save

		https://blog.csdn.net/qq_27631797/article/details/79062574


	3.redis 配置
		# bind 127.0.0.1		// redis 預設只允許本機訪問,註釋

		protected-mode no 		// 將保護模式關閉

		requirepass dongxuemin	// 為了安全,可開啟密碼驗證

		service redis-server restart 	// 重啟 redis

redis 檢視已載入的配置:
	redis-cli -h 127.0.0.1 -p 6379 -a dongxuemin

	config get * 		// 檢視所有記錄
	config get dir 		// 檢視 redis 資料庫儲存目錄

ping - 用來測試指定伺服器的 80 埠,是否開放
	ping xxx

tcping - 測試伺服器指定埠是否開放
	tcping xxx 6379 - 測試 6379 埠是否開放