分布式体系结构被认为是NoSQL(或非关系型)数据库的优势之一,Amazon DocumentDB正在通过一种新的多区域功能解决一个关键的缺口,该功能AWS正在终止到目前为止,DocumentDB和大多数AWS数据库一样,支持跨区域内不同可用性区域的多个读取副本。现在,AWS正在跨地区扩展这一能力。虽然仍有一个主实例可供写入,但全局群集功能将支持最多五个远程区域中的只读辅助实例。
AWS确定了新的全局群集功能的两个核心用例:灾难恢复,用于确保数据库在区域中断时保持活动状态,低延迟读取分散在全球不同地区的数据。
概括一下,这个数据库正式命名为Amazon DocumentDB(带有MongoDB兼容性),是与MongoDB兼容的JSON文档数据存储。具体来说,它使用自己的自动缩放存储引擎,但通过AWS编写的与mongodb3.6和4.0接口兼容的api向应用程序提供数据;它支持Atlas云服务开始支持只读复制(如新的DocumentDB功能)发布一年后。MongoDB本身(本地和云中)也有https://docs.mongodb.com/manual/tutorial/sharding-high-availability-writes/“target=”\u blank“rel=”noopener noreferrer nofollow“data component=”externalLink“>一种有限的分布式写功能,在shard级别指定主键,这意味着数据库的不同部分为它们维护的数据部分控制写功能。当数据主权政策要求仅在来源国存储和/或更新特定记录时,此功能非常有用。相比之下,微软https://azure.microsoft.com/en-us/services/cosmos-db/“target=”\u blank“rel=”noopener noreferrer“data component=”externalLink“>Azure Cosmos DB,一个具有MongoDB兼容API(如DocumentDB)的多模式数据库,支持完全分布式的读/写功能。
在刚刚上线的博客文章中,AWS声称,从主副本到读取副本的更新通常在一秒钟内执行。文档数据库Cloudera的下一步是什么?
CockroachDB简化了多区域部署
a, .nav-item > a, .dropdown-menu a');
allLinks.forEach(link => {
let href = link.getAttribute('href');
if (!href || href === '#' || href === 'javascript:;') return;
// 4. 提取菜单中的核心路径
// 例如 /articles.html -> articles
let cleanHref = href.replace(/^\/|\/$/g, '').replace(/\.(html|php)$/, '').toLowerCase();
let isMatch = false;
// 5. 精确匹配逻辑
if (cleanHref === 'index') {
// 只有当前是首页时,才高亮首页
if (cleanPath === 'index') isMatch = true;
} else {
// 如果当前路径完全等于菜单路径 (如 /articles 匹配 /articles)
// 或者当前路径以 "菜单路径/" 开头 (如 /articles/154 匹配 /articles)
// 或者当前路径包含 "菜单路径." (防某些带点号的特殊情况)
if (cleanPath === cleanHref || cleanPath.startsWith(cleanHref + '/')) {
isMatch = true;
}
}
// 6. 如果匹配成功,加上高亮
if (isMatch) {
link.classList.add('active');
// 如果匹配的是下拉菜单里的子项,顺便把它的父级分类也高亮
const parentNavItem = link.closest('.nav-item');
if (parentNavItem && !parentNavItem.classList.contains('active')) {
const parentLink = parentNavItem.querySelector('a');
if (parentLink) parentLink.classList.add('active');
}
}
});
})();
// ================= 移动端菜单逻辑 =================
const toggle = document.getElementById("menuToggle");
const nav = document.getElementById("navLinks");
// 1. 汉堡按钮:切换主菜单显示/隐藏
if (toggle && nav) {
toggle.addEventListener("click", function (e) {
e.stopPropagation();
const expanded = this.getAttribute("aria-expanded") === "true";
this.setAttribute("aria-expanded", String(!expanded));
nav.classList.toggle("active");
});
}
// 2. 处理下拉子菜单的展开/折叠
if (window.innerWidth <= 768) {
const navItems = document.querySelectorAll(".nav-item");
navItems.forEach((item) => {
const titleLink = item.querySelector("a");
const dropdownMenu = item.querySelector(".dropdown-menu");
const arrowIcon = item.querySelector(".arrow-icon");
if (titleLink && dropdownMenu) {
titleLink.addEventListener("click", function (e) {
e.preventDefault(); // 阻止链接跳转
e.stopPropagation();
// 手风琴效果:收起其他已展开的菜单
navItems.forEach((otherItem) => {
if (otherItem !== item) {
const otherMenu = otherItem.querySelector(".dropdown-menu");
const otherArrow = otherItem.querySelector(".arrow-icon");
if (otherMenu) otherMenu.classList.remove("active");
if (otherArrow) otherArrow.style.transform = "rotate(0)";
}
});
// 切换当前菜单
dropdownMenu.classList.toggle("active");
if (arrowIcon) {
arrowIcon.style.transform = dropdownMenu.classList.contains(
"active",
)
? "rotate(180deg)"
: "rotate(0)";
}
});
}
});
}
// 3. 点击普通菜单项后,自动关闭整个主菜单
if (nav) {
nav.querySelectorAll("a").forEach(function (link) {
if (!link.querySelector(".arrow-icon")) {
link.addEventListener("click", function () {
nav.classList.remove("active");
if (toggle) toggle.setAttribute("aria-expanded", "false");
});
}
});
}
// ================= 返回顶部逻辑 =================
(function () {
const backToTop = document.getElementById("backToTop");
window.addEventListener("scroll", function () {
if (window.scrollY > 300) {
backToTop.classList.add("show");
} else {
backToTop.classList.remove("show");
}
});
backToTop.addEventListener("click", function () {
window.scrollTo({ top: 0, behavior: "smooth" });
});
})();
// 多语言
document.addEventListener("DOMContentLoaded", function() {
let path = window.location.pathname;
let isEn = path.startsWith('/en/');
if (isEn) {
document.cookie = "my_lang=en; path=/; max-age=" + (30 * 24 * 3600);
} else {
document.cookie = "my_lang=zh; path=/; max-age=" + (30 * 24 * 3600);
}
// 【2. 首页记忆】如果访问的是首页(没带 en),但记忆是英文,前端自动跳去英文首页
if (!isEn && (path === '/' || path === '/index.html')) {
if (document.cookie.includes('my_lang=en')) {
window.location.replace('/en' + path);
return;
}
}
// 【3. 菜单不掉线】如果是英文页面,自动给菜单链接加上 /en/
if (isEn) {
document.querySelectorAll('a').forEach(function(link) {
let href = link.getAttribute('href');
// 站内链接,且没带 /en/
if (href && href.startsWith('/') && !href.startsWith('/en/') && !href.startsWith('http')) {
link.setAttribute('href', '/en' + href);
}
});
}
});