Online Demo: User/Password(admin/admin123).
Lightweight: these aren't complex techs and third dependencies;
Storage: Use Redis as data storage,you can use Redis Cluster,Redis Master-Slave or Redis Proxy Middleware etc. to guarantee data is high avaliable;
Equivalent Server Nodes: Multiple server nodes guarantee that Configuration Service is high avaliable, even though some server nodes are unavaliable;
Near Realtime Updating: diablo use Http Long Pulling to guarantee that config modification notify the clients at the near realtime;
Elegant UI: diablo embedded a simple and elegant web UI,I called it Diablo Tower;
...
Download the lastest package;
or build with source code:
mvn clean package -DskipTests
# package located diablo-server/target/diablo-server.tar.gz
Unpack the package:
tar zxf diablo-server.tar.gz
ll diablo
bin # the execute scripts
conf # conf dir
lib # dependency libs
Edit the diablo.conf file:
# vim ${DIABLO_HOME}/conf/diablo.conf
# The server bind address
BIND_ADDR=127.0.0.1
# The server listening port
LISTEN_PORT=2143
# The redis host
REDIS_HOST=127.0.0.1
# The redis port
REDIS_PORT=6379
# The log path
LOG_PATH=~/logs/diablo
# The password for Diablo Tower admin
TOWER_PASS=admin
# The inverval(seconds) for checking server's status
CHECK_SERVER_INTERVAL=5
# Enable or disable client api auth
# client must config the appKey, if CLIENT_AUTH=true
CLIENT_AUTH=true
# Java Heap options
JAVA_HEAP_OPTS="-Xms512m -Xmx512m"
Start or stop the diablo server:
${DIABLO_HOME}/bin/diablo.sh start
${DIABLO_HOME}/bin/diablo.sh stop
${DIABLO_HOME}/bin/diablo.sh restart
Access the diablo tower over http(e.g.http://127.0.0.1:2143), once you started diablo server;
Prepare some apps and configs:
edit app:
edit config:
SimpleDiabloClient(Programming Mode):
add maven dependency:
<dependency>
<groupId>me.hao0</groupId>
<artifactId>diablo-client</artifactId>
<version>${version}</version>
</dependency>
code snippet example:
SimpleDiabloClient client = new SimpleDiabloClient();
client.setAppName("myapp");
client.setAppKey("123456");
client.setServers("127.0.0.1:2143,127.0.0.1:2144");
// You can add some config listener
client.addListener(new ConfigListener<String>() {
@Override
public String name() {
// config name
return "test_config1";
}
@Override
public void onUpdate(String newValue) {
// trigger this method after the local config updated
System.out.println("test_config1 has updated to " + newValue);
}
});
client.start();
// get the config's latest value
String testConfig = client.get("test_config");
// get the config's latest value as an json object
MyClass myClass = client.get("test_json", MyClass.class);
client.shutdown();
you also see these test cases.
SpringDiabloClient(Spring Inject Mode):
add maven dependency:
<dependency>
<groupId>me.hao0</groupId>
<artifactId>diablo-client-spring</artifactId>
<version>${version}</version>
</dependency>
config the diablo client:
<bean class="me.hao0.diablo.client.SpringDiabloClient">
<property name="appName" value="myapp" />
<property name="appKey" value="123456" />
<property name="servers" value="127.0.0.1:2143,127.0.0.1:2144" />
<!-- optional configuration -->
<property name="listeners">
<list>
<ref bean="activityNoListener" />
<ref bean="timeInfoListener" />
<ref bean="timeInfosListener" />
<ref bean="timeInfoMapListener" />
</list>
</property>
<!-- Some config listeners -->
<bean id="activityNoListener" class="me.hao0.diablo.client.listener.ActivityNoListener" />
<bean id="timeInfoListener" class="me.hao0.diablo.client.listener.TimeInfoListener" />
<bean id="timeInfosListener" class="me.hao0.diablo.client.listener.TimeInfosListener" />
<bean id="timeInfoMapListener" class="me.hao0.diablo.client.listener.TimeInfoMapListener" />
</bean>
add your diablo config bean into spring context, such as:
@Component
public class MyAppConfig implements DiabloConfig {
// basic types auto convert
private String activityNo;
private Integer activityChannel;
private Boolean activityStart;
private Float activityRatio;
private Long activityCount;
private Double activityFee;
// support common json object convert
private TimeInfo timeInfo;
// support one level List object convert
private List<TimeInfo> timeInfos;
// support one level Map object convert
private Map<String, TimeInfo> timeInfoMap;
// getters and setters
}
you also see these test cases.
So the client will receive config updated notifactions, once you updated the corresponding config items over the Diablo Tower.
If you feel not bad, it's time to buy me a cup of coffee
Paypal:
Alipay:
Wechat:
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。
Activity
Community
Health
Trend
Influence
:Code submit frequency
:React/respond to issue & PR etc.
:Well-balanced team members and collaboration
:Recent popularity of project
:Star counts, download counts etc.