原创 Redis使用問題記錄
1.TTL方法 對應redisTemplate.getExpire() 返回值: 當 key 不存在時,返回 -2 。 當 key 存在但沒有設置剩餘生存時間時,返回 -1 。 否則,以秒爲單位,返回 key 的剩餘生存時間。 在
原创 nginx記錄
1.目錄結構|-- conf| |-- es_pass| |-- fastcgi.conf| |-- fastcgi.conf.default| |-- fastcgi_params| |-- fastcgi_para
原创 mvc:resource靜態資源攔截處理
1. xml配置<mvc:resources location="/WEB-INF/excel/" mapping="/download/excel/**" />不贅述2.資源攔截處理package com.xxx.calculator.
原创 elasticsearch使用root用戶啓動
只支持2.x版本 ./elasticsearch -Des.insecure.allow.root=true -d 參考: https://stackoverflow.com/questions/34920801/how-to-run
原创 urlrewrite -- url重寫
urlrewrite:地址重寫,將請求url進行處理 1.pom.xml添加依賴 <!-- URL Rewrite --> <dependency> <groupId>org.tuck
原创 各種全局主鍵生成策略對比
1.數據庫自增主鍵 優點:簡單;唯一;遞增;增幅固定 缺點:寫性能決定每秒生成數量上限,擴展差;分佈式數據庫,主節點掛掉,備節點上時可能有問題(主節點寫入成功,日誌未同步到備節點,導致id重複) 備註:可有一個寫庫變成多個庫同時寫,如1、
原创 Twitter的分佈式自增ID算法snowflake
結構 snowflake的結構如下(每部分用-分開): 0 - 0000000000 0000000000 0000000000 0000000000 0 - 00000 - 00000 - 000000000000 第一位爲未使
原创 spring、junit測試用例配置與寫法
1.spring配置文件test-spring-service.xml <?xml version="1.0" encoding="utf-8"?> <beans xmlns="http://www.springframework.o
原创 ohmyzsh自動登錄ssh服務器腳本實現
介紹:使用命令執行腳本,免鍵入密碼直接ssh連接服務器 環境:MacOS 軟件:expect(brew安裝sshpass提示有安全問題,所以不使用sshpass) 1.安裝expect brew install expect2.建立.s
原创 ZK生成全局id
優點:可靠,不會重複,無單點問題 缺點:只能分配32位序列號;效率不高 依賴: <dependency> <groupId>com.github.adyliu</groupId> <artifa
原创 MacOS brew安裝mysql
1.安裝msyql brew install mysql 2.啓動mysql brew services start mysql 3.登錄mysql 默認root密碼爲空。新版mysql數據庫user表沒有password字段,
原创 spring mvc not returning json content - error 406
完整異常: "The resource identified by this request is only capable of generating responses with characteristics not accepta
原创 MacOS安裝Python環境
1.mac自帶Python2.7 2.安裝pip easy_install pip 3.安裝MySQLdb sudo pip install MySQL-python (MySql重新安裝後,import MySQLdb 可能報錯"