javashop-web工程配置


redis配置说明

配置文件位置

javashop-web/src/main/webapp/config/redis.properties

核心配置

配置项 说明 示例
redis.type redis类型
可选值: cluster,sentinel,standalone
standalone
redis.config.type redis配置类型
可选值:manual(手动),rest(rest api配置)
manual

cache cloud 的rest api方式配置

如果采用sohu tv的cache cloud 来管理redis,核心配置 :

#type请相应的修改
redis.type=standalone
#config.type指定为rest
redis.config.type=rest

然后,其它配置为:

配置项 说明 示例
redis.config.restUrl rest配置API的url http://xxx.com:8585
redis.config.restAppid cache cloud rest api中的appid 10000
redis.config.restClientVersion cache cloud rest api中的version参数 1.0-SNAPSHOT

standalone式手工配置

如果采用手动配置标准式redis,则核心配置为:

redis.type=standalone
redis.config.type=manual

然后其其它配置为:

配置项 说明 示例
redis.host redis的host 127.0.0.1
redis.port redis的端口 6379
redis.password redis的密码

集群手工配置

如果采用手动配置集群式redis,则核心配置为:

redis.type=cluster
redis.config.type=manual

然后,其它配置项为:

配置项 说明 示例
redis.cluster.nodes redis集群节点,英文逗号隔开 192.168.1.32:6379,192.168.1.32:6381...

哨兵手工配置

如果采用手动配置哨兵式redis,则核心配置为:

redis.type=sentinel
redis.config.type=manual

然后,其它配置项为:

配置项 说明 示例
redis.sentinel.master redis哨兵master名称 mymaster
redis.sentinel.nodes redis哨兵节点,英文逗号隔开 192.168.1.32:6379,192.168.1.32:6381...

连接池配置

配置项 说明 示例
redis.maxIdle 最大空闲数 100
redis.maxTotal 最大连接数 100
redis.maxWaitMillis 获取连接时的最大等待毫秒数,-1为不超时 1000

amqp配置说明

配置文件位置

javashop-web/src/main/webapp/config/amqp.properties

配置内容
amqp.host=localhost#【连接本地搭建的amqp,请填写localhost或127.0.0.1】【连接线上搭建的amqp,请填写线上服务器IP】
amqp.port=5672#amqp端口号
amqp.username=kingapex#用户名
amqp.password=wangfeng#密码

javashop-consumer工程配置


配置文件位置

/javashop-consumer/src/main/resources/application.properties

redis配置说明

同javashop-web工程配置

amqp配置说明

配置内容
#此配置,必须与上述redis配置文件中的配置相同
spring.rabbitmq.host=localhost#【连接本地搭建的amqp,请填写localhost或127.0.0.1】【连接线上搭建的amqp,请填写线上服务器IP】
spring.rabbitmq.port=#amqp端口号
spring.rabbitmq.username=kingapex#用户名
spring.rabbitmq.password=wangfeng#密码

数据库配置说明

配置内容
#此配置必须和javashop-web项目启动后安装的数据库配置完全相同
spring.datasource.url=jdbc:mysql://localhost:3306/javashop?useUnicode=true&characterEncoding=utf8&autoReconnect=true
spring.datasource.username=root#用户名
spring.datasource.password=root#密码
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
spring.datasource.type=com.alibaba.druid.pool.DruidDataSource

results matching ""

    No results matching ""