Spring Data MongoDB副本集UserCredentials配置?

时间:2015-03-12 02:11:01

标签: mongodb spring-data-mongodb spring-mongo

如果我设置应用程序可以从MongoDB副本集的辅助成员读取,并且设置的ecah成员需要auth访问,我该如何设置Replicat成员的每个UserCredentials? 我的MongoDB配置Spring Data MongoDB如下:

<mongo:mongo id="replicaSetMongo"
    replica-set="10.10.10.139:27017,10.10.10.139:27018,10.10.10.139:27019">
    <mongo:options connections-per-host="8"
        threads-allowed-to-block-for-connection-multiplier="4"
        connect-timeout="100000" max-wait-time="150000" auto-connect-retry="true"
        socket-keep-alive="true" socket-timeout="150000" slave-ok="false"
        write-number="1" write-timeout="0" write-fsync="true" />
</mongo:mongo>

<mongo:db-factory id="mongoDBFactory" dbname="${mongo.db}"
    mongo-ref="replicaSetMongo" />

<mongo:template db-factory-ref="mongoDBFactory"
    write-concern="NORMAL" />


<mongo:mapping-converter db-factory-ref="mongoDBFactory"
    id="mongoDBConverter" />

<mongo:gridFsTemplate db-factory-ref="mongoDBFactory"
    converter-ref="mongoDBConverter" />

用Google搜索文章:https://scottizu.wordpress.com/2013/10/03/getting-started-with-spring-and-mongo-db/

但是所有集合成员的凭证必须相同?

0 个答案:

没有答案