Halaman ini belum tersedia dalam bahasa lokal Anda. Kami berusaha keras untuk menambahkan lebih banyak versi bahasa. Terima kasih atas dukungan Anda.
- What's New
- Function Overview
- Service Overview
- Billing
- Getting Started
-
User Guide
- Before You Start
- Permissions Management
-
Environment Management
- Environment Overview
- Creating an Environment
- Managing CCE Resources
- Managing Basic Resources
- Removing Managed Basic Resources
- Managing VM Agents
- Modifying an Environment
- Deleting an Environment
- Application Management
-
Component Management
- Component Overview
- Creating and Deploying a Component
- Viewing Component Details
- Managing Component Labels
- Changing the Component Description
- Managing Component Instances
- Upgrading a Single Component
- Upgrading Components in Batches
- Cloning Components in Batches
- Synchronizing Component Configurations in Batches
- Rolling Back a Component
- Redeploying a Component
- Configuring the Component Access Mode
- Changing the Component Access Domain Name
- Configuring a Scaling Policy of a Component Instance
- Component O&M
- Viewing the Component Running Environment
- Starting and Stopping a Component Instance
- Manually Synchronizing the Component Status
- Managing Cloud Service Settings of a Container-Deployed Component
- Managing Container Settings of a Container-Deployed Component
- Managing Application Settings of a Container-Deployed Component
- Managing Advanced Settings of a Container-Deployed Component
- Managing VM-Deployed Component Configurations
- Deleting a Component
- Configuration Management
- Release Management (OBT)
- Tech Stack Management
- Deployment Source Management
- Continuous Delivery
-
Microservice Engine
- Cloud Service Engine Overview
- Creating a Microservice Engine
-
Managing Microservice Engines
- Viewing Microservice Engine Information
- Obtaining the Service Center Address of a Microservice Engine
- Obtaining the Configuration Center Address of a Microservice Engine
- Viewing the Instance Quota of a Microservice Engine
- Viewing the Configuration Item Quota of a Microservice Engine
- Configuring Backup and Restoration of a Microservice Engine
- Managing Public Network Access for a Microservice Engine
- Viewing Microservice Engine Operation Logs
- Upgrading a Microservice Engine Version
- Deleting a Microservice Engine
- Managing Security Authentication for a Microservice Engine
- Using Microservice Engines
- Key Operations Recorded by CTS
- Viewing Monitoring Metrics and Alarms
-
Developer Guide
-
Microservice Developer Guide
- Overview
- Developing Microservice Applications
- Preparing the Environment
- Connecting Microservice Applications
- Deploying Microservice Applications
- Using Microservice Engine Functions
- Appendix
-
Microservice Developer Guide
-
Best Practices
- ServiceStage Best Practices
- Hosting and Managing a Weather Forecast Microservice Application on ServiceStage
- Enabling Security Authentication for an Exclusive ServiceComb Engine
- Connecting ServiceComb Engine Dashboard Data to AOM through ServiceStage
- Migrating the Registered Microservice Engine Using ServiceStage Without Code Modification
- Hosting a Spring Boot Application on ServiceStage
- Using GitLab to Interconnect with Jenkins to Automatically Build and Upgrade Components Deployed on ServiceStage
- Using ServiceStage to Migrate Components Across AZs and Upgrade Components in Sequence Based on Release Management
-
API Reference
- Before You Start
- API Overview
- Calling APIs
-
Application Management V3 APIs
-
Environment
- Creating an Environment
- Obtaining All Environments
- Deleting an Environment Based on the Environment ID
- Modifying an Environment Based on the Environment ID
- Obtaining Environment Details Based on the Environment ID
- Modifying an Environment Resource Based on the Environment ID
- Enabling an Environment Resource Based on the Environment ID
- Querying a Managed Resource Based on the Environment ID
- Querying a Created Resource Based on the Environment ID
- Adding an Environment Resource Based on the Environment ID
- Updating an Environment Resource Based on the Environment ID
- Deleting an Environment Resource Based on the Environment ID
- Querying Resource Enabling Records Based on the Environment ID
- Querying the Details of a Resource Enabling Record Based on the Environment ID
- Querying the Events of a Resource Enabling Record Based on the Environment ID
-
Application
- Creating an Application
- Obtaining All Applications
- Modifying Application Information Based on the Application ID
- Deleting an Application Based on the Application ID
- Obtaining Application Details Based on the Application ID
- Obtaining Application Configurations Based on the Application ID
- Modifying Application Configurations Based on the Application ID
- Deleting Application Configurations Based on the Application ID
-
Component
- Creating an Application Component
- Importing a CCE Workload to an Application to Create a Component
- Obtaining All Components of an Application
- Obtaining All Components
- Modifying Component Information Based on the Component ID
- Deleting a Component Based on the Component ID
- Obtaining Component Information Based on the Component ID
- Delivering a Component Task Based on the Component ID
- Obtaining Records Based on the Component ID
- Refreshing Component Information Based on the Component ID
- Obtaining Component Configuration Information
-
Technology Stack
- Querying a Runtime System Stack
- Querying a Built-in Image
- Creating a Technology Stack
- Querying a Technology Stack Based on the Technology Stack ID
- Modifying a Technology Stack Based on the Technology Stack ID
- Deleting a Technology Stack Based on the Technology Stack ID
- Releasing or Canceling the Release of a Technology Stack
-
Configuration Management
- Creating a Configuration Group
- Obtaining a Configuration Group
- Creating a Configuration File
- Importing a Configuration File
- Obtaining Configuration File Information
- Obtaining Configuration File Information Based on the Configuration File ID
- Deleting a Configuration File Based on the Configuration File ID
- Modifying a Configuration File Based on the Configuration File ID
- Obtaining the Configuration File Record Based on the Configuration File ID
- Obtaining the Configuration File Record Information Based on the Record ID
- Deleting a Configuration File Record Based on the Record ID
- Obtaining Configuration Group Details Based on the Group ID
- Deleting a Configuration Group Based on the Group ID
- Deployment Job
- Add-on Management
-
Environment
-
Git Repository Access APIs
- Obtaining a Git Repository Authorization List
- Obtaining an Authorization Redirection URL
- Creating OAuth Authorization
- Creating Private Token Authorization
- Creating Password Authorization
- Deleting Repository Authorization
- Obtaining a Repository Namespace
- Obtaining Repository Information Based on the Clone URL
- Obtaining All Projects in a Namespace
- Creating a Software Repository Project
- Obtaining a Project Branch
- Obtaining a Project Tag
- Creating a Project Tag
- Deleting a Project Tag
- Obtaining Project Commits
- Obtaining a Project Hook
- Creating a Project Hook
- Deleting a Project Hook
- Obtaining a Repository File Directory
- Obtaining Repository File Contents
- Creating a Repository File
- Modifying Repository File Contents
- Deleting a Repository File
-
CSE APIs
- API Calling
- Dynamic Configuration
-
Engine Management
- Querying Flavors Supported by an Exclusive Microservice Engine
- Querying the Exclusive Microservice Engine List
- Creating an Exclusive Microservice Engine
- Querying Details About an Exclusive Microservice Engine
- Deleting an Exclusive Microservice Engine
- Querying Details About an Exclusive Microservice Engine Job
-
ServiceComb APIs
- API Calling
- Authentication
-
Microservice
- Querying Information About a Microservice
- Deleting Definition Information About a Microservice
- Querying Information About All Microservices
- Creating Static Information for a Microservice
- Deleting Static Information About Microservices in Batches
- Modifying Extended Attributes of a Microservice
- Querying the Unique Service or Schema ID of a Microservice
- Schema
-
Microservice Instance
- Registering a Microservice Instance
- Querying a Microservice Instance Based on service_id
- Deregistering a Microservice Instance
- Querying Details About a Microservice Instance
- Modifying the Extended Information About a Microservice Instance
- Modifying Status of a Microservice Instance
- Sending Heartbeat Information
- Querying a Microservice Instance by Filter Criteria
- Querying Microservice Instances in Batches
- Dependency
- Configuration Management
- Examples
- Data Structure
- Permissions and Supported Actions
- Appendix
-
Historical APIs
-
Application Management V2 APIs
- Meta
- Environment
-
Application
- Creating an Application
- Obtaining All Applications
- Modifying Application Information
- Deleting an Application Based on the Application ID
- Obtaining Application Details Based on the Application ID
- Modifying Application Configurations
- Deleting Application Configurations
- Obtaining Application Configurations
- Component
- Instance
- Deployment Jobs
- Build APIs
- Querying Configurations
- Creating a Dependency Between Services
- Reporting Service Metrics
-
Application Management V2 APIs
- SDK Reference
-
FAQs
- Application Development FAQs
- Environment Management
-
Application Management
- How Do I View the Causes of Application Component Deployment Failures?
- What If an Instance Is Being Created for a Long Time?
- How Do I Solve the Dependency Problem When a Node Program Runs in Docker?
- How Do I Customize a Tomcat Context Path?
- How Do I Use a Fixed Application Component IP?
- What Should I Do If an ECS Error Occurs When I Create and Deploy a Component on a VM?
- What Should I Do If I Cannot Access the Port When I Create and Deploy a Component on a VM?
- Which Directories Do I Use to Write Files for VM-Deployed Application Components?
- What Should I Do If "host status is not active" Is Reported When a VM-Deployed Component Fails to Be Deleted?
- How Do I Use the ServiceStage Source Code Deployment Function?
- What Should I Do If Components Fail to Be Upgraded in ServiceStage Dark Launch?
- How Do I Mount Items to Modify the Configuration File of a Container-based Component?
- What Should I Do If the Application Name Displayed on Microservice Governance Is Different from That Displayed on ServiceStage Application Management After an Application Component Is Connected to a Microservice Engine?
-
Continuous Delivery
- How Does ServiceStage Manage Code on IDEA?
- How Do I Add the Build Server Address to the GitLab Server Security Group?
- How Do I Add the Build Server Address to the Maven Server Security Group?
- What Do I Do If ServiceStage Failed to Build a Job?
- How Can I Access Dependent Services Through VPC Endpoints When Building Images?
- Software Center
-
Infrastructure
- Are Existing Programs Affected If I Unsubscribe Servers?
- How Can I Access Dependent Services Through VPC Endpoints When Installing VM Agents?
- What Should I Do If I Don't See the VM Agent After Installing It?
- What Should I Do If the VM Agent Is Offline?
- What Should I Do If the Service Registration Fails After IPv6 Is Enabled for the Exclusive Microservice Engine with Security Authentication Enabled?
- What Should I Do If a Non-Microservice Engine Error Occurs When I Operate an Exclusive Microservice Engine?
- How Do I Switch a Cluster Used for Component Building from a Shared Cluster to a Private One?
- What Should I Do If the Access Address Fails to Be Processed During CSE Creation?
- What Do I Need to Know Before Upgrading an Exclusive Microservice Engine?
- Obtain Configurations Failed
- Application O&M
-
Application Development
- What Are the Differences Between the Microservice and Common Application?
- How Do I Handle a Microservice Registry Failure (Java Chassis)?
- How Do I Troubleshoot Microservices Deployed on the Cloud?
- Should I Use the SDK or ServiceMesh to Build a Microservice?
- What If I Fail to Obtain a Dependency?
- What Is Service Name Duplication Check?
- Why Do I Have to Define Service Contracts?
- Why Are Microservice Development Framework and Netty Versions Unmatched?
- How Do I Package a Java or Tomcat Application?
-
More Documents
-
User Guide (ME-Abu Dhabi Region)
- Service Overview
- Getting Started
-
User Guide
- Overview
- Permissions Management
- Application Management
- Environment Management
-
Application O&M
- Maintaining Application Component Instances
- Adding Labels for Application Component Instances
- Configuring Domain Name Mappings
- Configuring Alarm Thresholds for Resource Monitoring
- Configuring a Scaling Policy of an Application Component Instance
- Configuring a Scheduling Policy of an Application Component Instance
- Configuring an Upgrade Policy of an Application Component Instance
- Configuring Custom Monitoring of an Application Component
- Configuring a Log Policy of an Application
- Configuring Health Check
- Continuous Delivery
- Software Center
-
Infrastructure
-
Cloud Service Engine (CSE)
- Overview
- Creating an Exclusive Microservice Engine
-
Microservice Engine Management
- Configuring Backup and Restoration of an Exclusive Microservice Engine
- Configuring Public Network Access of an Exclusive Microservice Engine
- Viewing the Access Address of a Microservice Engine
- Viewing Operation Logs of an Exclusive Microservice Engine
- Upgrading an Exclusive Microservice Engine
- Deleting an Exclusive Microservice Engine
- Using the Microservice Dashboard
- Microservice Governance
- Configuring Microservices
- Maintaining Microservices
- Installing VM Agent on a Single VM
-
Cloud Service Engine (CSE)
-
FAQs
- How Do I Obtain an AK/SK Pair?
- What Should I Do If an Error Occurs When I Change the Name of a Project ?
- What Are the Differences Between Microservices and Common Applications?
- How Do I View the Causes for Application Component Deployment Failures?
- What Should I Do If a VM Component Fails to Be Deployed or Updated?
- What Are the Constraints on Packaging a Node.js 8 Software Package?
- What Should I Do If the Agent Fails to Be Installed?
- What Should I Do If the Agent Is Offline?
- Which Directories Do I Use to Write Files for VM-based Application Components?
- What Should I Do If "host status is not active" Is Reported When a VM-based Component Fails to Be Deleted?
- How Do I Handle Docker Application Dependency?
- What Should I Do If Docker Client Fails to Push Images?
- How Do I Obtain a Project Name?
- What Should I Do If the Service Registration Fails After IPv6 Is Enabled for the Exclusive Microservice Engine with Security Authentication Enabled?
- What Should I Do If a Non-Microservice Engine Error Occurs When I Operate an Exclusive Microservice Engine?
- What Should I Do I Get an ECS Error When Deploying VM-based Components?
- What Should I Do If an ECS Error Occurs During VM-based Component Deployment?
- What Should I Do If I Cannot Access the Port During VM-based Deployment?
- What Should I Do If the Microservice Application Name Is Different from the Component Application Name?
- Why the Microservice Name Is Different from the Component Name?
- Failed to Restore Data of an Exclusive Microservice Engine
-
API Reference (ME-Abu Dhabi Region)
- Before You Start
- API Overview
- Calling APIs
-
Application Management APIs
- Meta
- Environment
-
Application
- Creating an Application
- Obtaining All Applications
- Modifying Application Information
- Deleting an Application Based on the Application ID
- Obtaining Application Details Based on the Application ID
- Adding or Modifying Application Configurations
- Deleting Application Configurations
- Obtaining Application Configurations
- Component
-
Instance
- Creating an Application Component Instance
- Obtaining All Instances of a Component
- Querying the Operations Performed on a Component Instance
- Modifying an Application Component Instance
- Deleting an Application Component Instance
- Querying Instance Details Based on the Instance ID
- Obtaining Component Instance Snapshots
- Job
-
Git Repository Access APIs
- Obtaining a Git Repository Authorization List
- Obtaining an Authorization Redirection URL
- Creating OAuth Authorization
- Creating Private Token Authorization
- Creating Password Authorization
- Deleting Repository Authorization
- Obtaining a Repository Namespace
- Obtaining Repository Information Based on the Clone URL
- Obtaining All Projects in a Namespace
- Creating a Software Repository Project
- Obtaining a Project Branch
- Obtaining a Project Tag
- Creating a Project Tag
- Deleting a Project Tag
- Obtaining Project Commits
- Obtaining a Project Hook
- Creating a Project Hook
- Deleting a Project Hook
- Obtaining a Repository File Directory
- Obtaining Repository File Contents
- Creating a Repository File
- Modifying Repository File Contents
- Deleting a Repository File
-
CSE API
- API Calling
- Querying Static Information About a Microservice
- Querying Static Information About All Microservices
- Creating Static Information for a Microservice
- Modifying Static Information About a Microservice
- Querying a Microservice Schema
- Modifying a Microservice Schema
- Creating a Dependency Between Services
- Querying All Providers of a Microservice
- Querying the Unique Service or Schema ID of a Microservice
- Registering a Microservice Instance
- Querying All Instances of a Microservice Based on the Service ID
- Deregistering a Microservice Instance
- Querying Details About a Microservice Instance
- Modifying the Extended Information About a Microservice Instance
- Changing the Status of a Microservice Instance
- Sending Heartbeat Information
- Querying a Microservice Instance by Filter Criteria
- Querying Configurations
- Deleting Static Information About a Microservice
- Deleting Static Information About Microservices in Batches
- Querying Microservice Instances in Batches
- Querying All Schema Information About a Microservice
- Data Structure
- Permissions Policies and Supported Actions
- Appendix
-
User Guide (Kuala Lumpur Region)
- Service Overview
- Getting Started
- Overview
- Permissions Management
- Environment Management
- Application Management
-
Component Management
- Component Overview
- Creating and Deploying a Component
- Viewing Component Details
- Managing Component Labels
- Managing Component Instances
- Upgrading a Single Component
- Upgrading Components in Batches
- Rolling Back a Component
- Redeploying a Component
- Setting the Access Mode of Components
- Changing the Component Access Domain Name
- Configuring a Scaling Policy of a Component Instance
- Component O&M
- Viewing the Component Running Environment
- Component Instance Start and Stop
- Deleting a Component
-
Component Advanced Setting
- Setting Component Environment Variables
- Configuring the Lifecycle of a Component
- Configuring Data Storage
- Configuring a Distributed Cache
- Configuring Relational Databases
- Configuring a Scheduling Policy of a Component Instance
- Configuring a Log Policy of an Application
- Configuring Custom Monitoring of a Component
- Configuring Health Check
- Deployment Source Management
- Continuous Delivery
-
Microservice Engine
- Cloud Service Engine Overview
- Creating a Microservice Engine
-
Managing Microservice Engines
- Viewing Microservice Engine Information
- Obtaining the Service Center Address of a Microservice Engine
- Obtaining the Configuration Center Address of a Microservice Engine
- Viewing the Quota of Microservice Engine Instances
- Viewing the Quota of Microservice Engine Configuration Items
- Configuring Backup and Restoration of a Microservice Engine
- Managing Public Network Access for a Microservice Engine
- Viewing Microservice Engine Operation Logs
- Upgrading a Microservice Engine Version
- Deleting a Microservice Engine
- Managing Security Authentication of a Microservice Engine
- Using Microservice Engines
- Key Operations Recorded by CTS
- Viewing Monitoring Metrics and Alarms
-
FAQs
- Application Development FAQs
- Environment Management
-
Application Management
- How Do I View the Causes of Application Component Deployment Failures?
- What If an Instance Is Being Created for a Long Time?
- How Do I Solve the Dependency Problem When a Node Program Runs in Docker?
- How Do I Customize a Tomcat Context Path?
- How Do I Use a Fixed Application Component IP?
- How Do I Use the ServiceStage Source Code Deployment Function?
- Continuous Delivery
- Infrastructure
- Application O&M
-
API Reference (Kuala Lumpur Region)
- Before You Start
- API Overview
- Calling APIs
-
Application Management APIs
- Meta
- Environment
-
Application
- Creating an Application
- Obtaining All Applications
- Modifying Application Information
- Deleting an Application Based on the Application ID
- Obtaining Application Details Based on the Application ID
- Adding or Modifying Application Configurations
- Deleting Application Configurations
- Obtaining Application Configurations
- Component
-
Instance
- Creating an Application Component Instance
- Obtaining All Instances of a Component
- Querying the Operations Performed on a Component Instance
- Modifying an Application Component Instance
- Deleting an Application Component Instance
- Querying Instance Details Based on the Instance ID
- Obtaining Component Instance Snapshots
- Job
-
CSE API
- API Calling
- Querying Static Information About a Microservice
- Querying Static Information About All Microservices
- Creating Static Information for a Microservice
- Modifying Static Information About a Microservice
- Querying a Microservice Schema
- Modifying a Microservice Schema
- Creating a Dependency Between Services
- Querying All Providers of a Microservice
- Querying the Unique Service or Schema ID of a Microservice
- Registering a Microservice Instance
- Querying All Instances of a Microservice Based on the Service ID
- Deregistering a Microservice Instance
- Querying Details About a Microservice Instance
- Modifying the Extended Information About a Microservice Instance
- Changing the Status of a Microservice Instance
- Sending Heartbeat Information
- Querying a Microservice Instance by Filter Criteria
- Querying Configurations
- Deleting Static Information About a Microservice
- Deleting Static Information About Microservices in Batches
- Querying Microservice Instances in Batches
- Querying All Schema Information About a Microservice
- Data Structure
- Permissions Policies and Supported Actions
- Appendix
-
User Guide (ME-Abu Dhabi Region)
- Videos
- General Reference
Show all
Copied.
Connecting Java Chassis Applications to CSE Engines
This section describes how to connect Java chassis applications to CSE engines and use the most common functions of CSE engines. For details about the development guide, see Using Microservice Engine Functions.
In the Apache ServiceComb Samples project, you can find the code corresponding to the development methods in this section.
Prerequisites
- Microservice applications have been developed based on Java chassis.
For details about microservice application development in the Java chassis framework, see https://servicecomb.apache.org/references/java-chassis/en_US/.
- Version requirements. See Requirements for Microservice Development Framework of a.
- This document assumes that you use Maven for dependency management and packaging in your project. You are familiar with the Maven dependency management mechanism and are able to modify the dependency management and dependency in the pom.xml file.
- Java chassis can be used together with different technologies. The name of the configuration file is related to the technology you use. For example, if you use Java chassis in Spring mode, the configuration file name is microservice.yaml. If you use Java chassis in Spring Boot mode, the configuration file name is application.yaml. This document uses microservice.yaml to indicate the configuration file. You need to use a configuration file name corresponding to your project.
Procedure
- Add dependencies to the pom.xml file of the project.
<dependency> <groupId>org.apache.servicecomb</groupId> <artifactId>solution-basic</artifactId> </dependency> <dependency> <groupId>org.apache.servicecomb</groupId> <artifactId>servicestage-environment</artifactId> </dependency>
NOTE:
- The solution-basic module contains common Java chassis functions, such as the configuration center module and service governance module, which allow you to enable these functions in one-click.
<!-- Configuration center module --> <dependency> <groupId>org.apache.servicecomb</groupId> <artifactId>config-cc</artifactId> </dependency> <!-- Service governance module --> <dependency> <groupId>org.apache.servicecomb</groupId> <artifactId>handler-governance</artifactId> </dependency>
- The servicestage-environment module consists of the following dependent module:
<!-- Registry and discovery module --> <dependency> <groupId>org.apache.servicecomb</groupId> <artifactId>registry-service-center</artifactId> </dependency>
You are advised to use Maven Dependency Management to manage the third-party software dependencies of a project. Add the following information to the pom.xml file of the project:
<dependencyManagement> <dependencies> <dependency> <groupId>org.apache.servicecomb</groupId> <artifactId>java-chassis-dependencies</artifactId> <version>${java-chassis.version}</version> <type>pom</type> <scope>import</scope> </dependency> </dependencies> </dependencyManagement>
Skip the operation if your project already contains the preceding dependencies.
The servicestage-environment software package is optional. This software package provides the environment variable mapping function. When you use ServiceStage to deploy applications, you do not need to manually modify information such as the registry center address, configuration center address, and project name. The default configurations in the microservice.yaml file are overwritten by environment variables. The mapping.yaml file is contained in the software package. You can also add the mapping.yaml file to your own project.
NOTE:
The mapping.yaml file may change in later versions to support the latest functions of CSE engines. If you do not want the new version to evolve with CSE engines, you can add the mapping.yaml file to your project instead of adding the servicestage-environment dependency.
Generally, the microservice.yaml and mapping.yaml files are stored in the /src/main/resources/ directory in the root directory of the current project.
PAAS_CSE_ENDPOINT: - servicecomb.service.registry.address - servicecomb.config.client.serverUri PAAS_CSE_SC_ENDPOINT: - servicecomb.service.registry.address PAAS_CSE_CC_ENDPOINT: - servicecomb.config.client.serverUri PAAS_PROJECT_NAME: - servicecomb.credentials.project # CAS_APPLICATION_NAME: # - servicecomb.service.application # CAS_COMPONENT_NAME: # - servicecomb.service.name # CAS_INSTANCE_VERSION: # - servicecomb.service.version
Common software packages are added to solution-basic, and the default microservice.yaml file is provided. This configuration file configures common Handlers and parameters as follows:
# order of this configure file servicecomb-config-order: -100 servicecomb: # handlers handler: chain: Provider: default: qps-flowcontrol-provider Consumer: default: qps-flowcontrol-consumer,loadbalance,fault-injection-consumer # loadbalance strategies references: version-rule: 0+ loadbalance: retryEnabled: true retryOnNext: 1 retryOnSame: 0 # metrics and access log accesslog: enabled: true metrics: window_time: 60000 invocation: latencyDistribution: 0,1,10,100,1000 Consumer.invocation.slow: enabled: true msTime: 1000 Provider.invocation.slow: enabled: true msTime: 1000 publisher.defaultLog: enabled: true endpoints.client.detail.enabled: true
servicecomb-config-order is set to -100 in the microservice.yaml configuration file, indicating that the priority of the configuration file is low. (A larger order indicates a higher priority. The default value is 0.) If the same configuration item is added to the service, the configuration will be overwritten.
NOTE:
The microservice.yaml file may change in later versions to support the latest functions of CSE engines. If you do not want the new version to evolve with CSE engines, you can write the configuration items to your own microservice.yaml file.
- The solution-basic module contains common Java chassis functions, such as the configuration center module and service governance module, which allow you to enable these functions in one-click.
- (Optional) Configure the AK/SK.
Perform this step only when you use the professional microservice engine.
The AK/SK is configured in the microservice.yaml file. ServiceComb provides plaintext configuration by default and allows you to customize the encryption storage scheme. For details about how to obtain the AK/SK and project name, see Obtaining the AK/SK and Project Name.
- Add the following configuration in plaintext to the microservice.yaml file:
servicecomb: credentials: accessKey: AK #Enter the AK. secretKey: SK #Enter the SK. project: Project name #Enter the project name. akskCustomCipher: default
- Implement the org.apache.servicecomb.foundation.auth.Cipher API using either of the following methods:
- String name()
Name definition of servicecomb.credentials.akskCustomCipher, which needs to be added to the configuration file.
- char[] decode(char[] encrypted)
Decrypt the API, which is used after secretKey is decrypted.
The implementation class must be declared as SPI. For example:
package com.example public class MyCipher implements Cipher
Create an SPI configuration file. The file name and path are META-INF/serivce/org.apache.servicecomb.foundation.auth.Cipher, and the file content is as follows:
com.example.MyCipher
Add the following configuration to the microservice.yaml file:
servicecomb: credentials: accessKey: AK #Enter the AK. secretKey: SK #Enter the encrypted SK. project: Project name #Enter the project name. akskCustomCipher: youciphername #Enter the returned name of the name() method in the implementation class.
- String name()
NOTE:
If you do not want to write the AK/SK into the configuration file, use either of the following environment variable methods. For details, see Method 2.
- Use environment variables. The OS environment variable name cannot contain periods (.). The Java chassis can automatically process the environment variable servicecomb_credentials_accessKey and map it to servicecomb.credentials.accessKey.
- Add the mapping.yaml file and customize the environment variable name. For details about this method, see the servicestage-environment module in 1.
- Add the following configuration in plaintext to the microservice.yaml file:
- (Optional) Configure security authentication parameters.
Perform this step only when you use the exclusive microservice engine and enable security authentication. In other scenarios, skip this step.
After security authentication is enabled for a microservice engine, all called APIs can be called only after a token is obtained. For details about the authentication process, see RBAC.
To use security authentication, obtain the username and password from the microservice engine and then add the following configuration to the configuration file.
servicecomb: credentials: rbac.enabled: true account: name: your account name # Username obtained from the microservice engine password: your password # Password obtained from the microservice engine cipher: default # Returned name of the name() method in the implementation class of API org.apache.servicecomb.foundation.auth.Cipher
cipher specifies the name of the algorithm used to encrypt the password. By default, the password is stored in plaintext. The encryption is implemented through customization. The details are as follows:
- Implement the org.apache.servicecomb.foundation.auth.Cipher API using either of the following methods:
- String name()
Name definition of servicecomb.credentials.cipher, which needs to be added to the configuration file.
- char[] decode(char[] encrypted)
Decrypt the API, which is used after secretKey is decrypted.
The implementation class must be declared as SPI. For example:
package com.example public class MyCipher implements Cipher
Create an SPI configuration file. The file name and path are META-INF/serivce/org.apache.servicecomb.foundation.auth.Cipher, and the file content is as follows:
com.example.MyCipher
Add the following configuration to the microservice.yaml file:
servicecomb: credentials: rbac.enabled: true account: name: your account name password: your password # Encrypted password cipher: youciphername # Returned name of the name() method in the implementation class
- String name()
NOTE:
- Plaintext storage cannot ensure security. You are advised to encrypt the password.
- You can also use environment variables to configure the username and password, which is the same as configuring the AK/SK. For details, see Java Chassis.
- If you use the professional microservice engine, the watch function is not available. You need to disable the watch function in the configuration file. Otherwise, error logs will be periodically printed. In the service center, set watch to false. In the configuration center, set refreshMode to 1.
servicecomb: service: application: porter-application name: user-service version: 0.0.1 registry: address: http://localhost:30100 instance: watch: false config: client: serverUri: http://localhost:30103 refreshMode: 1
- Implement the org.apache.servicecomb.foundation.auth.Cipher API using either of the following methods:
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot