مركز تكوين المصدر المفتوح - أبولو
Apollo هي منصة لإدارة التكوين التي تم تطويرها بواسطة قسم إطارات CTRIP. يمكنه إدارة تكوينات البيئات ومجموعات التطبيقات المختلفة مركزيًا. بعد تعديل التكوين ، يمكن دفعه إلى جانب التطبيق في الوقت الفعلي ، ولديه أذونات موحدة وحوكمة العملية وغيرها من الخصائص. تم تطوير الخادم بناءً على Boot Boot و Spring Cloud. يمكن تشغيله مباشرة بعد العبوة ، وليس هناك حاجة لتثبيت حاويات تطبيق إضافية مثل Tomcat.
تحقق من الرمز
أبولو جيثب
يمكنك استخدام الفكرة لفتحها محليًا
نصوص قاعدة البيانات
قم بتشغيل البرنامج النصي التالي لإنشاء ApolloconifgDB ، Apolloportaldb
بدء تكوينات Adminservice
تكوين الفئة الرئيسية
com.ctrip.framework.apollo.assembly.apolloapplication
آراء VM
-dapollo_profile = github -dspring.datasource.url = jdbc: mysql: // localhost: 3306/apolloconfigdb؟
بعد البدء ، فتح http: // localhost: 8080 ويمكنك أن ترى أن كل من Apollo-ConfigService و Apollo-Adminservice قد تم تسجيلهم وتسجيله في Eureka.
ابدأ أبولو بورتال
تكوين الفئة الرئيسية
com.ctrip.framework.apollo.portal.portalapplication -dapollo_profile = github ، auth -ddev_meta = http: // localhost: 8080/-server.port = 8070 -dspring.datasource.url = jdbc: mysql: // localhost: 3306/apolloportaldb؟ pariceencoding = utf8 -dspring.datasource.username = root -dspring.datasource.password =
إذا تم تمكين ملف تعريف Auth ، فإن اسم المستخدم الافتراضي هو Apollo وكلمة المرور هي المسؤول
يتم تطبيقها على SIT ، UAT ، آلات بيئة الإنتاج
1. إضافة دليل/OPT/Data/Directory ، وقد قرأ وكتابة الأذونات ؛
2. تم إضافة ملف جديد: /opt/settings/server.properties والتكوين المضافة:
env = devsit: env = fatuat: env = uat production: env = pro
مثال العميل
component set component name @refreshscope يحدد أنه يمكن تحديث تغييرات التكوين @configurationProperties (prefix = "redis.cache") @component ("sampleredisconfig") Private Int ExpireSeconds ؛ السلسلة الخاصة clusternodes. Private Int CommandTimeout ؛ خريطة خاصة <string ، string> somemap = maps.newlinkedHashMap () ؛ قائمة خاصة <Tring> somelist = lists.newLinkedList () ؛ postconstruct private void initialize () {logger.info ("sampleredisconfig تهيئة - ExpireSeconds: {} ، clusternodes: {} ، commandtimeout: {} ، somemap: ) } public void setCluSternodes (سلسلة clusternodes) {this.clusternodes = clusternodes ؛ } public void setCommandTimeOut (int commandTimeOut) {this.commandTimeOut = commandTimeOut ؛ } الخريطة العامة <string ، string> getSomEmap () {return somemap ؛ } القائمة العامة <string> getSomElist () {return somelist ؛ } Override Public String ToString () {return string.format ("[sampleredisconfig] ExpireSeconds: ٪ d ، clusternodes: ٪ s ، commandtimeout: ٪ d ، somemap: ٪ s ، somelist: ٪ s" ، انتهاء الصلاحية ، clusternodes ، وقت قائد ، somemap ، somemap) ؛ }}إعداد المراقبة
ComponentPublic Class SpringBootApollorefreshConfig {private static final logger = loggerfactory.getLogger (SpringBootApollorefreshConfig.class) ؛ Autowired Private ApollorefreshConfig ApollorefreshConfig ؛ autowired خاص sampleredisconfig sampleredisconfig ؛ @autowired private RefreshScope RefreshScope ؛ apolloconfigchangelistener public void onChange (configchangeevent changeEvent) {logger.info ("قبل التحديث {}" ، sampleredisconfig.toString ()) ؛ RefreshScope.refresh ("sampleredisconfig") ؛ logger.info ("بعد التحديث {}" ، sampleredisconfig.toString ()) ؛ }}لخص
ما ورد أعلاه هو عملية بناء بيئة التنمية المحلية من سحابة الربيع أبولو أبولو. آمل أن يكون ذلك مفيدًا لك. إذا كان لديك أي أسئلة ، فيرجى ترك رسالة لي وسوف يرد المحرر إليك في الوقت المناسب. شكرا جزيلا لدعمكم لموقع wulin.com!