亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

創建區域并將區域保留到磁盤時出現問題 Geode Gemfire Spring Boot

創建區域并將區域保留到磁盤時出現問題 Geode Gemfire Spring Boot

陪伴而非守候 2024-01-05 09:57:22
我觀看了 Springone Platform 和 John Blum 作為演講者的視頻,并有興趣嘗試一下 Geode/Gemfire 設置,但設置如Spring Data for Apache Geode 參考指南中所述所以我使用 Eclipse 制作 spring boot geode 客戶端、定位器和緩存服務器,并且在以下情況下遇到問題:啟動 spring locator,啟動緩存服務器,并使用 Restcontroller 啟動客戶端,以便我可以發布我的 POJO TitleContent 并獲取 TitleContent 列表??蛻艚o我異常原因:org.springframework.web.client.ResourceAccessException: I/O error on POST request for "https://localhost:7070/gemfire/v1/regions": Connection refused (Connection refused); nested exception is java.net.ConnectException: Connection refused (Connection refused)我注釋@EnableClusterConfiguration(useHttp=true)并再次啟動客戶端,現在可以運行了?,F在我嘗試將 POJO 發布到我的 Restcontroller 并得到此異常:2019-10-29 09:43:08.193 ERROR 57276 --- [io-15050-exec-1] oaccC[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] 在上下文中path[]拋出異常[請求處理失??;嵌套異常是 org.springframework.dao.DataAccessResourceFailureException: Remote server on 192.168.100.8(SpringBasedCacheClientApplication:57276:loner):64494:51246215:SpringBasedCacheClientApplication: : 執行遠程放置時;嵌套異常是 org.apache.geode.cache.client.ServerOperationException: 192.168.100.8(SpringBasedCacheClientApplication:57276:loner):64494:51246215:SpringBasedCacheClientApplication: 上的遠程服務器::執行遠程放置時],其根本原因org.apache.geode.cache.RegionDestroyedException:來自 [identity(192.168.100.8(SpringBasedCacheClientApplication:57276:loner):64494:51246215:SpringBasedCacheClientApplication,connection=1; port=64498] 的服務器連接:期間未找到名為 /TitleContent 的區域將請求放在 org.apache.geode.internal.cache.tier.sockets.BaseCommand.writeRegionDestroyedEx(BaseCommand.java:624) ~[geode-core-1.9.1.jar:na] 處?這次我取消了 //@EnableClusterConfiguration(useHttp=true) 的注釋,但我刪除了 useHttp 并僅使用 @EnableClusterConfiguration,(因此我懷疑錯誤)。我停止 Spring Client 并再次啟動它?,F在它失敗了,并顯示:org.apache.geode.cache.RegionExistsException:/TitleContent。
查看完整描述

1 回答

?
慕森卡

TA貢獻1806條經驗 獲得超8個贊

在我的例子中,我絕對不能使用@EnableClusterConfiguration(仍然想知道為什么)。根據 John 的說法,我們可以使用 gfsh 創建區域。由此我想到在 Spring Boot CacheServer 上做同樣的事情。那么,如果我在 CacheServer 定義 POJO 并讓注釋 @EnableEntityDefinedRegions 完成在 CacheServer 端創建區域的工作,該怎么辦?我又借了

serverRegionShortcut = RegionShortcut.PARTITION_PERSISTENT

來自約翰,但我把它放在

@EnableEntityDefinedRegions

除此之外,我還需要保留我的 PDX 類型(如果我不在 CacheServer 端保留 Pdx 類型,Spring 和/或 Geode Gemfire 不喜歡我)。因此,我使用相同的方法從SpringData Gemfire DiskStore進行持久化,但我在 CacheServer 端實現它,并在 application.properties 中添加一些附加條目來告訴 spring 也持久化 Pdx 類型。

這樣,我就能夠在 CacheServer 端成功創建和持久化 Region,并且還能夠持久化 Pdx。

這是我借用SpringData Gemfire DiskStore的想法制作的完整代碼和 application.properties 。

如果有人能夠告訴我這個解決方法是否是一個好方法,或者是否有其他方法或更好的想法(仍然想知道為什么 @EnableClusterConfiguration 不喜歡我,而其他人對此沒有問題:= (所以,如果有人能夠告訴我我的錯誤在哪里,我真的很感激)。

客戶 :

@SpringBootApplication

@ClientCacheApplication(logLevel = "debug", locators = {@Locator(host = "localhost", port = 10334)})

@EnablePool(name="neptunusPool", servers=@Server(host="localhost", port=41414))

@EnableGemfireRepositories(basePackageClasses= {TitleContentRepository.class})

@EnableEntityDefinedRegions(basePackageClasses= {TitleContent.class

})

//@ReplicateRegion

//@EnableClusterDefinedRegions

//@EnableCachingDefinedRegions

//@EnableGemfireCaching

@EnableIndexing

//@EnableClusterConfiguration

@EnablePdx


public class CommerceHostGeodeApplication {


? ? public static void main(String[] args) {


? ? ? ? SpringApplication.run(CommerceHostGeodeApplication.class, args);


? ? }


}

在客戶端,相同的 POJO、Repository 和 RestController,除了 server.port 定義之外,application.properties 中沒有任何內容。


緩存服務器:


@SpringBootApplication

@CacheServerApplication(locators="localhost[10334]", name="GeodeServerApplication" )

@EnableCacheServer(name="neptunus", autoStartup=true, hostnameForClients = "localhost", port = 41414)

@EnableCachingDefinedRegions

@EnableGemfireCaching

@EnablePdx

@EnableManager

@EnableHttpService

@EnableDiskStore(name = "disk_store")

@EnableEntityDefinedRegions(basePackageClasses= {TitleContent.class

}, serverRegionShortcut = RegionShortcut.PARTITION_PERSISTENT)

public class GeodeServerApplication {


? ? public static void main(String[] args) {

? ? ? ? SpringApplication.run(GeodeServerApplication.class, args);

? ? }


}

CACHESERVER application.properties :


server.port=15010

spring.data.gemfire.disk.store.name=disk_store

spring.data.gemfire.disk.store.directory.location=/Users/ars/geode/data

spring.data.gemfire.pdx.disk-store-name=disk_store

spring.data.gemfire.pdx.persistent=true

spring.data.gemfire.management.use-http=true

CacheServer 啟動后,區域將被創建并能夠持久/保存到磁盤。


查看完整回答
反對 回復 2024-01-05
  • 1 回答
  • 0 關注
  • 168 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號