我是谷歌云的新手,我最近在谷歌云实例上安装了一个mongodb群集。但是我无法从我的应用程序或Robomongo连接它。在我的spring mvc中以下面的方式设置其配置,我使用外部ip作为主机:
<bean id="mongoTemplate" class="org.springframework.data.mongodb.core.MongoTemplate">
<constructor-arg name="mongoDbFactory" ref="mongoDbFactory" />
</bean>
它给出了以下例外:
org.springframework.dao.DataAccessResourceFailureException: Timed out after 10000 ms while waiting for a server that matches AnyServerSelector{}.
Client view of cluster state is {type=Unknown, servers=[{address=104.196.32.97:27017, type=Unknown, state=Connecting}]; nested exception is com.mongodb.MongoTimeoutException: Timed out after 10000 ms while waiting for a server that matches AnyServerSelector{}. Client view of cluster state is {type=Unknown, servers=[{address=104.196.32.97:27017, type=Unknown, state=Connecting}]
at org.springframework.data.mongodb.core.MongoExceptionTranslator.translateExceptionIfPossible(MongoExceptionTranslator.java:73)
at org.springframework.data.mongodb.core.MongoTemplate.potentiallyConvertRuntimeException(MongoTemplate.java:2011)
没有关于将gcloud的mongodb与spring应用程序集成的教程。