DCache Distributed Storage System | Installation, Deployment and Application Creation

With the development of microservices and cloud, the need for distributed architecture has become more and more common, the data types on the Web are no longer single, and the amount of data is growing explosively. Traditional SQL structured storage solutions have been unable to keep up, and NoSQL has emerged. As a distributed NoSQL cache system based on TARS, DCache perfectly supports TARS services and can be easily used in TARS services. This series of articles will focus on the installation and use of DCache. So how to have this system? This article will introduce the installation and application creation of DCache.

  • Introduction

    • SQL vs NoSQL

    • DCache

  • Install DCache

    • environment dependent

    • Compile and build

    • deploy

  • Create a DCache application

  • Summarize

With the development of the mobile Internet and cloud, the number of users is increasing and the number of business visits is increasing day by day. The expansion of resources alone cannot solve all the problems. Especially for e-commerce platforms, audio and video on demand, etc., there are large-scale data access, which requires high query efficiency, and traditional database disk IO is difficult to meet.

In order to solve this problem, the NoSQL database was born. By caching data in memory and calling it directly from memory, it greatly reduces the overhead of disk IO, improves query efficiency, and can also process massive data in combination with distributed . This NoSQL, where is the specific No?

SQL vs NoSQL

SQL refers to the structured query language of the database, which is the operation command set of the database. Traditional relational databases use standard SQL statements to manipulate and process data.

NoSQL refers to a type of database, which is mainly used for high-performance processing of super-massive data. One of its major features is that the data structure is simple, key-valuemainly based on , and the data is non-correlated, and it is easy to expand horizontally.

Literally, NoSQL seems to be opposed to SQL. Doing NoSQL seems to mean giving up SQL. However, in fact, NoSQL means Not Only SQL. It is not only SQL, but also includes the ability of SQL.

DCache

DCache is a distributed NoSQL storage system developed based on the TARS framework. The data is stored in memory and supports connecting to the back-end DB for data persistence. It combines the advantages of NoSQL and SQL and has the following characteristics

  • 高性能存储引擎,支持 key-value(键值对),k-k-row(多键值),list(列表),set(集合),zset (有序集合)等多种数据结构;

  • 采用集群模式,实现高扩展性和高可用性,支持异地镜像,就近接入;

  • 支持通过 TARS 名字服务访问,支持同步、异步、单向 RPC 调用方式;

  • 高效运维平台,在线完成服务部署、扩缩容、迁移,以及服务配置,服务调用质量监控;

  • 业务无须和直接和 MySQL 交互, DCache 会自动缓写 DB。

更多关于 DCache 的信息,可以查看DCache的GitHub仓库(文末附链接)

那么接下来,我们来看看如何在 TARS 上安装部署 DCache。

环境依赖

DCache 基于 TARS 开发,因此编译安装之前,需要先安装 TARS 框架,具体安装步骤可以参考 TARS 框架部署文档(文末附链接)

编译构建

先将 DCache 源码克隆下来
git clone https://github.com/Tencent/DCache.git

接着进入 DCache 目录,执行以下命令进行编译构建

mkdir buildcd buildcmake ..makemake releasemake tar

执行完之后即可生成 DCache 中各服务的发布包。

部署

生成发布包后,接下来就是将 DCache 部署在 TARS 中了。这一步,我们直接使用 DCache 中的自动部署脚本就可以了。

我们只需要进入前面编译构建项目的 build 目录,填写参数,执行安装脚本即可

cd build../deploy/install.sh $TARS_MYSQL_IP $TARS_MYSQL_PORT $TARS_MYSQL_USER $TARS_MYSQL_PASSWORD $DCACHE_MYSQL_IP $DCACHE_MYSQL_PORT $DCACHE_MYSQL_USER $DCACHE_MYSQL_PASSWORD $CREATE $WEB_HOST $WEB_TOKEN $NODE_IP

各参数释义如下

  • TARS_MYSQL_IP: TARS 数据库的 IP;

  • TARS_MYSQL_PORT: TARS 数据库的端口;

  • TARS_MYSQL_USER: TARS 数据库的用户名;

  • TARS_MYSQL_PASSWORD: TARS 数据库的密码;

  • DCACHE_MYSQL_IP: DCache 数据库的 IP;

  • DCACHE_MYSQL_PORT: DCache 数据库的端口;

  • DCACHE_MYSQL_USER: DCache 数据库的用户名;

  • DCACHE_MYSQL_PASSWORD: DCache 数据库的密码;

  • CREATE: 是否重新创建 DCache 的数据库,为 true 则重新创建;如果已经创建,例如需要升级原有 DCache,可以设置为 false,避免重新创建;

  • WEB_HOST: TarsWeb 平台地址;

  • WEB_TOKEN: TarsWeb 平台 Token (需要进入web平台, 用户中心上, 创建一个 Token);

  • NODE_IP: 公共服务部署节点 IP, 部署完成后, 你可以在 TarsWeb 平台扩容到多台节点机上。

例如

../deploy/install.sh 192.168.1.1233306 tarsAdmin [email protected].1.1243306 root 123456192.168.1.123:3000 abcdefg1randomtoken12345 192.168.1.123

TARS 与 DCache 的数据库可以相同,但如果在正式环境中使用,建议分开使用,为 DCache 建立独立的数据库。

执行完成后,DCache 即安装完成,如下图


安装完 DCache,我们就可以来创建第一个 DCache 应用了。

首先我们需要先添加一个地区,用于标识我们创建的 DCache 应用。点击顶部的 服务创建,点击下方 Tab 栏中的 地区,点击 新增地区,填写地区和标签,例如 深圳,标签 sz,如下

创建完成后,点击 Tab 栏中的 创建应用,填写应用名,并选择一个 IDC 地区,点击 创建应用。比如我们创建一个 TestDemo 应用,地区选择 深圳,如下

Router配置信息 中,选择 服务IP,并填写 MySQL 实例信息;Proxy配置信息 中,选择代理服务的 服务IP,点击 创建 router、proxy 服务 完成应用创建。

最后,点击 安装发布,即可发布应用

发布完成后,回到 服务管理,刷新即可看到刚刚创建的 DCache 应用 TestDemo




本文简要介绍了 DCache 的特性,并详细说明了如何安装 DCache 并创建一个 DCache 应用,帮助开发者快速部署、上手 DCache。关于 DCache 服务模块的创建和使用,将在后续系列文章中进行介绍,尽请期待。

TARS 可以在考虑到易用性和高性能的同时快速构建系统并自动生成代码,帮助开发人员和企业以微服务的方式快速构建自己稳定可靠的分布式应用,从而令开发人员只关注业务逻辑,提高运营效率。多语言、敏捷研发、高可用和高效运营的特性使 TARS 成为企业级产品。


附文中链接:

DCache的GitHub仓库:

https://github.com/Tencent/DCache

TARS 框架部署文档

https://tarscloud.github.io/TarsDocs/SUMMARY.html#deploy



TARS基金会是Linux基金会下的非营利性、微服务基金会,致力于建设一个强大而灵活的微服务生态系统。无论你在哪个行业,无论你使用什么技术栈,这里能助你快速实现你的创意。






点“在看”让TARS小姐姐变好看

本文分享自微信公众号 - TARS星球(TarsCloud)。
如有侵权,请联系 [email protected] 删除。
本文参与“OSC源创计划”,欢迎正在阅读的你也加入,一起分享。

{{o.name}}
{{m.name}}

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324103056&siteId=291194637