mongo增加密码
This commit is contained in:
@@ -5,13 +5,16 @@ package com.fangjia.job.fsh;
|
||||
* @author yinjihuan
|
||||
*/
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.autoconfigure.data.mongo.MongoDataAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.mongo.MongoAutoConfiguration;
|
||||
import org.springframework.boot.builder.SpringApplicationBuilder;
|
||||
import org.springframework.context.annotation.ImportResource;
|
||||
|
||||
import com.fangjia.job.fsh.config.InitBeanConfig;
|
||||
|
||||
@SpringBootApplication
|
||||
@SpringBootApplication(exclude = {MongoAutoConfiguration.class,MongoDataAutoConfiguration.class})
|
||||
@ImportResource(locations = { "classpath:applicationContext*.xml" })
|
||||
public class FshJobApp {
|
||||
|
||||
|
||||
+10
-2
@@ -1,7 +1,9 @@
|
||||
package com.fangjia.job.fsh.config;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.data.mongodb.MongoDbFactory;
|
||||
@@ -10,15 +12,19 @@ import org.springframework.data.mongodb.core.SimpleMongoDbFactory;
|
||||
import org.springframework.data.mongodb.core.convert.DefaultMongoTypeMapper;
|
||||
import org.springframework.data.mongodb.core.convert.MappingMongoConverter;
|
||||
import org.springframework.data.mongodb.core.mapping.MongoMappingContext;
|
||||
|
||||
import com.mongodb.MongoClient;
|
||||
import com.mongodb.MongoClientOptions;
|
||||
import com.mongodb.MongoCredential;
|
||||
import com.mongodb.ServerAddress;
|
||||
|
||||
@Configuration
|
||||
public class SpringMongoConfig {
|
||||
|
||||
public @Bean MongoDbFactory mongoDbFactory() throws Exception {
|
||||
List<ServerAddress> seeds = Arrays.asList(new ServerAddress("mongo.db.fangjia.com", 27017));
|
||||
List<ServerAddress> seeds = Arrays.asList(
|
||||
new ServerAddress("mongo.db.fangjia.com", 28017),
|
||||
new ServerAddress("secondary.mongo.db.fangjia.com", 28017));
|
||||
MongoClientOptions.Builder builder = new MongoClientOptions.Builder();
|
||||
int connPerHost = 10;
|
||||
builder.connectionsPerHost(connPerHost);
|
||||
@@ -29,7 +35,9 @@ public class SpringMongoConfig {
|
||||
int timeOut = 60000;
|
||||
builder.connectTimeout(timeOut);
|
||||
MongoClientOptions options = builder.build();
|
||||
MongoClient mongoClient = new MongoClient(seeds, options);
|
||||
List<MongoCredential> cres = new ArrayList<>();
|
||||
cres.add(MongoCredential.createCredential("developer", "admin", "G00IDCDEV12385".toCharArray()));
|
||||
MongoClient mongoClient = new MongoClient(seeds, cres, options);
|
||||
return new SimpleMongoDbFactory(mongoClient, "fangjia_fsh");
|
||||
}
|
||||
|
||||
|
||||
@@ -1,19 +1,13 @@
|
||||
spring.data.mongodb.uri=mongodb://mongo.db.fangjia.com/fangjia_fsh
|
||||
|
||||
spring.datasource.url=jdbc:mysql://mysql.db.fangjia.com:4306/fangjia_fsh
|
||||
spring.datasource.username=sa
|
||||
spring.datasource.password=G00jia
|
||||
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
|
||||
|
||||
#spring.datasource.log.url=jdbc:mysql://192.168.0.41:4306/batch_log
|
||||
#spring.datasource.log.username=root
|
||||
#spring.datasource.log.password=Ga041243
|
||||
#spring.datasource.log.driver-class-name=com.mysql.jdbc.Driver
|
||||
spring.datasource.log.url=jdbc:mysql://192.168.0.132:4306/batch_log
|
||||
spring.datasource.log.url=jdbc:mysql://mysql.db.fangjia.com:4306/batch_log
|
||||
spring.datasource.log.username=sa
|
||||
spring.datasource.log.password=G00jia
|
||||
spring.datasource.log.driver-class-name=com.mysql.jdbc.Driver
|
||||
fsh.url=http://fsh.fangjia.com
|
||||
|
||||
zk.server-lists=192.168.0.45:2181,192.168.0.46:2181,192.168.0.109:2181
|
||||
zk.server-lists=192.168.0.207:2181,192.168.0.24:2181,192.168.0.25:2181
|
||||
zk.namespace=fangjia-job-fsh
|
||||
Reference in New Issue
Block a user