spring boot,gradle,redis

來源:互聯網
上載者:User

標籤:spring boot   redis   gradle   

今天做spring boot/gradle/redis相關的項目,遇到若干問題,記錄如下:

  1. spring boot  org.springframework.session.data.redis.RedisFlushMode

    這個報錯是與redis伺服器串連的問題,查看一下在application.properties裡寫的redis伺服器IP是不是錯了,改正即可;或者redis伺服器啟用了protected-mode,運行Redis時使用命令: 

    nohup redis-server --protected-mode no & 在啟動redis時關掉protected-mode;

    也有可能用的包不對,仔細在官網上看一下各個包對應的redis伺服器版本,這裡使用的redis伺服器為3.2.6,對應的jar包使用

  2. compile ‘org.springframework.boot:spring-boot-starter-redis‘//compile ‘org.springframework.session:spring-session:1.0.1.RELEASE‘compile group: ‘org.springframework.session‘, name: ‘spring-session‘, version: ‘1.3.0.RELEASE‘
  3. 如何在gradle中設定jvm參數,方法是建立檔案gradle.properties,在該檔案內設定jvm參數

    org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8

    這裡只設定了一個參數:org.gradle.jvmargs=-Dspring.profiles.active=redis

  4. 在伺服器上啟動時遇到了錯gradle test executor 1‘ finished with non-zero exit value 137

    一般在伺服器上遇到的異常最後都會歸結到這個資訊上,但是如果只報了這一個異常的話,可能是因為伺服器記憶體不足,導致啟動失敗.

  5. redis的安裝

    git clone -b 3.2  https://github.com/antirez/redis.git;這個命令會下載3.2版本的最新源碼到本地redis檔案夾內

    cd redis

    make;make install; 官方建議先執行make test,make test時報了2個錯,查了一下不會導致安裝失敗,就強行安裝了.

    nohup redis-server --protected-mode no &; 

    redis-cli shutdown

    預設安裝的目錄位於:/usr/local/bin/

    如果要使用設定檔的話,

    redis-server /path/to/redis.conf 一般的安裝是在/etc/redis/檔案夾內放置redis的設定檔.

  6. 不要用windows版本的redis,redis的windows版本與linux的相比,版本號碼滯後很嚴重.

    這個提示可能就是因為版本號碼太低:ERR Unsupported CONFIG parameter: notify-keyspace-events,導致spring的一些標籤不能被識別.

本文出自 “夢裡不知身是客” 部落格,轉載請與作者聯絡!

spring boot,gradle,redis

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.