当前位置:网站首页>[microservices | Nacos] Nacos realizes data isolation of multi environment and multi tenant
[microservices | Nacos] Nacos realizes data isolation of multi environment and multi tenant
2022-06-23 05:20:00 【Bulst】
List of articles
Business background
I have three members , Zhang San 、 Li Si 、 The dog egg . The dog egg had a stomachache that day , Ask for leave 3 Months , So I decided to hand over all the new projects to Zhang San and Li Si . If they both build one locally Nacos service , Not easy to manage , So I decided to share Nacos.
Isolation plan
In the above , We have passed based on Docker+Nginx+Nacos Built a highly available cluster , And have unified high availability MySQL data source , Connect to Li , Let's take a look at how our isolation scheme works .
Namespace Isolate multi tenancy
Each tenant may have its own namespace, Each tenant's configuration data and registered service data will belong to its own namespace Next , To achieve data isolation among multi tenants .Nacos adopt Namespace To isolate services and configurations between multiple tenants , And it has good scalability .
Group Environmental groups 【 Number of projects < Number of environments 】

Group Project grouping 【 Number of projects > Number of environments 】

namespce
namespace Design background
namespace The design of nacos Based on this, do multi environment and multi tenant data ( Configuration and services ) Segregated . namely :
From a tenant ( user ) From the perspective of , If there are many different environments , At this time, you can create different namespce, In order to achieve multi environment isolation . for example , You may have daily , There are three different environments for pre delivery and production , Then use a set of nacos There are three different clusters namespace.
From multiple tenants ( user ) From the perspective of , Every tenant ( user ) It may have its own namespace, Every tenant ( user ) The configuration data and registered service data of will belong to their own namespace Next , To achieve data isolation among multi tenants . For example, the super administrator assigned three tenants , They are Zhang San 、 Li Si and Wang Wu . After the distribution , All tenants log in with their own account name and password , Create your own namespace .
namespace Best practices
How to get namespace Value
Whether you are based on Spring Cloud perhaps Dubbo To use nacos, It's all about namespace Parameter input of , So at this point namespace Where can I get the value of ?
If you are not aware of the input of this parameter , that nacos Unified will use a default namespace As input ,nacos naming Will use public Initialize... As a default parameter ,nacos config An empty string is used as the default parameter to initialize .
If you need to customize your own namespace, So how does this value come into being ?
Can be in nacos On the left function side of the console, there is a Namespace The function of , Click to see New namespace The button , Then you can create your own namespace at this time . Once created , Will generate a namespace ID, It is mainly used to avoid the possibility of duplicate namespace names . Therefore, when you need to configure the specified namespace when , The namespace is filled in ID. Important things are to be repeated for 3 times :
When you need to configure the specified namespace when , The namespace is filled in ID
When you need to configure the specified namespace when , The namespace is filled in ID
When you need to configure the specified namespace when , The namespace is filled in ID
explain : namesace by public yes nacos A reserved control for , If you need to create your own namespace, It's better not to talk to public The nuptial , It is named after a real business scenario with specific semantics , So as not to make it literally difficult to distinguish which one you are namespace.
namespace Parameter initialization method
nacos client Yes namespace The initialization process of is shown in the figure below :
nacos client Yes namespace The initialization , It mainly consists of two parts :
The user state passes nacos client When constructing an instance, you can use properties Parameter passed in namespace.
In the cloud ( Alicloud EDAS) Of namespace Argument parsing .
It can be done by -Dnacos.use.cloud.namespace.parsing=true/false To control whether automatic resolution is required in the cloud environment namespace Parameters , The default is true, Yes, it will be automatically parsed , Its purpose is to facilitate users to smoothly go to the cloud at zero cost . If users need to use self built on the cloud nacos Under the namespace, At this time, you just need to -Dnacos.use.cloud.namespace.parsing=false that will do .
边栏推荐
- 618如何冲出重围?海尔智家:做好用户的数字化
- Ams:startactivity desktop launch application
- Event log keyword: eventlogtags logtags
- Complete the primary school project in 3 days, and teach you to complete the weather broadcast system hand in hand!
- The tiobe programming language ranking is an indicator of the popular trend of programming languages
- 物联网开源开发平台 Shifu 开放内测!第一版技术文档发布
- (IntelliJ) plug in background image plus
- Onnxoptimizer, onnxsim usage records
- Mongodb sharding principle
- Swiftui 2.0 course notes Chapter 5
猜你喜欢

MVC三层架构

BGP experiment

Jetpack Compose 从开门到入门之 MenuBar桌面菜单(Desktop Menu)

如何进行探索性数据分析

Complete the primary school project in 3 days, and teach you to complete the weather broadcast system hand in hand!

OSPF分流实验

Introduction to s file generated by TEQC for GNSS data quality analysis

Hcip fifth operation

JSP入门级笔记

BGP second test
随机推荐
Cookie-Session讲解
渗透测试基础 | 附带测试点、测试场景
Strong push, quick start to software testing
掌握 Shell,一篇就够了!
[C language] keyword
图片降噪DeNoise AI
VMware network connection error unit network service not found
bat中获取bat命令结果
Zygote进程
关于信息泄露和防御
三层架构实验
Swiftui 2.0 course notes Chapter 4
Hcip switch experiment
新晋职场人的 技术进击?之旅
Introduction to s file generated by TEQC for GNSS data quality analysis
Complete the primary school project in 3 days, and teach you to complete the weather broadcast system hand in hand!
Direct insertion sort - [common sort method (1/8)]
Investment risk management
MVC三层架构
气象绘图软件Panoply使用教程 (不定时更新)