├── .github └── workflows │ └── rust.yml ├── .gitignore ├── LICENSE ├── README.md ├── book.toml ├── ci └── index.html ├── docker ├── arbitrator │ └── Dockerfile ├── bailongma │ ├── Dockerfile │ ├── bailongma-0.2.2 │ └── bin │ │ ├── entrypoint.sh │ │ └── env-to-cfg ├── build.sh ├── builder │ ├── Dockerfile │ ├── back │ └── script │ │ └── build.sh ├── client │ └── Dockerfile ├── mdbook │ └── Dockerfile ├── runtime │ ├── Dockerfile │ └── bin │ │ ├── entrypoint.sh │ │ └── env-to-cfg ├── server │ └── Dockerfile └── test │ └── docker-compose.yml ├── helm ├── tdengine-0.2.0.tgz ├── tdengine-0.2.1.tgz ├── tdengine-0.3.0.tgz ├── tdengine-3.0.0.tgz ├── tdengine-3.0.2.tgz ├── tdengine-3.5.0.tgz ├── tdengine-enterprise-3.5.0.tgz └── tdengine │ ├── .helmignore │ ├── Chart.yaml │ ├── LICENSE │ ├── templates │ ├── NOTES.txt │ ├── _helpers.tpl │ ├── configmap.yaml │ ├── service.yaml │ └── statefulset.yaml │ └── values.yaml └── src ├── en ├── 1.0-kubernetes.md ├── 1.1-install-kubernetes-with-minikube.md ├── 1.2-install-kubernetes-with-rancher.md ├── 1.4-k8s-starter.md ├── 2.0-tdengine-on-kubernetes.md ├── 2.1-tdengine-step-by-step.md ├── 2.2-tdengine-with-helm.md ├── README.md ├── SUMMARY.md └── assets │ ├── helm-drop-dnode.png │ ├── helm-install-post-script.png │ ├── helm-install-with-sc.png │ ├── helm-scale-up.png │ ├── kubectl-taos-sql.png │ ├── minikube-dashboard.png │ ├── minikube-start.png │ ├── rancher-dashboard.png │ ├── rancher-login-page.png │ └── tdengine-deploy-with-2rep.png ├── install ├── csi-config-map.yaml ├── csi-rbd-sc.yaml ├── csi-rbd-secret.yaml ├── csi-rbdplugin-provisioner.yaml ├── csi-rbdplugin.yaml ├── kms-config.yaml ├── pod.yaml ├── pvc.yaml ├── raw-block-pod.yaml └── raw-block-pvc.yaml ├── starter ├── config-map-as-volume.yaml ├── dnsutils.yaml └── stateful-nginx.yaml ├── tdengine ├── taosd-service.yaml ├── tdengine-delete.sh ├── tdengine-deployment.yaml └── tdengine.yaml └── zh ├── 1.0-kubernetes.md ├── 1.1-install-kubernetes-with-minikube.md ├── 1.2-install-kubernetes-with-rancher.md ├── 1.4-k8s-starter.md ├── 2.0-tdengine-on-kubernetes.md ├── 2.1-tdengine-step-by-step.md ├── 2.2-tdengine-with-helm.md ├── README.md ├── SUMMARY.md └── test.yaml /.github/workflows/rust.yml: -------------------------------------------------------------------------------- 1 | name: Rust 2 | 3 | on: 4 | push: 5 | branches: 6 | - main 7 | - 3.0 8 | - ci 9 | release: 10 | types: 11 | - created 12 | jobs: 13 | build: 14 | runs-on: ubuntu-20.04 15 | container: 16 | image: zitsen/mdbook 17 | options: --user root 18 | steps: 19 | - name: Checkout 20 | uses: actions/checkout@v1 21 | 22 | - name: Build 23 | run: mdbook build && cp ci/index.html book/ && touch book/.nojekyll && sed -i 's#\.\./\.\./en#../en#' book/zh/*.html 24 | 25 | - name: Publish 26 | uses: peaceiris/actions-gh-pages@v3 27 | with: 28 | github_token: ${{ secrets.GITHUB_TOKEN }} 29 | publish_dir: ./book 30 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | book 2 | /.idea 3 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU AFFERO GENERAL PUBLIC LICENSE 2 | Version 3, 19 November 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU Affero General Public License is a free, copyleft license for 11 | software and other kinds of works, specifically designed to ensure 12 | cooperation with the community in the case of network server software. 13 | 14 | The licenses for most software and other practical works are designed 15 | to take away your freedom to share and change the works. By contrast, 16 | our General Public Licenses are intended to guarantee your freedom to 17 | share and change all versions of a program--to make sure it remains free 18 | software for all its users. 19 | 20 | When we speak of free software, we are referring to freedom, not 21 | price. Our General Public Licenses are designed to make sure that you 22 | have the freedom to distribute copies of free software (and charge for 23 | them if you wish), that you receive source code or can get it if you 24 | want it, that you can change the software or use pieces of it in new 25 | free programs, and that you know you can do these things. 26 | 27 | Developers that use our General Public Licenses protect your rights 28 | with two steps: (1) assert copyright on the software, and (2) offer 29 | you this License which gives you legal permission to copy, distribute 30 | and/or modify the software. 31 | 32 | A secondary benefit of defending all users' freedom is that 33 | improvements made in alternate versions of the program, if they 34 | receive widespread use, become available for other developers to 35 | incorporate. Many developers of free software are heartened and 36 | encouraged by the resulting cooperation. However, in the case of 37 | software used on network servers, this result may fail to come about. 38 | The GNU General Public License permits making a modified version and 39 | letting the public access it on a server without ever releasing its 40 | source code to the public. 41 | 42 | The GNU Affero General Public License is designed specifically to 43 | ensure that, in such cases, the modified source code becomes available 44 | to the community. It requires the operator of a network server to 45 | provide the source code of the modified version running there to the 46 | users of that server. Therefore, public use of a modified version, on 47 | a publicly accessible server, gives the public access to the source 48 | code of the modified version. 49 | 50 | An older license, called the Affero General Public License and 51 | published by Affero, was designed to accomplish similar goals. This is 52 | a different license, not a version of the Affero GPL, but Affero has 53 | released a new version of the Affero GPL which permits relicensing under 54 | this license. 55 | 56 | The precise terms and conditions for copying, distribution and 57 | modification follow. 58 | 59 | TERMS AND CONDITIONS 60 | 61 | 0. Definitions. 62 | 63 | "This License" refers to version 3 of the GNU Affero General Public License. 64 | 65 | "Copyright" also means copyright-like laws that apply to other kinds of 66 | works, such as semiconductor masks. 67 | 68 | "The Program" refers to any copyrightable work licensed under this 69 | License. Each licensee is addressed as "you". "Licensees" and 70 | "recipients" may be individuals or organizations. 71 | 72 | To "modify" a work means to copy from or adapt all or part of the work 73 | in a fashion requiring copyright permission, other than the making of an 74 | exact copy. The resulting work is called a "modified version" of the 75 | earlier work or a work "based on" the earlier work. 76 | 77 | A "covered work" means either the unmodified Program or a work based 78 | on the Program. 79 | 80 | To "propagate" a work means to do anything with it that, without 81 | permission, would make you directly or secondarily liable for 82 | infringement under applicable copyright law, except executing it on a 83 | computer or modifying a private copy. Propagation includes copying, 84 | distribution (with or without modification), making available to the 85 | public, and in some countries other activities as well. 86 | 87 | To "convey" a work means any kind of propagation that enables other 88 | parties to make or receive copies. Mere interaction with a user through 89 | a computer network, with no transfer of a copy, is not conveying. 90 | 91 | An interactive user interface displays "Appropriate Legal Notices" 92 | to the extent that it includes a convenient and prominently visible 93 | feature that (1) displays an appropriate copyright notice, and (2) 94 | tells the user that there is no warranty for the work (except to the 95 | extent that warranties are provided), that licensees may convey the 96 | work under this License, and how to view a copy of this License. If 97 | the interface presents a list of user commands or options, such as a 98 | menu, a prominent item in the list meets this criterion. 99 | 100 | 1. Source Code. 101 | 102 | The "source code" for a work means the preferred form of the work 103 | for making modifications to it. "Object code" means any non-source 104 | form of a work. 105 | 106 | A "Standard Interface" means an interface that either is an official 107 | standard defined by a recognized standards body, or, in the case of 108 | interfaces specified for a particular programming language, one that 109 | is widely used among developers working in that language. 110 | 111 | The "System Libraries" of an executable work include anything, other 112 | than the work as a whole, that (a) is included in the normal form of 113 | packaging a Major Component, but which is not part of that Major 114 | Component, and (b) serves only to enable use of the work with that 115 | Major Component, or to implement a Standard Interface for which an 116 | implementation is available to the public in source code form. A 117 | "Major Component", in this context, means a major essential component 118 | (kernel, window system, and so on) of the specific operating system 119 | (if any) on which the executable work runs, or a compiler used to 120 | produce the work, or an object code interpreter used to run it. 121 | 122 | The "Corresponding Source" for a work in object code form means all 123 | the source code needed to generate, install, and (for an executable 124 | work) run the object code and to modify the work, including scripts to 125 | control those activities. However, it does not include the work's 126 | System Libraries, or general-purpose tools or generally available free 127 | programs which are used unmodified in performing those activities but 128 | which are not part of the work. For example, Corresponding Source 129 | includes interface definition files associated with source files for 130 | the work, and the source code for shared libraries and dynamically 131 | linked subprograms that the work is specifically designed to require, 132 | such as by intimate data communication or control flow between those 133 | subprograms and other parts of the work. 134 | 135 | The Corresponding Source need not include anything that users 136 | can regenerate automatically from other parts of the Corresponding 137 | Source. 138 | 139 | The Corresponding Source for a work in source code form is that 140 | same work. 141 | 142 | 2. Basic Permissions. 143 | 144 | All rights granted under this License are granted for the term of 145 | copyright on the Program, and are irrevocable provided the stated 146 | conditions are met. This License explicitly affirms your unlimited 147 | permission to run the unmodified Program. The output from running a 148 | covered work is covered by this License only if the output, given its 149 | content, constitutes a covered work. This License acknowledges your 150 | rights of fair use or other equivalent, as provided by copyright law. 151 | 152 | You may make, run and propagate covered works that you do not 153 | convey, without conditions so long as your license otherwise remains 154 | in force. You may convey covered works to others for the sole purpose 155 | of having them make modifications exclusively for you, or provide you 156 | with facilities for running those works, provided that you comply with 157 | the terms of this License in conveying all material for which you do 158 | not control copyright. Those thus making or running the covered works 159 | for you must do so exclusively on your behalf, under your direction 160 | and control, on terms that prohibit them from making any copies of 161 | your copyrighted material outside their relationship with you. 162 | 163 | Conveying under any other circumstances is permitted solely under 164 | the conditions stated below. Sublicensing is not allowed; section 10 165 | makes it unnecessary. 166 | 167 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 168 | 169 | No covered work shall be deemed part of an effective technological 170 | measure under any applicable law fulfilling obligations under article 171 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 172 | similar laws prohibiting or restricting circumvention of such 173 | measures. 174 | 175 | When you convey a covered work, you waive any legal power to forbid 176 | circumvention of technological measures to the extent such circumvention 177 | is effected by exercising rights under this License with respect to 178 | the covered work, and you disclaim any intention to limit operation or 179 | modification of the work as a means of enforcing, against the work's 180 | users, your or third parties' legal rights to forbid circumvention of 181 | technological measures. 182 | 183 | 4. Conveying Verbatim Copies. 184 | 185 | You may convey verbatim copies of the Program's source code as you 186 | receive it, in any medium, provided that you conspicuously and 187 | appropriately publish on each copy an appropriate copyright notice; 188 | keep intact all notices stating that this License and any 189 | non-permissive terms added in accord with section 7 apply to the code; 190 | keep intact all notices of the absence of any warranty; and give all 191 | recipients a copy of this License along with the Program. 192 | 193 | You may charge any price or no price for each copy that you convey, 194 | and you may offer support or warranty protection for a fee. 195 | 196 | 5. Conveying Modified Source Versions. 197 | 198 | You may convey a work based on the Program, or the modifications to 199 | produce it from the Program, in the form of source code under the 200 | terms of section 4, provided that you also meet all of these conditions: 201 | 202 | a) The work must carry prominent notices stating that you modified 203 | it, and giving a relevant date. 204 | 205 | b) The work must carry prominent notices stating that it is 206 | released under this License and any conditions added under section 207 | 7. This requirement modifies the requirement in section 4 to 208 | "keep intact all notices". 209 | 210 | c) You must license the entire work, as a whole, under this 211 | License to anyone who comes into possession of a copy. This 212 | License will therefore apply, along with any applicable section 7 213 | additional terms, to the whole of the work, and all its parts, 214 | regardless of how they are packaged. This License gives no 215 | permission to license the work in any other way, but it does not 216 | invalidate such permission if you have separately received it. 217 | 218 | d) If the work has interactive user interfaces, each must display 219 | Appropriate Legal Notices; however, if the Program has interactive 220 | interfaces that do not display Appropriate Legal Notices, your 221 | work need not make them do so. 222 | 223 | A compilation of a covered work with other separate and independent 224 | works, which are not by their nature extensions of the covered work, 225 | and which are not combined with it such as to form a larger program, 226 | in or on a volume of a storage or distribution medium, is called an 227 | "aggregate" if the compilation and its resulting copyright are not 228 | used to limit the access or legal rights of the compilation's users 229 | beyond what the individual works permit. Inclusion of a covered work 230 | in an aggregate does not cause this License to apply to the other 231 | parts of the aggregate. 232 | 233 | 6. Conveying Non-Source Forms. 234 | 235 | You may convey a covered work in object code form under the terms 236 | of sections 4 and 5, provided that you also convey the 237 | machine-readable Corresponding Source under the terms of this License, 238 | in one of these ways: 239 | 240 | a) Convey the object code in, or embodied in, a physical product 241 | (including a physical distribution medium), accompanied by the 242 | Corresponding Source fixed on a durable physical medium 243 | customarily used for software interchange. 244 | 245 | b) Convey the object code in, or embodied in, a physical product 246 | (including a physical distribution medium), accompanied by a 247 | written offer, valid for at least three years and valid for as 248 | long as you offer spare parts or customer support for that product 249 | model, to give anyone who possesses the object code either (1) a 250 | copy of the Corresponding Source for all the software in the 251 | product that is covered by this License, on a durable physical 252 | medium customarily used for software interchange, for a price no 253 | more than your reasonable cost of physically performing this 254 | conveying of source, or (2) access to copy the 255 | Corresponding Source from a network server at no charge. 256 | 257 | c) Convey individual copies of the object code with a copy of the 258 | written offer to provide the Corresponding Source. This 259 | alternative is allowed only occasionally and noncommercially, and 260 | only if you received the object code with such an offer, in accord 261 | with subsection 6b. 262 | 263 | d) Convey the object code by offering access from a designated 264 | place (gratis or for a charge), and offer equivalent access to the 265 | Corresponding Source in the same way through the same place at no 266 | further charge. You need not require recipients to copy the 267 | Corresponding Source along with the object code. If the place to 268 | copy the object code is a network server, the Corresponding Source 269 | may be on a different server (operated by you or a third party) 270 | that supports equivalent copying facilities, provided you maintain 271 | clear directions next to the object code saying where to find the 272 | Corresponding Source. Regardless of what server hosts the 273 | Corresponding Source, you remain obligated to ensure that it is 274 | available for as long as needed to satisfy these requirements. 275 | 276 | e) Convey the object code using peer-to-peer transmission, provided 277 | you inform other peers where the object code and Corresponding 278 | Source of the work are being offered to the general public at no 279 | charge under subsection 6d. 280 | 281 | A separable portion of the object code, whose source code is excluded 282 | from the Corresponding Source as a System Library, need not be 283 | included in conveying the object code work. 284 | 285 | A "User Product" is either (1) a "consumer product", which means any 286 | tangible personal property which is normally used for personal, family, 287 | or household purposes, or (2) anything designed or sold for incorporation 288 | into a dwelling. In determining whether a product is a consumer product, 289 | doubtful cases shall be resolved in favor of coverage. For a particular 290 | product received by a particular user, "normally used" refers to a 291 | typical or common use of that class of product, regardless of the status 292 | of the particular user or of the way in which the particular user 293 | actually uses, or expects or is expected to use, the product. A product 294 | is a consumer product regardless of whether the product has substantial 295 | commercial, industrial or non-consumer uses, unless such uses represent 296 | the only significant mode of use of the product. 297 | 298 | "Installation Information" for a User Product means any methods, 299 | procedures, authorization keys, or other information required to install 300 | and execute modified versions of a covered work in that User Product from 301 | a modified version of its Corresponding Source. The information must 302 | suffice to ensure that the continued functioning of the modified object 303 | code is in no case prevented or interfered with solely because 304 | modification has been made. 305 | 306 | If you convey an object code work under this section in, or with, or 307 | specifically for use in, a User Product, and the conveying occurs as 308 | part of a transaction in which the right of possession and use of the 309 | User Product is transferred to the recipient in perpetuity or for a 310 | fixed term (regardless of how the transaction is characterized), the 311 | Corresponding Source conveyed under this section must be accompanied 312 | by the Installation Information. But this requirement does not apply 313 | if neither you nor any third party retains the ability to install 314 | modified object code on the User Product (for example, the work has 315 | been installed in ROM). 316 | 317 | The requirement to provide Installation Information does not include a 318 | requirement to continue to provide support service, warranty, or updates 319 | for a work that has been modified or installed by the recipient, or for 320 | the User Product in which it has been modified or installed. Access to a 321 | network may be denied when the modification itself materially and 322 | adversely affects the operation of the network or violates the rules and 323 | protocols for communication across the network. 324 | 325 | Corresponding Source conveyed, and Installation Information provided, 326 | in accord with this section must be in a format that is publicly 327 | documented (and with an implementation available to the public in 328 | source code form), and must require no special password or key for 329 | unpacking, reading or copying. 330 | 331 | 7. Additional Terms. 332 | 333 | "Additional permissions" are terms that supplement the terms of this 334 | License by making exceptions from one or more of its conditions. 335 | Additional permissions that are applicable to the entire Program shall 336 | be treated as though they were included in this License, to the extent 337 | that they are valid under applicable law. If additional permissions 338 | apply only to part of the Program, that part may be used separately 339 | under those permissions, but the entire Program remains governed by 340 | this License without regard to the additional permissions. 341 | 342 | When you convey a copy of a covered work, you may at your option 343 | remove any additional permissions from that copy, or from any part of 344 | it. (Additional permissions may be written to require their own 345 | removal in certain cases when you modify the work.) You may place 346 | additional permissions on material, added by you to a covered work, 347 | for which you have or can give appropriate copyright permission. 348 | 349 | Notwithstanding any other provision of this License, for material you 350 | add to a covered work, you may (if authorized by the copyright holders of 351 | that material) supplement the terms of this License with terms: 352 | 353 | a) Disclaiming warranty or limiting liability differently from the 354 | terms of sections 15 and 16 of this License; or 355 | 356 | b) Requiring preservation of specified reasonable legal notices or 357 | author attributions in that material or in the Appropriate Legal 358 | Notices displayed by works containing it; or 359 | 360 | c) Prohibiting misrepresentation of the origin of that material, or 361 | requiring that modified versions of such material be marked in 362 | reasonable ways as different from the original version; or 363 | 364 | d) Limiting the use for publicity purposes of names of licensors or 365 | authors of the material; or 366 | 367 | e) Declining to grant rights under trademark law for use of some 368 | trade names, trademarks, or service marks; or 369 | 370 | f) Requiring indemnification of licensors and authors of that 371 | material by anyone who conveys the material (or modified versions of 372 | it) with contractual assumptions of liability to the recipient, for 373 | any liability that these contractual assumptions directly impose on 374 | those licensors and authors. 375 | 376 | All other non-permissive additional terms are considered "further 377 | restrictions" within the meaning of section 10. If the Program as you 378 | received it, or any part of it, contains a notice stating that it is 379 | governed by this License along with a term that is a further 380 | restriction, you may remove that term. If a license document contains 381 | a further restriction but permits relicensing or conveying under this 382 | License, you may add to a covered work material governed by the terms 383 | of that license document, provided that the further restriction does 384 | not survive such relicensing or conveying. 385 | 386 | If you add terms to a covered work in accord with this section, you 387 | must place, in the relevant source files, a statement of the 388 | additional terms that apply to those files, or a notice indicating 389 | where to find the applicable terms. 390 | 391 | Additional terms, permissive or non-permissive, may be stated in the 392 | form of a separately written license, or stated as exceptions; 393 | the above requirements apply either way. 394 | 395 | 8. Termination. 396 | 397 | You may not propagate or modify a covered work except as expressly 398 | provided under this License. Any attempt otherwise to propagate or 399 | modify it is void, and will automatically terminate your rights under 400 | this License (including any patent licenses granted under the third 401 | paragraph of section 11). 402 | 403 | However, if you cease all violation of this License, then your 404 | license from a particular copyright holder is reinstated (a) 405 | provisionally, unless and until the copyright holder explicitly and 406 | finally terminates your license, and (b) permanently, if the copyright 407 | holder fails to notify you of the violation by some reasonable means 408 | prior to 60 days after the cessation. 409 | 410 | Moreover, your license from a particular copyright holder is 411 | reinstated permanently if the copyright holder notifies you of the 412 | violation by some reasonable means, this is the first time you have 413 | received notice of violation of this License (for any work) from that 414 | copyright holder, and you cure the violation prior to 30 days after 415 | your receipt of the notice. 416 | 417 | Termination of your rights under this section does not terminate the 418 | licenses of parties who have received copies or rights from you under 419 | this License. If your rights have been terminated and not permanently 420 | reinstated, you do not qualify to receive new licenses for the same 421 | material under section 10. 422 | 423 | 9. Acceptance Not Required for Having Copies. 424 | 425 | You are not required to accept this License in order to receive or 426 | run a copy of the Program. Ancillary propagation of a covered work 427 | occurring solely as a consequence of using peer-to-peer transmission 428 | to receive a copy likewise does not require acceptance. However, 429 | nothing other than this License grants you permission to propagate or 430 | modify any covered work. These actions infringe copyright if you do 431 | not accept this License. Therefore, by modifying or propagating a 432 | covered work, you indicate your acceptance of this License to do so. 433 | 434 | 10. Automatic Licensing of Downstream Recipients. 435 | 436 | Each time you convey a covered work, the recipient automatically 437 | receives a license from the original licensors, to run, modify and 438 | propagate that work, subject to this License. You are not responsible 439 | for enforcing compliance by third parties with this License. 440 | 441 | An "entity transaction" is a transaction transferring control of an 442 | organization, or substantially all assets of one, or subdividing an 443 | organization, or merging organizations. If propagation of a covered 444 | work results from an entity transaction, each party to that 445 | transaction who receives a copy of the work also receives whatever 446 | licenses to the work the party's predecessor in interest had or could 447 | give under the previous paragraph, plus a right to possession of the 448 | Corresponding Source of the work from the predecessor in interest, if 449 | the predecessor has it or can get it with reasonable efforts. 450 | 451 | You may not impose any further restrictions on the exercise of the 452 | rights granted or affirmed under this License. For example, you may 453 | not impose a license fee, royalty, or other charge for exercise of 454 | rights granted under this License, and you may not initiate litigation 455 | (including a cross-claim or counterclaim in a lawsuit) alleging that 456 | any patent claim is infringed by making, using, selling, offering for 457 | sale, or importing the Program or any portion of it. 458 | 459 | 11. Patents. 460 | 461 | A "contributor" is a copyright holder who authorizes use under this 462 | License of the Program or a work on which the Program is based. The 463 | work thus licensed is called the contributor's "contributor version". 464 | 465 | A contributor's "essential patent claims" are all patent claims 466 | owned or controlled by the contributor, whether already acquired or 467 | hereafter acquired, that would be infringed by some manner, permitted 468 | by this License, of making, using, or selling its contributor version, 469 | but do not include claims that would be infringed only as a 470 | consequence of further modification of the contributor version. For 471 | purposes of this definition, "control" includes the right to grant 472 | patent sublicenses in a manner consistent with the requirements of 473 | this License. 474 | 475 | Each contributor grants you a non-exclusive, worldwide, royalty-free 476 | patent license under the contributor's essential patent claims, to 477 | make, use, sell, offer for sale, import and otherwise run, modify and 478 | propagate the contents of its contributor version. 479 | 480 | In the following three paragraphs, a "patent license" is any express 481 | agreement or commitment, however denominated, not to enforce a patent 482 | (such as an express permission to practice a patent or covenant not to 483 | sue for patent infringement). To "grant" such a patent license to a 484 | party means to make such an agreement or commitment not to enforce a 485 | patent against the party. 486 | 487 | If you convey a covered work, knowingly relying on a patent license, 488 | and the Corresponding Source of the work is not available for anyone 489 | to copy, free of charge and under the terms of this License, through a 490 | publicly available network server or other readily accessible means, 491 | then you must either (1) cause the Corresponding Source to be so 492 | available, or (2) arrange to deprive yourself of the benefit of the 493 | patent license for this particular work, or (3) arrange, in a manner 494 | consistent with the requirements of this License, to extend the patent 495 | license to downstream recipients. "Knowingly relying" means you have 496 | actual knowledge that, but for the patent license, your conveying the 497 | covered work in a country, or your recipient's use of the covered work 498 | in a country, would infringe one or more identifiable patents in that 499 | country that you have reason to believe are valid. 500 | 501 | If, pursuant to or in connection with a single transaction or 502 | arrangement, you convey, or propagate by procuring conveyance of, a 503 | covered work, and grant a patent license to some of the parties 504 | receiving the covered work authorizing them to use, propagate, modify 505 | or convey a specific copy of the covered work, then the patent license 506 | you grant is automatically extended to all recipients of the covered 507 | work and works based on it. 508 | 509 | A patent license is "discriminatory" if it does not include within 510 | the scope of its coverage, prohibits the exercise of, or is 511 | conditioned on the non-exercise of one or more of the rights that are 512 | specifically granted under this License. You may not convey a covered 513 | work if you are a party to an arrangement with a third party that is 514 | in the business of distributing software, under which you make payment 515 | to the third party based on the extent of your activity of conveying 516 | the work, and under which the third party grants, to any of the 517 | parties who would receive the covered work from you, a discriminatory 518 | patent license (a) in connection with copies of the covered work 519 | conveyed by you (or copies made from those copies), or (b) primarily 520 | for and in connection with specific products or compilations that 521 | contain the covered work, unless you entered into that arrangement, 522 | or that patent license was granted, prior to 28 March 2007. 523 | 524 | Nothing in this License shall be construed as excluding or limiting 525 | any implied license or other defenses to infringement that may 526 | otherwise be available to you under applicable patent law. 527 | 528 | 12. No Surrender of Others' Freedom. 529 | 530 | If conditions are imposed on you (whether by court order, agreement or 531 | otherwise) that contradict the conditions of this License, they do not 532 | excuse you from the conditions of this License. If you cannot convey a 533 | covered work so as to satisfy simultaneously your obligations under this 534 | License and any other pertinent obligations, then as a consequence you may 535 | not convey it at all. For example, if you agree to terms that obligate you 536 | to collect a royalty for further conveying from those to whom you convey 537 | the Program, the only way you could satisfy both those terms and this 538 | License would be to refrain entirely from conveying the Program. 539 | 540 | 13. Remote Network Interaction; Use with the GNU General Public License. 541 | 542 | Notwithstanding any other provision of this License, if you modify the 543 | Program, your modified version must prominently offer all users 544 | interacting with it remotely through a computer network (if your version 545 | supports such interaction) an opportunity to receive the Corresponding 546 | Source of your version by providing access to the Corresponding Source 547 | from a network server at no charge, through some standard or customary 548 | means of facilitating copying of software. This Corresponding Source 549 | shall include the Corresponding Source for any work covered by version 3 550 | of the GNU General Public License that is incorporated pursuant to the 551 | following paragraph. 552 | 553 | Notwithstanding any other provision of this License, you have 554 | permission to link or combine any covered work with a work licensed 555 | under version 3 of the GNU General Public License into a single 556 | combined work, and to convey the resulting work. The terms of this 557 | License will continue to apply to the part which is the covered work, 558 | but the work with which it is combined will remain governed by version 559 | 3 of the GNU General Public License. 560 | 561 | 14. Revised Versions of this License. 562 | 563 | The Free Software Foundation may publish revised and/or new versions of 564 | the GNU Affero General Public License from time to time. Such new versions 565 | will be similar in spirit to the present version, but may differ in detail to 566 | address new problems or concerns. 567 | 568 | Each version is given a distinguishing version number. If the 569 | Program specifies that a certain numbered version of the GNU Affero General 570 | Public License "or any later version" applies to it, you have the 571 | option of following the terms and conditions either of that numbered 572 | version or of any later version published by the Free Software 573 | Foundation. If the Program does not specify a version number of the 574 | GNU Affero General Public License, you may choose any version ever published 575 | by the Free Software Foundation. 576 | 577 | If the Program specifies that a proxy can decide which future 578 | versions of the GNU Affero General Public License can be used, that proxy's 579 | public statement of acceptance of a version permanently authorizes you 580 | to choose that version for the Program. 581 | 582 | Later license versions may give you additional or different 583 | permissions. However, no additional obligations are imposed on any 584 | author or copyright holder as a result of your choosing to follow a 585 | later version. 586 | 587 | 15. Disclaimer of Warranty. 588 | 589 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 590 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 591 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 592 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 593 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 594 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 595 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 596 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 597 | 598 | 16. Limitation of Liability. 599 | 600 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 601 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 602 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 603 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 604 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 605 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 606 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 607 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 608 | SUCH DAMAGES. 609 | 610 | 17. Interpretation of Sections 15 and 16. 611 | 612 | If the disclaimer of warranty and limitation of liability provided 613 | above cannot be given local legal effect according to their terms, 614 | reviewing courts shall apply local law that most closely approximates 615 | an absolute waiver of all civil liability in connection with the 616 | Program, unless a warranty or assumption of liability accompanies a 617 | copy of the Program in return for a fee. 618 | 619 | END OF TERMS AND CONDITIONS 620 | 621 | How to Apply These Terms to Your New Programs 622 | 623 | If you develop a new program, and you want it to be of the greatest 624 | possible use to the public, the best way to achieve this is to make it 625 | free software which everyone can redistribute and change under these terms. 626 | 627 | To do so, attach the following notices to the program. It is safest 628 | to attach them to the start of each source file to most effectively 629 | state the exclusion of warranty; and each file should have at least 630 | the "copyright" line and a pointer to where the full notice is found. 631 | 632 | 633 | Copyright (C) 634 | 635 | This program is free software: you can redistribute it and/or modify 636 | it under the terms of the GNU Affero General Public License as published 637 | by the Free Software Foundation, either version 3 of the License, or 638 | (at your option) any later version. 639 | 640 | This program is distributed in the hope that it will be useful, 641 | but WITHOUT ANY WARRANTY; without even the implied warranty of 642 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 643 | GNU Affero General Public License for more details. 644 | 645 | You should have received a copy of the GNU Affero General Public License 646 | along with this program. If not, see . 647 | 648 | Also add information on how to contact you by electronic and paper mail. 649 | 650 | If your software can interact with users remotely through a computer 651 | network, you should also make sure that it provides a way for users to 652 | get its source. For example, if your program is a web application, its 653 | interface could display a "Source" link that leads users to an archive 654 | of the code. There are many ways you could offer source, and different 655 | solutions will be better for different programs; see section 13 for the 656 | specific requirements. 657 | 658 | You should also get your employer (if you work as a programmer) or school, 659 | if any, to sign a "copyright disclaimer" for the program, if necessary. 660 | For more information on this, and how to apply and follow the GNU AGPL, see 661 | . 662 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | src/en/README.md -------------------------------------------------------------------------------- /book.toml: -------------------------------------------------------------------------------- 1 | [book] 2 | authors = ["Huo Linhe"] 3 | language = "en" 4 | src = "src" 5 | title = "Setup TDengine on Kubenetes from Scratch" 6 | 7 | [language.en] 8 | name = "English" 9 | default = true 10 | 11 | [language.zh] 12 | name = "简体中文" 13 | title = "在Kubenetes上部署TDengine集群" 14 | description = "从头安装Kubenetes并部署TDengine集群。" 15 | -------------------------------------------------------------------------------- /ci/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /docker/arbitrator/Dockerfile: -------------------------------------------------------------------------------- 1 | ARG VERSION 2 | ARG IMAGE_PREFIX=tdengine/tdengine 3 | ARG ARTIFACTS=${IMAGE_PREFIX}-artifacts:${VERSION} 4 | FROM ${ARTIFACTS} 5 | LABEL MAINTAINER="Huo Linhe " 6 | RUN ls /usr/src/ 7 | 8 | ARG IMAGE_PREFIX=tdengine/tdengine 9 | FROM ${IMAGE_PREFIX}-runtime 10 | 11 | COPY --from=0 /usr/src/TDengine-arbitrator* /usr/src/ 12 | RUN tar xf TDengine*-arbitrator*.tar.gz \ 13 | && cd TDengine*-arbitrator-*/ \ 14 | && ./install_arbi.sh \ 15 | && rm -rf TDengine* 16 | 17 | EXPOSE 6042/tcp 18 | 19 | WORKDIR /var/log/taos/ 20 | 21 | CMD ["tarbitrator"] 22 | 23 | ENTRYPOINT [ "/usr/bin/entrypoint.sh" ] 24 | -------------------------------------------------------------------------------- /docker/bailongma/Dockerfile: -------------------------------------------------------------------------------- 1 | ARG VERSION 2 | ARG IMAGE_PREFIX=tdengine/tdengine 3 | FROM ${IMAGE_PREFIX}-client:${VERSION} 4 | LABEL MAINTAINER="Huo Linhe " 5 | ARG BAILONGMA_VERSION 6 | ENV BAILONGMA_VERSION=${BAILONGMA_VERSION} 7 | COPY bin/* /usr/bin/ 8 | COPY bailongma-${BAILONGMA_VERSION} /usr/bin/bailongma 9 | ENTRYPOINT [ "/usr/bin/entrypoint.sh" ] 10 | CMD ["bailongma"] 11 | -------------------------------------------------------------------------------- /docker/bailongma/bailongma-0.2.2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/taosdata/TDengine-Operator/003111e2bb4a1503fbcf760159062017def15a0b/docker/bailongma/bailongma-0.2.2 -------------------------------------------------------------------------------- /docker/bailongma/bin/entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | if [ "$TZ" != "" ]; then 4 | ln -sf /usr/share/zoneinfo/$TZ /etc/localtime 5 | echo $TZ > /etc/timezone 6 | fi 7 | # write config to file 8 | env-to-cfg > /etc/taos/taos.cfg 9 | 10 | $@ 11 | -------------------------------------------------------------------------------- /docker/bailongma/bin/env-to-cfg: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | self=$0 3 | toCamelCase() { 4 | v=$1 5 | 6 | if [[ "$v" == *"_"* ]]; then 7 | v=$(echo $v | sed -r 's/([A-Za-z]+)_([A-Za-z])([A-Za-z]+)/\L\1\U\2\L\3/') 8 | while [ "$v" == *"_"* ]; do 9 | v=$(echo $v | sed -r 's/([A-Za-z]+)_([A-Za-z])([A-Za-z]+)/\1\U\2\L\3/g') 10 | done 11 | echo $v 12 | else 13 | echo $v | tr A-Z a-z 14 | fi 15 | } 16 | if [ "$1" == "" ]; then 17 | export |rg 'TAOS_.*' -o | sed 's/TAOS_//' | rargs -d "=" bash -c "name=\$($self {1});echo \$name {2}" 18 | else 19 | toCamelCase $1 20 | fi 21 | -------------------------------------------------------------------------------- /docker/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Default variables 4 | BASE_IMAGE=ubuntu:20.04 5 | DOCKER_PATH=$(dirname $0) 6 | NAMESPACE=${NAMESPACE:-tdengine} 7 | PREFIX=${PREFIX:-tdengine} 8 | BAILONGMA_VERSION=${BAILONGMA_VERSION:-0.2.2} 9 | PUSH=0 10 | USE_GIT=0 11 | 12 | # Parse options 13 | while getopts "pgv:n:P:h" opt; do 14 | case $opt in 15 | p) 16 | PUSH=1 17 | ;; 18 | g) 19 | USE_GIT=1 20 | ;; 21 | v) 22 | VERSION=$OPTARG 23 | ;; 24 | n) 25 | NAMESPACE=$OPTARG 26 | ;; 27 | P) 28 | PREFIX=$OPTARG 29 | ;; 30 | h) 31 | echo "Docker build scripts for TDengine images matrix." 32 | printf "Usage:\n\t" 33 | echo "$0 [-p] [-v ] [-n ] [-P ] [-h]" 34 | exit 0 35 | ;; 36 | ?) 37 | echo "there is unrecognized parameter." [$*] 38 | exit 1 39 | ;; 40 | esac 41 | done 42 | 43 | IMAGE_PREFIX=${NAMESPACE}/$PREFIX 44 | if [ "$VERSION" = "" ]; then 45 | echo "VERSION variable must be setted!" 46 | exit 1 47 | fi 48 | 49 | cd $DOCKER_PATH 50 | cd builder 51 | 52 | #[ -e "ver-$VERSION.tar.gz" ] || wget -c https://github.com/taosdata/TDengine/archive/refs/tags/ver-$VERSION.tar.gz 53 | 54 | ORIG_VERSION=$VERSION 55 | VERSION=${VERSION%-beta} 56 | docker build \ 57 | --build-arg BASE_IMAGE=$BASE_IMAGE \ 58 | --build-arg VERSION=$ORIG_VERSION \ 59 | -t $IMAGE_PREFIX-artifacts:$VERSION . 60 | cd .. 61 | cd runtime 62 | docker build \ 63 | --build-arg BASE_IMAGE=$BASE_IMAGE \ 64 | -t $IMAGE_PREFIX-runtime . 65 | cd .. 66 | cd server 67 | docker build \ 68 | --build-arg IMAGE_PREFIX=$IMAGE_PREFIX \ 69 | --build-arg VERSION=$VERSION \ 70 | -t $IMAGE_PREFIX-server:$VERSION . 71 | cd .. 72 | 73 | cd arbitrator 74 | docker build \ 75 | --build-arg IMAGE_PREFIX=$IMAGE_PREFIX \ 76 | --build-arg VERSION=$VERSION \ 77 | -t $IMAGE_PREFIX-arbitrator:$VERSION . 78 | cd .. 79 | 80 | cd client 81 | docker build \ 82 | --build-arg IMAGE_PREFIX=$IMAGE_PREFIX \ 83 | --build-arg VERSION=$VERSION \ 84 | -t $IMAGE_PREFIX-client:$VERSION . 85 | cd .. 86 | 87 | cd bailongma 88 | [ -e "bailongma-$BAILONGMA_VERSION" ] || wget -c -O bailongma-$BAILONGMA_VERSION https://github.com/taosdata/bailongma-rs/releases/download/v${BAILONGMA_VERSION}/bailongma-amd64 89 | chmod +x bailongma-$BAILONGMA_VERSION 90 | docker build \ 91 | --build-arg IMAGE_PREFIX=$IMAGE_PREFIX \ 92 | --build-arg VERSION=$VERSION \ 93 | --build-arg BAILONGMA_VERSION=$BAILONGMA_VERSION \ 94 | -t $IMAGE_PREFIX-bailongma:$VERSION-v$BAILONGMA_VERSION . 95 | docker tag $IMAGE_PREFIX-bailongma:$VERSION-v$BAILONGMA_VERSION $IMAGE_PREFIX-bailongma:$VERSION 96 | cd .. 97 | 98 | if [ $PUSH -eq 1 ]; then 99 | docker push $IMAGE_PREFIX-artifacts:$VERSION 100 | docker push $IMAGE_PREFIX-server:$VERSION 101 | docker push $IMAGE_PREFIX-arbitrator:$VERSION 102 | docker push $IMAGE_PREFIX-client:$VERSION 103 | docker push $IMAGE_PREFIX-bailongma:$VERSION 104 | docker push $IMAGE_PREFIX-bailongma:$VERSION-v$BAILONGMA_VERSION 105 | fi 106 | -------------------------------------------------------------------------------- /docker/builder/Dockerfile: -------------------------------------------------------------------------------- 1 | ARG BASE_IMAGE=ubuntu:20.04 2 | FROM ${BASE_IMAGE} 3 | LABEL MAINTAINER="Huo Linhe " 4 | 5 | ARG APT_MIRROR=http://mirrors.aliyun.com 6 | ENV DEBIAN_FRONTEND=noninteractive 7 | RUN sed -Ei "s#http://.*.ubuntu.com#${APT_MIRROR}#" /etc/apt/sources.list \ 8 | && apt-get update \ 9 | && apt-get install -y build-essential cmake wget git\ 10 | && apt-get clean 11 | 12 | ARG VERSION 13 | WORKDIR /tmp/ 14 | RUN wget -c https://www.taosdata.com/assets-download/TDengine-server-$VERSION-Linux-x64.tar.gz 15 | RUN wget -c https://www.taosdata.com/assets-download/TDengine-client-$VERSION-Linux-x64.tar.gz 16 | RUN wget -c https://www.taosdata.com/assets-download/TDengine-arbitrator-$VERSION-Linux-x64.tar.gz 17 | 18 | FROM alpine:3 19 | LABEL MAINTAINER="Huo Linhe " 20 | 21 | ARG VERSION 22 | ENV VERSION=${VERSION} 23 | WORKDIR /usr/src/ 24 | COPY --from=0 /tmp/TDengine-* /usr/src/ 25 | -------------------------------------------------------------------------------- /docker/builder/back: -------------------------------------------------------------------------------- 1 | FROM ubuntu:20.04 2 | ARG APT_MIRROR=http://mirrors.aliyun.com 3 | RUN sed -Ei "s#http://.*.ubuntu.com#${APT_MIRROR}#" /etc/apt/sources.list \ 4 | && apt-get update \ 5 | && DEBIAN_FRONTEND=noninteractive apt-get install -y build-essential cmake wget git \ 6 | && apt-get clean 7 | 8 | ARG VERSION 9 | WORKDIR /tmp 10 | COPY ${VERSION}.tar.gz /tmp/ 11 | RUN tar xf ${VERSION}.tar.gz \ 12 | && cd TDengine-${VERSION}/ \ 13 | && export TD_VER_NUMBER=`grep 'TD_VER_NUMBER "' \ 14 | cmake/version.inc |sed -E 's/[^.0-9]//g'` \ 15 | && echo $TD_VER_NUMBER \ 16 | && sed 's#set -e##' -i packaging/release.sh \ 17 | && ./packaging/release.sh -n $TD_VER_NUMBER -l lite -V stable 18 | 19 | FROM ubuntu:20.04 20 | ARG APT_MIRROR=http://mirrors.aliyun.com 21 | ARG VERSION 22 | ENV TDENGINE_VERSION=${VERSION} 23 | WORKDIR /usr/src/ 24 | RUN sed -Ei "s#http://.*.ubuntu.com#${APT_MIRROR}#" /etc/apt/sources.list \ 25 | && apt-get update \ 26 | && DEBIAN_FRONTEND=noninteractive \ 27 | apt-get install -y locales tzdata curl \ 28 | && locale-gen en_US.UTF-8 \ 29 | && apt-get clean 30 | ENV LC_ALL=en_US.UTF-8 31 | ENV LANG=en_US.UTF-8 32 | ENV LANGUAGE=en_US.UTF-8 33 | COPY third-party/* /usr/bin/ 34 | 35 | COPY --from=0 /tmp/TDengine-${VERSION}/release/TDengine-server* /usr/src/ 36 | RUN tar xf TDengine-server*.tar.gz && cd TDengine-server-*/ && ./install.sh -e no 37 | RUN rm -rf TDengine* 38 | 39 | COPY bin/* /usr/bin/ 40 | 41 | WORKDIR /etc/taos 42 | EXPOSE 6030 6031 6032 6033 6034 6035 6036 6037 6038 6039 6040 6041 6042 43 | CMD ["taosd"] 44 | VOLUME [ "/var/lib/taos", "/var/log/taos" ] 45 | ENTRYPOINT [ "/usr/bin/entrypoint.sh" ] -------------------------------------------------------------------------------- /docker/builder/script/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -ex 3 | if [ "$VERSION" = "" ]; then 4 | VERSION=develop 5 | fi 6 | TD_VERSION= 7 | URL_PREFIX=https://github.com/taosdata/TDengine/archive/refs 8 | if [[ $VERSION =~ ^[[:alpha:]] ]]; then 9 | URL=$URL_PREFIX/heads/$VERSION.tar.gz 10 | else 11 | URL=$URL_PREFIX/tags/ver-$VERSION.tar.gz 12 | TD_VERSION=$VERSION 13 | VERSION=ver-$VERSION 14 | fi 15 | 16 | #wget -c -O $VERSION.tar.gz -c $URL 17 | tar xf $VERSION.tar.gz 18 | cd TDengine-${VERSION}/ 19 | if [ "$TD_VERSION" = "" ]; then 20 | TD_VERSION=`grep 'TD_VER_NUMBER "' \ 21 | cmake/version.inc |sed -E 's/[^.0-9]//g'` 22 | fi 23 | echo "Build TDengine version" $TD_VERSION 24 | sed 's#set -e##' -i packaging/release.sh 25 | ./packaging/release.sh -n $TD_VERSION -l lite -V stable 26 | -------------------------------------------------------------------------------- /docker/client/Dockerfile: -------------------------------------------------------------------------------- 1 | ARG VERSION 2 | ARG IMAGE_PREFIX=tdengine/tdengine 3 | ARG ARTIFACTS=${IMAGE_PREFIX}-artifacts:${VERSION} 4 | FROM ${ARTIFACTS} 5 | LABEL MAINTAINER="Huo Linhe " 6 | RUN ls /usr/src/ 7 | 8 | ARG IMAGE_PREFIX=tdengine/tdengine 9 | FROM ${IMAGE_PREFIX}-runtime 10 | ARG VERSION 11 | ENV VERSION=${VERSION} 12 | COPY --from=0 /usr/src/TDengine-client* /usr/src/ 13 | RUN tar xf TDengine-client*.tar.gz && cd TDengine-client-*/ && ./install_client.sh 14 | RUN rm -rf TDengine* 15 | -------------------------------------------------------------------------------- /docker/mdbook/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM rust:1.53.0-slim 2 | RUN cargo install --git https://github.com/Ruin0x11/mdBook.git --branch localization mdbook -------------------------------------------------------------------------------- /docker/runtime/Dockerfile: -------------------------------------------------------------------------------- 1 | ARG BASE_IMAGE=ubuntu:20.04 2 | FROM ${BASE_IMAGE} 3 | ARG APT_MIRROR=http://mirrors.aliyun.com 4 | ENV DEBIAN_FRONTEND=noninteractive 5 | WORKDIR /usr/src/ 6 | RUN sed -Ei "s#http://.*.ubuntu.com#${APT_MIRROR}#" /etc/apt/sources.list \ 7 | && apt-get update \ 8 | && apt-get install -y locales tzdata curl wget net-tools iproute2 gdb \ 9 | dmidecode iputils-ping sysstat binutils telnet\ 10 | && locale-gen en_US.UTF-8 \ 11 | && apt-get clean 12 | ENV LC_ALL=en_US.UTF-8 13 | ENV LANG=en_US.UTF-8 14 | ENV LANGUAGE=en_US.UTF-8 15 | COPY bin/* /usr/bin/ 16 | -------------------------------------------------------------------------------- /docker/runtime/bin/entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | # for TZ awareness 4 | if [ "$TZ" != "" ]; then 5 | ln -sf /usr/share/zoneinfo/$TZ /etc/localtime 6 | echo $TZ >/etc/timezone 7 | fi 8 | 9 | # option to disable taosadapter, default is no 10 | DISABLE_ADAPTER=${TAOS_DISABLE_ADAPTER:-0} 11 | unset TAOS_DISABLE_ADAPTER 12 | 13 | # to get mnodeEpSet from data dir 14 | DATA_DIR=${TAOS_DATA_DIR:-/var/lib/taos} 15 | 16 | # append env to custom taos.cfg 17 | CFG_DIR=/tmp/taos 18 | CFG_FILE=$CFG_DIR/taos.cfg 19 | 20 | mkdir -p $CFG_DIR >/dev/null 2>&1 21 | 22 | [ -f /etc/taos/taos.cfg ] && cat /etc/taos/taos.cfg | grep -E -v "^#|^\s*$" >$CFG_FILE 23 | env-to-cfg >>$CFG_FILE 24 | 25 | FQDN=$(cat $CFG_FILE | grep -E -v "^#|^$" | grep fqdn | tail -n1 | sed -E 's/.*fqdn\s+//') 26 | 27 | # ensure the fqdn is resolved as localhost 28 | grep "$FQDN" /etc/hosts >/dev/null || echo "127.0.0.1 $FQDN" >>/etc/hosts 29 | 30 | # parse first ep host and port 31 | FIRST_EP_HOST=${TAOS_FIRST_EP%:*} 32 | FIRST_EP_PORT=${TAOS_FIRST_EP#*:} 33 | 34 | # in case of custom server port 35 | SERVER_PORT=$(cat $CFG_FILE | grep -E -v "^#|^$" | grep serverPort | tail -n1 | sed -E 's/.*serverPort\s+//') 36 | SERVER_PORT=${SERVER_PORT:-6030} 37 | 38 | # for other binaries like interpreters 39 | if echo $1 | grep -E "taosd$" - >/dev/null; then 40 | true # will run taosd 41 | else 42 | $@ 43 | exit 44 | fi 45 | 46 | set +e 47 | ulimit -c unlimited 48 | # set core files pattern, maybe failed 49 | sysctl -w kernel.core_pattern=/corefile/core-%e-%p >/dev/null >&1 50 | set -e 51 | 52 | if [ "$DISABLE_ADAPTER" = "0" ]; then 53 | which taosadapter >/dev/null && taosadapter & 54 | # wait for 6041 port ready 55 | for _ in $(seq 1 20); do 56 | nc -z localhost 6041 && break 57 | sleep 0.5 58 | done 59 | fi 60 | 61 | # if has mnode ep set or the host is first ep or not for cluster, just start. 62 | if [ -f "$DATA_DIR/dnode/mnodeEpSet.json" ] || 63 | [ "$TAOS_FQDN" = "$FIRST_EP_HOST" ]; then 64 | $@ -c $CFG_DIR 65 | # others will first wait the first ep ready. 66 | else 67 | if [ "$TAOS_FIRST_EP" = "" ]; then 68 | echo "TAOS_FIRST_EP must be setted in cluster" 69 | exit 70 | fi 71 | while true; do 72 | es=0 73 | taos -h $FIRST_EP_HOST -P $FIRST_EP_PORT -n startup >/dev/null || es=$? 74 | if [ "$es" -eq 0 ]; then 75 | taos -h $FIRST_EP_HOST -P $FIRST_EP_PORT -s "create dnode \"$FQDN:$SERVER_PORT\";" 76 | break 77 | fi 78 | sleep 1s 79 | done 80 | $@ -c $CFG_DIR 81 | fi 82 | -------------------------------------------------------------------------------- /docker/runtime/bin/env-to-cfg: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | self=$0 4 | 5 | snake_to_camel_case() { 6 | echo $1 | awk -F _ '{printf "%s", $1; for(i=2; i<=NF; i++) printf "%s", toupper(substr($i,1,1)) substr($i,2); print"";}' 7 | } 8 | 9 | if echo $1 | grep -E "^$" - >/dev/null; then 10 | export |grep -E 'TAOS_.*' -o| sed 's/TAOS_//' |tr A-Z a-z | awk -F"=" '{print "name=$(""'$self' " $1"); echo $name "$2}' |sh 11 | else 12 | snake_to_camel_case $1 13 | fi 14 | -------------------------------------------------------------------------------- /docker/server/Dockerfile: -------------------------------------------------------------------------------- 1 | ARG VERSION 2 | ARG IMAGE_PREFIX=tdengine/tdengine 3 | ARG ARTIFACTS=${IMAGE_PREFIX}-artifacts:${VERSION} 4 | FROM ${ARTIFACTS} 5 | LABEL MAINTAINER="Huo Linhe " 6 | RUN ls /usr/src/ 7 | 8 | ARG IMAGE_PREFIX=tdengine/tdengine 9 | FROM ${IMAGE_PREFIX}-runtime 10 | 11 | COPY --from=0 /usr/src/TDengine-server* /usr/src/ 12 | RUN tar xf TDengine-server*.tar.gz && cd TDengine-server-*/ && ./install.sh -e no 13 | RUN rm -rf TDengine* 14 | 15 | WORKDIR /etc/taos 16 | EXPOSE 6030 6031 6032 6033 6034 6035 6036 6037 6038 6039 6040 6041 6042 17 | CMD ["taosd"] 18 | VOLUME [ "/var/lib/taos", "/var/log/taos", "/corefile" ] 19 | ENTRYPOINT [ "/usr/bin/entrypoint.sh" ] 20 | -------------------------------------------------------------------------------- /docker/test/docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: "3" 2 | 3 | services: 4 | arbitrator: 5 | image: zitsen/tdengine-arbitrator:2.3.5.0 6 | td-1: 7 | image: zitsen/tdengine-server:2.3.5.0 8 | environment: 9 | TAOS_FQDN: "td-1" 10 | TAOS_FIRST_EP: "td-1" 11 | TAOS_REPLICA: "2" 12 | TAOS_ARBITRATOR: arbitrator:6042 13 | volumes: 14 | - taosdata-td1:/var/lib/taos/ 15 | td-2: 16 | image: zitsen/tdengine-server:2.3.5.0 17 | environment: 18 | TAOS_FQDN: "td-2" 19 | TAOS_FIRST_EP: "td-1" 20 | TAOS_REPLICA: "2" 21 | TAOS_ARBITRATOR: arbitrator:6042 22 | volumes: 23 | - taosdata-td2:/var/lib/taos/ 24 | volumes: 25 | taosdata-td1: 26 | taosdata-td2: 27 | -------------------------------------------------------------------------------- /helm/tdengine-0.2.0.tgz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/taosdata/TDengine-Operator/003111e2bb4a1503fbcf760159062017def15a0b/helm/tdengine-0.2.0.tgz -------------------------------------------------------------------------------- /helm/tdengine-0.2.1.tgz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/taosdata/TDengine-Operator/003111e2bb4a1503fbcf760159062017def15a0b/helm/tdengine-0.2.1.tgz -------------------------------------------------------------------------------- /helm/tdengine-0.3.0.tgz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/taosdata/TDengine-Operator/003111e2bb4a1503fbcf760159062017def15a0b/helm/tdengine-0.3.0.tgz -------------------------------------------------------------------------------- /helm/tdengine-3.0.0.tgz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/taosdata/TDengine-Operator/003111e2bb4a1503fbcf760159062017def15a0b/helm/tdengine-3.0.0.tgz -------------------------------------------------------------------------------- /helm/tdengine-3.0.2.tgz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/taosdata/TDengine-Operator/003111e2bb4a1503fbcf760159062017def15a0b/helm/tdengine-3.0.2.tgz -------------------------------------------------------------------------------- /helm/tdengine-3.5.0.tgz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/taosdata/TDengine-Operator/003111e2bb4a1503fbcf760159062017def15a0b/helm/tdengine-3.5.0.tgz -------------------------------------------------------------------------------- /helm/tdengine-enterprise-3.5.0.tgz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/taosdata/TDengine-Operator/003111e2bb4a1503fbcf760159062017def15a0b/helm/tdengine-enterprise-3.5.0.tgz -------------------------------------------------------------------------------- /helm/tdengine/.helmignore: -------------------------------------------------------------------------------- 1 | # Patterns to ignore when building packages. 2 | # This supports shell glob matching, relative path matching, and 3 | # negation (prefixed with !). Only one pattern per line. 4 | .DS_Store 5 | # Common VCS dirs 6 | .git/ 7 | .gitignore 8 | .bzr/ 9 | .bzrignore 10 | .hg/ 11 | .hgignore 12 | .svn/ 13 | # Common backup files 14 | *.swp 15 | *.bak 16 | *.tmp 17 | *.orig 18 | *~ 19 | # Various IDEs 20 | .project 21 | .idea/ 22 | *.tmproj 23 | .vscode/ 24 | -------------------------------------------------------------------------------- /helm/tdengine/Chart.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v2 2 | name: tdengine 3 | description: TDengine Cluster Chart for Kubenetes 4 | 5 | maintainers: 6 | - name: "Huo Linhe" 7 | email: "linhe.huo@gmail.com" 8 | url: "https://github.com/zitsen" 9 | # A chart can be either an 'application' or a 'library' chart. 10 | # 11 | # Application charts are a collection of templates that can be packaged into versioned archives 12 | # to be deployed. 13 | # 14 | # Library charts provide useful utilities or functions for the chart developer. They're included as 15 | # a dependency of application charts to inject those utilities and functions into the rendering 16 | # pipeline. Library charts do not define any templates and therefore cannot be deployed. 17 | type: application 18 | 19 | # This is the chart version. This version number should be incremented each time you make changes 20 | # to the chart and its templates, including the app version. 21 | # Versions are expected to follow Semantic Versioning (https://semver.org/) 22 | version: 3.0.2 23 | 24 | # This is the version number of the application being deployed. This version number should be 25 | # incremented each time you make changes to the application. Versions are not expected to 26 | # follow Semantic Versioning. They should reflect the version the application is using. 27 | # It is recommended to use it with quotes. 28 | appVersion: "3.0.2.2" 29 | 30 | icon: "https://www.taosdata.com/images/taosdata-logo.png" 31 | 32 | -------------------------------------------------------------------------------- /helm/tdengine/LICENSE: -------------------------------------------------------------------------------- 1 | GNU AFFERO GENERAL PUBLIC LICENSE 2 | Version 3, 19 November 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU Affero General Public License is a free, copyleft license for 11 | software and other kinds of works, specifically designed to ensure 12 | cooperation with the community in the case of network server software. 13 | 14 | The licenses for most software and other practical works are designed 15 | to take away your freedom to share and change the works. By contrast, 16 | our General Public Licenses are intended to guarantee your freedom to 17 | share and change all versions of a program--to make sure it remains free 18 | software for all its users. 19 | 20 | When we speak of free software, we are referring to freedom, not 21 | price. Our General Public Licenses are designed to make sure that you 22 | have the freedom to distribute copies of free software (and charge for 23 | them if you wish), that you receive source code or can get it if you 24 | want it, that you can change the software or use pieces of it in new 25 | free programs, and that you know you can do these things. 26 | 27 | Developers that use our General Public Licenses protect your rights 28 | with two steps: (1) assert copyright on the software, and (2) offer 29 | you this License which gives you legal permission to copy, distribute 30 | and/or modify the software. 31 | 32 | A secondary benefit of defending all users' freedom is that 33 | improvements made in alternate versions of the program, if they 34 | receive widespread use, become available for other developers to 35 | incorporate. Many developers of free software are heartened and 36 | encouraged by the resulting cooperation. However, in the case of 37 | software used on network servers, this result may fail to come about. 38 | The GNU General Public License permits making a modified version and 39 | letting the public access it on a server without ever releasing its 40 | source code to the public. 41 | 42 | The GNU Affero General Public License is designed specifically to 43 | ensure that, in such cases, the modified source code becomes available 44 | to the community. It requires the operator of a network server to 45 | provide the source code of the modified version running there to the 46 | users of that server. Therefore, public use of a modified version, on 47 | a publicly accessible server, gives the public access to the source 48 | code of the modified version. 49 | 50 | An older license, called the Affero General Public License and 51 | published by Affero, was designed to accomplish similar goals. This is 52 | a different license, not a version of the Affero GPL, but Affero has 53 | released a new version of the Affero GPL which permits relicensing under 54 | this license. 55 | 56 | The precise terms and conditions for copying, distribution and 57 | modification follow. 58 | 59 | TERMS AND CONDITIONS 60 | 61 | 0. Definitions. 62 | 63 | "This License" refers to version 3 of the GNU Affero General Public License. 64 | 65 | "Copyright" also means copyright-like laws that apply to other kinds of 66 | works, such as semiconductor masks. 67 | 68 | "The Program" refers to any copyrightable work licensed under this 69 | License. Each licensee is addressed as "you". "Licensees" and 70 | "recipients" may be individuals or organizations. 71 | 72 | To "modify" a work means to copy from or adapt all or part of the work 73 | in a fashion requiring copyright permission, other than the making of an 74 | exact copy. The resulting work is called a "modified version" of the 75 | earlier work or a work "based on" the earlier work. 76 | 77 | A "covered work" means either the unmodified Program or a work based 78 | on the Program. 79 | 80 | To "propagate" a work means to do anything with it that, without 81 | permission, would make you directly or secondarily liable for 82 | infringement under applicable copyright law, except executing it on a 83 | computer or modifying a private copy. Propagation includes copying, 84 | distribution (with or without modification), making available to the 85 | public, and in some countries other activities as well. 86 | 87 | To "convey" a work means any kind of propagation that enables other 88 | parties to make or receive copies. Mere interaction with a user through 89 | a computer network, with no transfer of a copy, is not conveying. 90 | 91 | An interactive user interface displays "Appropriate Legal Notices" 92 | to the extent that it includes a convenient and prominently visible 93 | feature that (1) displays an appropriate copyright notice, and (2) 94 | tells the user that there is no warranty for the work (except to the 95 | extent that warranties are provided), that licensees may convey the 96 | work under this License, and how to view a copy of this License. If 97 | the interface presents a list of user commands or options, such as a 98 | menu, a prominent item in the list meets this criterion. 99 | 100 | 1. Source Code. 101 | 102 | The "source code" for a work means the preferred form of the work 103 | for making modifications to it. "Object code" means any non-source 104 | form of a work. 105 | 106 | A "Standard Interface" means an interface that either is an official 107 | standard defined by a recognized standards body, or, in the case of 108 | interfaces specified for a particular programming language, one that 109 | is widely used among developers working in that language. 110 | 111 | The "System Libraries" of an executable work include anything, other 112 | than the work as a whole, that (a) is included in the normal form of 113 | packaging a Major Component, but which is not part of that Major 114 | Component, and (b) serves only to enable use of the work with that 115 | Major Component, or to implement a Standard Interface for which an 116 | implementation is available to the public in source code form. A 117 | "Major Component", in this context, means a major essential component 118 | (kernel, window system, and so on) of the specific operating system 119 | (if any) on which the executable work runs, or a compiler used to 120 | produce the work, or an object code interpreter used to run it. 121 | 122 | The "Corresponding Source" for a work in object code form means all 123 | the source code needed to generate, install, and (for an executable 124 | work) run the object code and to modify the work, including scripts to 125 | control those activities. However, it does not include the work's 126 | System Libraries, or general-purpose tools or generally available free 127 | programs which are used unmodified in performing those activities but 128 | which are not part of the work. For example, Corresponding Source 129 | includes interface definition files associated with source files for 130 | the work, and the source code for shared libraries and dynamically 131 | linked subprograms that the work is specifically designed to require, 132 | such as by intimate data communication or control flow between those 133 | subprograms and other parts of the work. 134 | 135 | The Corresponding Source need not include anything that users 136 | can regenerate automatically from other parts of the Corresponding 137 | Source. 138 | 139 | The Corresponding Source for a work in source code form is that 140 | same work. 141 | 142 | 2. Basic Permissions. 143 | 144 | All rights granted under this License are granted for the term of 145 | copyright on the Program, and are irrevocable provided the stated 146 | conditions are met. This License explicitly affirms your unlimited 147 | permission to run the unmodified Program. The output from running a 148 | covered work is covered by this License only if the output, given its 149 | content, constitutes a covered work. This License acknowledges your 150 | rights of fair use or other equivalent, as provided by copyright law. 151 | 152 | You may make, run and propagate covered works that you do not 153 | convey, without conditions so long as your license otherwise remains 154 | in force. You may convey covered works to others for the sole purpose 155 | of having them make modifications exclusively for you, or provide you 156 | with facilities for running those works, provided that you comply with 157 | the terms of this License in conveying all material for which you do 158 | not control copyright. Those thus making or running the covered works 159 | for you must do so exclusively on your behalf, under your direction 160 | and control, on terms that prohibit them from making any copies of 161 | your copyrighted material outside their relationship with you. 162 | 163 | Conveying under any other circumstances is permitted solely under 164 | the conditions stated below. Sublicensing is not allowed; section 10 165 | makes it unnecessary. 166 | 167 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 168 | 169 | No covered work shall be deemed part of an effective technological 170 | measure under any applicable law fulfilling obligations under article 171 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 172 | similar laws prohibiting or restricting circumvention of such 173 | measures. 174 | 175 | When you convey a covered work, you waive any legal power to forbid 176 | circumvention of technological measures to the extent such circumvention 177 | is effected by exercising rights under this License with respect to 178 | the covered work, and you disclaim any intention to limit operation or 179 | modification of the work as a means of enforcing, against the work's 180 | users, your or third parties' legal rights to forbid circumvention of 181 | technological measures. 182 | 183 | 4. Conveying Verbatim Copies. 184 | 185 | You may convey verbatim copies of the Program's source code as you 186 | receive it, in any medium, provided that you conspicuously and 187 | appropriately publish on each copy an appropriate copyright notice; 188 | keep intact all notices stating that this License and any 189 | non-permissive terms added in accord with section 7 apply to the code; 190 | keep intact all notices of the absence of any warranty; and give all 191 | recipients a copy of this License along with the Program. 192 | 193 | You may charge any price or no price for each copy that you convey, 194 | and you may offer support or warranty protection for a fee. 195 | 196 | 5. Conveying Modified Source Versions. 197 | 198 | You may convey a work based on the Program, or the modifications to 199 | produce it from the Program, in the form of source code under the 200 | terms of section 4, provided that you also meet all of these conditions: 201 | 202 | a) The work must carry prominent notices stating that you modified 203 | it, and giving a relevant date. 204 | 205 | b) The work must carry prominent notices stating that it is 206 | released under this License and any conditions added under section 207 | 7. This requirement modifies the requirement in section 4 to 208 | "keep intact all notices". 209 | 210 | c) You must license the entire work, as a whole, under this 211 | License to anyone who comes into possession of a copy. This 212 | License will therefore apply, along with any applicable section 7 213 | additional terms, to the whole of the work, and all its parts, 214 | regardless of how they are packaged. This License gives no 215 | permission to license the work in any other way, but it does not 216 | invalidate such permission if you have separately received it. 217 | 218 | d) If the work has interactive user interfaces, each must display 219 | Appropriate Legal Notices; however, if the Program has interactive 220 | interfaces that do not display Appropriate Legal Notices, your 221 | work need not make them do so. 222 | 223 | A compilation of a covered work with other separate and independent 224 | works, which are not by their nature extensions of the covered work, 225 | and which are not combined with it such as to form a larger program, 226 | in or on a volume of a storage or distribution medium, is called an 227 | "aggregate" if the compilation and its resulting copyright are not 228 | used to limit the access or legal rights of the compilation's users 229 | beyond what the individual works permit. Inclusion of a covered work 230 | in an aggregate does not cause this License to apply to the other 231 | parts of the aggregate. 232 | 233 | 6. Conveying Non-Source Forms. 234 | 235 | You may convey a covered work in object code form under the terms 236 | of sections 4 and 5, provided that you also convey the 237 | machine-readable Corresponding Source under the terms of this License, 238 | in one of these ways: 239 | 240 | a) Convey the object code in, or embodied in, a physical product 241 | (including a physical distribution medium), accompanied by the 242 | Corresponding Source fixed on a durable physical medium 243 | customarily used for software interchange. 244 | 245 | b) Convey the object code in, or embodied in, a physical product 246 | (including a physical distribution medium), accompanied by a 247 | written offer, valid for at least three years and valid for as 248 | long as you offer spare parts or customer support for that product 249 | model, to give anyone who possesses the object code either (1) a 250 | copy of the Corresponding Source for all the software in the 251 | product that is covered by this License, on a durable physical 252 | medium customarily used for software interchange, for a price no 253 | more than your reasonable cost of physically performing this 254 | conveying of source, or (2) access to copy the 255 | Corresponding Source from a network server at no charge. 256 | 257 | c) Convey individual copies of the object code with a copy of the 258 | written offer to provide the Corresponding Source. This 259 | alternative is allowed only occasionally and noncommercially, and 260 | only if you received the object code with such an offer, in accord 261 | with subsection 6b. 262 | 263 | d) Convey the object code by offering access from a designated 264 | place (gratis or for a charge), and offer equivalent access to the 265 | Corresponding Source in the same way through the same place at no 266 | further charge. You need not require recipients to copy the 267 | Corresponding Source along with the object code. If the place to 268 | copy the object code is a network server, the Corresponding Source 269 | may be on a different server (operated by you or a third party) 270 | that supports equivalent copying facilities, provided you maintain 271 | clear directions next to the object code saying where to find the 272 | Corresponding Source. Regardless of what server hosts the 273 | Corresponding Source, you remain obligated to ensure that it is 274 | available for as long as needed to satisfy these requirements. 275 | 276 | e) Convey the object code using peer-to-peer transmission, provided 277 | you inform other peers where the object code and Corresponding 278 | Source of the work are being offered to the general public at no 279 | charge under subsection 6d. 280 | 281 | A separable portion of the object code, whose source code is excluded 282 | from the Corresponding Source as a System Library, need not be 283 | included in conveying the object code work. 284 | 285 | A "User Product" is either (1) a "consumer product", which means any 286 | tangible personal property which is normally used for personal, family, 287 | or household purposes, or (2) anything designed or sold for incorporation 288 | into a dwelling. In determining whether a product is a consumer product, 289 | doubtful cases shall be resolved in favor of coverage. For a particular 290 | product received by a particular user, "normally used" refers to a 291 | typical or common use of that class of product, regardless of the status 292 | of the particular user or of the way in which the particular user 293 | actually uses, or expects or is expected to use, the product. A product 294 | is a consumer product regardless of whether the product has substantial 295 | commercial, industrial or non-consumer uses, unless such uses represent 296 | the only significant mode of use of the product. 297 | 298 | "Installation Information" for a User Product means any methods, 299 | procedures, authorization keys, or other information required to install 300 | and execute modified versions of a covered work in that User Product from 301 | a modified version of its Corresponding Source. The information must 302 | suffice to ensure that the continued functioning of the modified object 303 | code is in no case prevented or interfered with solely because 304 | modification has been made. 305 | 306 | If you convey an object code work under this section in, or with, or 307 | specifically for use in, a User Product, and the conveying occurs as 308 | part of a transaction in which the right of possession and use of the 309 | User Product is transferred to the recipient in perpetuity or for a 310 | fixed term (regardless of how the transaction is characterized), the 311 | Corresponding Source conveyed under this section must be accompanied 312 | by the Installation Information. But this requirement does not apply 313 | if neither you nor any third party retains the ability to install 314 | modified object code on the User Product (for example, the work has 315 | been installed in ROM). 316 | 317 | The requirement to provide Installation Information does not include a 318 | requirement to continue to provide support service, warranty, or updates 319 | for a work that has been modified or installed by the recipient, or for 320 | the User Product in which it has been modified or installed. Access to a 321 | network may be denied when the modification itself materially and 322 | adversely affects the operation of the network or violates the rules and 323 | protocols for communication across the network. 324 | 325 | Corresponding Source conveyed, and Installation Information provided, 326 | in accord with this section must be in a format that is publicly 327 | documented (and with an implementation available to the public in 328 | source code form), and must require no special password or key for 329 | unpacking, reading or copying. 330 | 331 | 7. Additional Terms. 332 | 333 | "Additional permissions" are terms that supplement the terms of this 334 | License by making exceptions from one or more of its conditions. 335 | Additional permissions that are applicable to the entire Program shall 336 | be treated as though they were included in this License, to the extent 337 | that they are valid under applicable law. If additional permissions 338 | apply only to part of the Program, that part may be used separately 339 | under those permissions, but the entire Program remains governed by 340 | this License without regard to the additional permissions. 341 | 342 | When you convey a copy of a covered work, you may at your option 343 | remove any additional permissions from that copy, or from any part of 344 | it. (Additional permissions may be written to require their own 345 | removal in certain cases when you modify the work.) You may place 346 | additional permissions on material, added by you to a covered work, 347 | for which you have or can give appropriate copyright permission. 348 | 349 | Notwithstanding any other provision of this License, for material you 350 | add to a covered work, you may (if authorized by the copyright holders of 351 | that material) supplement the terms of this License with terms: 352 | 353 | a) Disclaiming warranty or limiting liability differently from the 354 | terms of sections 15 and 16 of this License; or 355 | 356 | b) Requiring preservation of specified reasonable legal notices or 357 | author attributions in that material or in the Appropriate Legal 358 | Notices displayed by works containing it; or 359 | 360 | c) Prohibiting misrepresentation of the origin of that material, or 361 | requiring that modified versions of such material be marked in 362 | reasonable ways as different from the original version; or 363 | 364 | d) Limiting the use for publicity purposes of names of licensors or 365 | authors of the material; or 366 | 367 | e) Declining to grant rights under trademark law for use of some 368 | trade names, trademarks, or service marks; or 369 | 370 | f) Requiring indemnification of licensors and authors of that 371 | material by anyone who conveys the material (or modified versions of 372 | it) with contractual assumptions of liability to the recipient, for 373 | any liability that these contractual assumptions directly impose on 374 | those licensors and authors. 375 | 376 | All other non-permissive additional terms are considered "further 377 | restrictions" within the meaning of section 10. If the Program as you 378 | received it, or any part of it, contains a notice stating that it is 379 | governed by this License along with a term that is a further 380 | restriction, you may remove that term. If a license document contains 381 | a further restriction but permits relicensing or conveying under this 382 | License, you may add to a covered work material governed by the terms 383 | of that license document, provided that the further restriction does 384 | not survive such relicensing or conveying. 385 | 386 | If you add terms to a covered work in accord with this section, you 387 | must place, in the relevant source files, a statement of the 388 | additional terms that apply to those files, or a notice indicating 389 | where to find the applicable terms. 390 | 391 | Additional terms, permissive or non-permissive, may be stated in the 392 | form of a separately written license, or stated as exceptions; 393 | the above requirements apply either way. 394 | 395 | 8. Termination. 396 | 397 | You may not propagate or modify a covered work except as expressly 398 | provided under this License. Any attempt otherwise to propagate or 399 | modify it is void, and will automatically terminate your rights under 400 | this License (including any patent licenses granted under the third 401 | paragraph of section 11). 402 | 403 | However, if you cease all violation of this License, then your 404 | license from a particular copyright holder is reinstated (a) 405 | provisionally, unless and until the copyright holder explicitly and 406 | finally terminates your license, and (b) permanently, if the copyright 407 | holder fails to notify you of the violation by some reasonable means 408 | prior to 60 days after the cessation. 409 | 410 | Moreover, your license from a particular copyright holder is 411 | reinstated permanently if the copyright holder notifies you of the 412 | violation by some reasonable means, this is the first time you have 413 | received notice of violation of this License (for any work) from that 414 | copyright holder, and you cure the violation prior to 30 days after 415 | your receipt of the notice. 416 | 417 | Termination of your rights under this section does not terminate the 418 | licenses of parties who have received copies or rights from you under 419 | this License. If your rights have been terminated and not permanently 420 | reinstated, you do not qualify to receive new licenses for the same 421 | material under section 10. 422 | 423 | 9. Acceptance Not Required for Having Copies. 424 | 425 | You are not required to accept this License in order to receive or 426 | run a copy of the Program. Ancillary propagation of a covered work 427 | occurring solely as a consequence of using peer-to-peer transmission 428 | to receive a copy likewise does not require acceptance. However, 429 | nothing other than this License grants you permission to propagate or 430 | modify any covered work. These actions infringe copyright if you do 431 | not accept this License. Therefore, by modifying or propagating a 432 | covered work, you indicate your acceptance of this License to do so. 433 | 434 | 10. Automatic Licensing of Downstream Recipients. 435 | 436 | Each time you convey a covered work, the recipient automatically 437 | receives a license from the original licensors, to run, modify and 438 | propagate that work, subject to this License. You are not responsible 439 | for enforcing compliance by third parties with this License. 440 | 441 | An "entity transaction" is a transaction transferring control of an 442 | organization, or substantially all assets of one, or subdividing an 443 | organization, or merging organizations. If propagation of a covered 444 | work results from an entity transaction, each party to that 445 | transaction who receives a copy of the work also receives whatever 446 | licenses to the work the party's predecessor in interest had or could 447 | give under the previous paragraph, plus a right to possession of the 448 | Corresponding Source of the work from the predecessor in interest, if 449 | the predecessor has it or can get it with reasonable efforts. 450 | 451 | You may not impose any further restrictions on the exercise of the 452 | rights granted or affirmed under this License. For example, you may 453 | not impose a license fee, royalty, or other charge for exercise of 454 | rights granted under this License, and you may not initiate litigation 455 | (including a cross-claim or counterclaim in a lawsuit) alleging that 456 | any patent claim is infringed by making, using, selling, offering for 457 | sale, or importing the Program or any portion of it. 458 | 459 | 11. Patents. 460 | 461 | A "contributor" is a copyright holder who authorizes use under this 462 | License of the Program or a work on which the Program is based. The 463 | work thus licensed is called the contributor's "contributor version". 464 | 465 | A contributor's "essential patent claims" are all patent claims 466 | owned or controlled by the contributor, whether already acquired or 467 | hereafter acquired, that would be infringed by some manner, permitted 468 | by this License, of making, using, or selling its contributor version, 469 | but do not include claims that would be infringed only as a 470 | consequence of further modification of the contributor version. For 471 | purposes of this definition, "control" includes the right to grant 472 | patent sublicenses in a manner consistent with the requirements of 473 | this License. 474 | 475 | Each contributor grants you a non-exclusive, worldwide, royalty-free 476 | patent license under the contributor's essential patent claims, to 477 | make, use, sell, offer for sale, import and otherwise run, modify and 478 | propagate the contents of its contributor version. 479 | 480 | In the following three paragraphs, a "patent license" is any express 481 | agreement or commitment, however denominated, not to enforce a patent 482 | (such as an express permission to practice a patent or covenant not to 483 | sue for patent infringement). To "grant" such a patent license to a 484 | party means to make such an agreement or commitment not to enforce a 485 | patent against the party. 486 | 487 | If you convey a covered work, knowingly relying on a patent license, 488 | and the Corresponding Source of the work is not available for anyone 489 | to copy, free of charge and under the terms of this License, through a 490 | publicly available network server or other readily accessible means, 491 | then you must either (1) cause the Corresponding Source to be so 492 | available, or (2) arrange to deprive yourself of the benefit of the 493 | patent license for this particular work, or (3) arrange, in a manner 494 | consistent with the requirements of this License, to extend the patent 495 | license to downstream recipients. "Knowingly relying" means you have 496 | actual knowledge that, but for the patent license, your conveying the 497 | covered work in a country, or your recipient's use of the covered work 498 | in a country, would infringe one or more identifiable patents in that 499 | country that you have reason to believe are valid. 500 | 501 | If, pursuant to or in connection with a single transaction or 502 | arrangement, you convey, or propagate by procuring conveyance of, a 503 | covered work, and grant a patent license to some of the parties 504 | receiving the covered work authorizing them to use, propagate, modify 505 | or convey a specific copy of the covered work, then the patent license 506 | you grant is automatically extended to all recipients of the covered 507 | work and works based on it. 508 | 509 | A patent license is "discriminatory" if it does not include within 510 | the scope of its coverage, prohibits the exercise of, or is 511 | conditioned on the non-exercise of one or more of the rights that are 512 | specifically granted under this License. You may not convey a covered 513 | work if you are a party to an arrangement with a third party that is 514 | in the business of distributing software, under which you make payment 515 | to the third party based on the extent of your activity of conveying 516 | the work, and under which the third party grants, to any of the 517 | parties who would receive the covered work from you, a discriminatory 518 | patent license (a) in connection with copies of the covered work 519 | conveyed by you (or copies made from those copies), or (b) primarily 520 | for and in connection with specific products or compilations that 521 | contain the covered work, unless you entered into that arrangement, 522 | or that patent license was granted, prior to 28 March 2007. 523 | 524 | Nothing in this License shall be construed as excluding or limiting 525 | any implied license or other defenses to infringement that may 526 | otherwise be available to you under applicable patent law. 527 | 528 | 12. No Surrender of Others' Freedom. 529 | 530 | If conditions are imposed on you (whether by court order, agreement or 531 | otherwise) that contradict the conditions of this License, they do not 532 | excuse you from the conditions of this License. If you cannot convey a 533 | covered work so as to satisfy simultaneously your obligations under this 534 | License and any other pertinent obligations, then as a consequence you may 535 | not convey it at all. For example, if you agree to terms that obligate you 536 | to collect a royalty for further conveying from those to whom you convey 537 | the Program, the only way you could satisfy both those terms and this 538 | License would be to refrain entirely from conveying the Program. 539 | 540 | 13. Remote Network Interaction; Use with the GNU General Public License. 541 | 542 | Notwithstanding any other provision of this License, if you modify the 543 | Program, your modified version must prominently offer all users 544 | interacting with it remotely through a computer network (if your version 545 | supports such interaction) an opportunity to receive the Corresponding 546 | Source of your version by providing access to the Corresponding Source 547 | from a network server at no charge, through some standard or customary 548 | means of facilitating copying of software. This Corresponding Source 549 | shall include the Corresponding Source for any work covered by version 3 550 | of the GNU General Public License that is incorporated pursuant to the 551 | following paragraph. 552 | 553 | Notwithstanding any other provision of this License, you have 554 | permission to link or combine any covered work with a work licensed 555 | under version 3 of the GNU General Public License into a single 556 | combined work, and to convey the resulting work. The terms of this 557 | License will continue to apply to the part which is the covered work, 558 | but the work with which it is combined will remain governed by version 559 | 3 of the GNU General Public License. 560 | 561 | 14. Revised Versions of this License. 562 | 563 | The Free Software Foundation may publish revised and/or new versions of 564 | the GNU Affero General Public License from time to time. Such new versions 565 | will be similar in spirit to the present version, but may differ in detail to 566 | address new problems or concerns. 567 | 568 | Each version is given a distinguishing version number. If the 569 | Program specifies that a certain numbered version of the GNU Affero General 570 | Public License "or any later version" applies to it, you have the 571 | option of following the terms and conditions either of that numbered 572 | version or of any later version published by the Free Software 573 | Foundation. If the Program does not specify a version number of the 574 | GNU Affero General Public License, you may choose any version ever published 575 | by the Free Software Foundation. 576 | 577 | If the Program specifies that a proxy can decide which future 578 | versions of the GNU Affero General Public License can be used, that proxy's 579 | public statement of acceptance of a version permanently authorizes you 580 | to choose that version for the Program. 581 | 582 | Later license versions may give you additional or different 583 | permissions. However, no additional obligations are imposed on any 584 | author or copyright holder as a result of your choosing to follow a 585 | later version. 586 | 587 | 15. Disclaimer of Warranty. 588 | 589 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 590 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 591 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 592 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 593 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 594 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 595 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 596 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 597 | 598 | 16. Limitation of Liability. 599 | 600 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 601 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 602 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 603 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 604 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 605 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 606 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 607 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 608 | SUCH DAMAGES. 609 | 610 | 17. Interpretation of Sections 15 and 16. 611 | 612 | If the disclaimer of warranty and limitation of liability provided 613 | above cannot be given local legal effect according to their terms, 614 | reviewing courts shall apply local law that most closely approximates 615 | an absolute waiver of all civil liability in connection with the 616 | Program, unless a warranty or assumption of liability accompanies a 617 | copy of the Program in return for a fee. 618 | 619 | END OF TERMS AND CONDITIONS 620 | 621 | How to Apply These Terms to Your New Programs 622 | 623 | If you develop a new program, and you want it to be of the greatest 624 | possible use to the public, the best way to achieve this is to make it 625 | free software which everyone can redistribute and change under these terms. 626 | 627 | To do so, attach the following notices to the program. It is safest 628 | to attach them to the start of each source file to most effectively 629 | state the exclusion of warranty; and each file should have at least 630 | the "copyright" line and a pointer to where the full notice is found. 631 | 632 | 633 | Copyright (C) 634 | 635 | This program is free software: you can redistribute it and/or modify 636 | it under the terms of the GNU Affero General Public License as published 637 | by the Free Software Foundation, either version 3 of the License, or 638 | (at your option) any later version. 639 | 640 | This program is distributed in the hope that it will be useful, 641 | but WITHOUT ANY WARRANTY; without even the implied warranty of 642 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 643 | GNU Affero General Public License for more details. 644 | 645 | You should have received a copy of the GNU Affero General Public License 646 | along with this program. If not, see . 647 | 648 | Also add information on how to contact you by electronic and paper mail. 649 | 650 | If your software can interact with users remotely through a computer 651 | network, you should also make sure that it provides a way for users to 652 | get its source. For example, if your program is a web application, its 653 | interface could display a "Source" link that leads users to an archive 654 | of the code. There are many ways you could offer source, and different 655 | solutions will be better for different programs; see section 13 for the 656 | specific requirements. 657 | 658 | You should also get your employer (if you work as a programmer) or school, 659 | if any, to sign a "copyright disclaimer" for the program, if necessary. 660 | For more information on this, and how to apply and follow the GNU AGPL, see 661 | . 662 | -------------------------------------------------------------------------------- /helm/tdengine/templates/NOTES.txt: -------------------------------------------------------------------------------- 1 | 1. Get first POD name: 2 | 3 | ```sh 4 | export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} \ 5 | -l "app.kubernetes.io/name={{ include "tdengine.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") 6 | ``` 7 | 8 | 2. Show dnodes/mnodes: 9 | 10 | ```sh 11 | kubectl --namespace {{ .Release.Namespace }} exec $POD_NAME -- taos -s "show dnodes; show mnodes" 12 | ``` 13 | 14 | 3. Run into taos shell: 15 | 16 | ```sh 17 | kubectl --namespace {{ .Release.Namespace }} exec -it $POD_NAME -- taos 18 | ``` 19 | -------------------------------------------------------------------------------- /helm/tdengine/templates/_helpers.tpl: -------------------------------------------------------------------------------- 1 | {{/* 2 | Expand the name of the chart. 3 | */}} 4 | {{- define "tdengine.name" -}} 5 | {{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} 6 | {{- end }} 7 | 8 | {{/* 9 | Create a default fully qualified app name. 10 | We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). 11 | If release name contains chart name it will be used as a full name. 12 | */}} 13 | {{- define "tdengine.fullname" -}} 14 | {{- if .Values.fullnameOverride }} 15 | {{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} 16 | {{- else }} 17 | {{- $name := default .Chart.Name .Values.nameOverride }} 18 | {{- if contains $name .Release.Name }} 19 | {{- .Release.Name | trunc 63 | trimSuffix "-" }} 20 | {{- else }} 21 | {{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} 22 | {{- end }} 23 | {{- end }} 24 | {{- end }} 25 | 26 | {{/* 27 | Create chart name and version as used by the chart label. 28 | */}} 29 | {{- define "tdengine.chart" -}} 30 | {{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} 31 | {{- end }} 32 | 33 | {{/* 34 | Common labels 35 | */}} 36 | {{- define "tdengine.labels" -}} 37 | helm.sh/chart: {{ include "tdengine.chart" . }} 38 | {{ include "tdengine.selectorLabels" . }} 39 | {{- if .Chart.AppVersion }} 40 | app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} 41 | {{- end }} 42 | app.kubernetes.io/managed-by: {{ .Release.Service }} 43 | {{- end }} 44 | 45 | {{/* 46 | Selector labels 47 | */}} 48 | {{- define "tdengine.selectorLabels" -}} 49 | app.kubernetes.io/name: {{ include "tdengine.name" . }} 50 | app.kubernetes.io/instance: {{ .Release.Name }} 51 | {{- end }} 52 | 53 | -------------------------------------------------------------------------------- /helm/tdengine/templates/configmap.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: v1 3 | kind: ConfigMap 4 | metadata: 5 | name: {{ include "tdengine.fullname" . }}-taoscfg 6 | labels: 7 | {{- include "tdengine.labels" . | nindent 4 }} 8 | data: 9 | {{- with .Values.taoscfg }} 10 | {{- toYaml . | nindent 2 }} 11 | {{- end }} 12 | -------------------------------------------------------------------------------- /helm/tdengine/templates/service.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | name: {{ include "tdengine.fullname" . }} 5 | labels: 6 | {{- include "tdengine.labels" . | nindent 4 }} 7 | spec: 8 | type: {{ .Values.service.type }} 9 | ports: {{ range $idx, $val := .Values.service.ports.tcp }} 10 | - name: tcp{{- $idx}} 11 | port: {{ $val }} 12 | protocol: TCP 13 | {{- end }} 14 | {{ range $idx, $val := .Values.service.ports.udp }} 15 | - name: udp {{- $idx}} 16 | port: {{ $val }} 17 | protocol: UDP 18 | {{- end }} 19 | selector: 20 | {{- include "tdengine.selectorLabels" . | nindent 4 }} 21 | app: "taosd" 22 | 23 | -------------------------------------------------------------------------------- /helm/tdengine/templates/statefulset.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 2 | kind: StatefulSet 3 | metadata: 4 | name: {{ include "tdengine.fullname" . }} 5 | labels: 6 | {{- include "tdengine.labels" . | nindent 4 }} 7 | app: taosd 8 | spec: 9 | serviceName: {{ include "tdengine.fullname" . }} 10 | replicas: {{ .Values.replicaCount }} 11 | # podManagementPolicy: Parallel 12 | selector: 13 | matchLabels: 14 | {{- include "tdengine.selectorLabels" . | nindent 6 }} 15 | app: taosd 16 | template: 17 | metadata: 18 | {{- with .Values.podAnnotations }} 19 | annotations: 20 | {{- toYaml . | nindent 8 }} 21 | {{- end }} 22 | labels: 23 | {{- include "tdengine.selectorLabels" . | nindent 8 }} 24 | app: taosd 25 | spec: 26 | {{- with .Values.nodeSelectors.taosd }} 27 | nodeSelector: 28 | {{- toYaml . | nindent 8 }} 29 | {{- end }} 30 | {{- with .Values.imagePullSecrets }} 31 | imagePullSecrets: 32 | {{- toYaml . | nindent 8 }} 33 | {{- end }} 34 | containers: 35 | - name: {{ .Chart.Name }} 36 | image: "{{ .Values.image.prefix }}:{{ .Values.image.tag | default .Chart.AppVersion }}" 37 | imagePullPolicy: {{ .Values.image.pullPolicy }} 38 | ports: {{ range $idx, $val := .Values.service.ports.tcp }} 39 | - name: tcp{{- $idx}} 40 | containerPort: {{ $val }} 41 | protocol: TCP 42 | {{- end }} 43 | {{ range $idx, $val := .Values.service.ports.udp }} 44 | - name: udp {{- $idx}} 45 | containerPort: {{ $val }} 46 | protocol: UDP 47 | {{- end }} 48 | 49 | env: 50 | # POD_NAME for FQDN config 51 | - name: POD_NAME 52 | valueFrom: 53 | fieldRef: 54 | fieldPath: metadata.name 55 | # SERVICE_NAME and NAMESPACE for fqdn resolve 56 | - name: SERVICE_NAME 57 | value: {{ include "tdengine.fullname" . }} 58 | - name: STS_NAME 59 | value: {{ include "tdengine.fullname" . }} 60 | - name: STS_NAMESPACE 61 | valueFrom: 62 | fieldRef: 63 | fieldPath: metadata.namespace 64 | # TZ for timezone settings, we recommend to always set it. 65 | - name: TZ 66 | value: {{ .Values.timezone }} 67 | # TAOS_ prefix will configured in taos.cfg, strip prefix and camelCase. 68 | - name: TAOS_SERVER_PORT 69 | value: "6030" 70 | # Must set if you want a cluster. 71 | - name: TAOS_FIRST_EP 72 | value: '$(STS_NAME)-0.$(SERVICE_NAME).$(STS_NAMESPACE).svc.{{ .Values.clusterDomainSuffix | default "cluster.local" }}:$(TAOS_SERVER_PORT)' 73 | # TAOS_FQND should always be setted in k8s env. 74 | - name: TAOS_FQDN 75 | value: '$(POD_NAME).$(SERVICE_NAME).$(STS_NAMESPACE).svc.{{ .Values.clusterDomainSuffix | default "cluster.local" }}' 76 | 77 | envFrom: 78 | - configMapRef: 79 | name: {{ include "tdengine.fullname" . }}-taoscfg 80 | volumeMounts: 81 | - name: {{ include "tdengine.fullname" . }}-taosdata 82 | mountPath: /var/lib/taos 83 | - name: {{ include "tdengine.fullname" . }}-taoslog 84 | mountPath: /var/log/taos 85 | readinessProbe: 86 | exec: 87 | command: 88 | - taos-check 89 | initialDelaySeconds: 5 90 | timeoutSeconds: 5000 91 | livenessProbe: 92 | exec: 93 | command: 94 | - taos-check 95 | initialDelaySeconds: 15 96 | periodSeconds: 20 97 | securityContext: 98 | # privileged: true 99 | # allowPrivilegeEscalation: true 100 | # runAsUser: 0 101 | # runAsGroup: 0 102 | # readOnlyRootFilesystem: false 103 | # allowedCapabilities: 104 | # - CAP_SYS_ADMIN 105 | # - CHOWN 106 | # - DAC_OVERRIDE 107 | # - SETGID 108 | # - SETUID 109 | # - NET_BIND_SERVICE 110 | # AllowedHostPaths: 111 | # - pathPrefix: "/proc" 112 | # readOnly: true # 仅允许只读模式挂载 113 | # - pathPrefix: "/sys" 114 | # readOnly: true # 仅允许只读模式挂载 115 | resources: 116 | {{- toYaml .Values.resources | nindent 12 }} 117 | {{- with .Values.affinity }} 118 | affinity: 119 | {{- toYaml . | nindent 8 }} 120 | {{- end }} 121 | {{- with .Values.tolerations }} 122 | tolerations: 123 | {{- toYaml . | nindent 8 }} 124 | {{- end }} 125 | volumeClaimTemplates: 126 | - metadata: 127 | name: {{ include "tdengine.fullname" . }}-taosdata 128 | spec: 129 | accessModes: 130 | - "ReadWriteOnce" 131 | {{- if .Values.storage.className }} 132 | storageClassName: "{{ .Values.storage.className }}" 133 | {{- end }} 134 | resources: 135 | requests: 136 | storage: "{{ .Values.storage.dataSize }}" 137 | - metadata: 138 | name: {{ include "tdengine.fullname" . }}-taoslog 139 | spec: 140 | accessModes: 141 | - "ReadWriteOnce" 142 | {{- if .Values.storage.className }} 143 | storageClassName: "{{ .Values.storage.className }}" 144 | {{- end }} 145 | resources: 146 | requests: 147 | storage: "{{ .Values.storage.logSize }}" 148 | -------------------------------------------------------------------------------- /helm/tdengine/values.yaml: -------------------------------------------------------------------------------- 1 | # Default values for tdengine. 2 | # This is a YAML-formatted file. 3 | # Declare variables to be passed into helm templates. 4 | 5 | replicaCount: 1 6 | 7 | image: 8 | prefix: tdengine/tdengine 9 | #pullPolicy: Always 10 | # Overrides the image tag whose default is the chart appVersion. 11 | # tag: "3.0.0.0" 12 | 13 | service: 14 | # ClusterIP is the default service type, use NodeIP only if you know what you are doing. 15 | type: ClusterIP 16 | ports: 17 | # TCP range required 18 | tcp: [6030, 6041, 6042, 6043, 6044, 6046, 6047, 6048, 6049, 6060] 19 | # UDP range 20 | udp: [6044, 6045] 21 | 22 | 23 | # Set timezone here, not in taoscfg 24 | timezone: "Asia/Shanghai" 25 | 26 | resources: 27 | # We usually recommend not to specify default resources and to leave this as a conscious 28 | # choice for the user. This also increases chances charts run on environments with little 29 | # resources, such as Minikube. If you do want to specify resources, uncomment the following 30 | # lines, adjust them as necessary, and remove the curly braces after 'resources:'. 31 | # limits: 32 | # cpu: 100m 33 | # memory: 128Mi 34 | # requests: 35 | # cpu: 100m 36 | # memory: 128Mi 37 | 38 | storage: 39 | # Set storageClassName for pvc. K8s use default storage class if not set. 40 | # 41 | className: "" 42 | dataSize: "100Gi" 43 | logSize: "10Gi" 44 | 45 | nodeSelectors: 46 | taosd: 47 | # node selectors 48 | 49 | clusterDomainSuffix: "" 50 | # Config settings in taos.cfg file. 51 | # 52 | # The helm/k8s support will use environment variables for taos.cfg, 53 | # converting an upper-snake-cased variable like `TAOS_DEBUG_FLAG`, 54 | # to a camelCase taos config variable `debugFlag`. 55 | # 56 | # See the variable list at https://www.taosdata.com/cn/documentation/administrator . 57 | # 58 | # Note: 59 | # 1. firstEp/secondEp: should not be setted here, it's auto generated at scale-up. 60 | # 2. serverPort: should not be setted, we'll use the default 6030 in many places. 61 | # 3. fqdn: will be auto generated in kubenetes, user should not care about it. 62 | # 4. role: currently role is not supported - every node is able to be mnode and vnode. 63 | # 64 | # Btw, keep quotes "" around the value like below, even the value will be number or not. 65 | taoscfg: 66 | # Starts as cluster or not, must be 0 or 1. 67 | # 0: all pods will start as a seperate TDengine server 68 | # 1: pods will start as TDengine server cluster. [default] 69 | CLUSTER: "1" 70 | 71 | # number of replications, for cluster only 72 | TAOS_REPLICA: "1" 73 | 74 | 75 | # 76 | # TAOS_NUM_OF_RPC_THREADS: number of threads for RPC 77 | #TAOS_NUM_OF_RPC_THREADS: "2" 78 | 79 | # 80 | # TAOS_NUM_OF_COMMIT_THREADS: number of threads to commit cache data 81 | #TAOS_NUM_OF_COMMIT_THREADS: "4" 82 | 83 | # enable/disable installation / usage report 84 | #TAOS_TELEMETRY_REPORTING: "1" 85 | 86 | # time interval of system monitor, seconds 87 | #TAOS_MONITOR_INTERVAL: "30" 88 | 89 | # time interval of dnode status reporting to mnode, seconds, for cluster only 90 | #TAOS_STATUS_INTERVAL: "1" 91 | 92 | # time interval of heart beat from shell to dnode, seconds 93 | #TAOS_SHELL_ACTIVITY_TIMER: "3" 94 | 95 | # minimum sliding window time, milli-second 96 | #TAOS_MIN_SLIDING_TIME: "10" 97 | 98 | # minimum time window, milli-second 99 | #TAOS_MIN_INTERVAL_TIME: "1" 100 | 101 | # the compressed rpc message, option: 102 | # -1 (no compression) 103 | # 0 (all message compressed), 104 | # > 0 (rpc message body which larger than this value will be compressed) 105 | #TAOS_COMPRESS_MSG_SIZE: "-1" 106 | 107 | # max number of connections allowed in dnode 108 | #TAOS_MAX_SHELL_CONNS: "50000" 109 | 110 | # stop writing logs when the disk size of the log folder is less than this value 111 | #TAOS_MINIMAL_LOG_DIR_G_B: "0.1" 112 | 113 | # stop writing temporary files when the disk size of the tmp folder is less than this value 114 | #TAOS_MINIMAL_TMP_DIR_G_B: "0.1" 115 | 116 | # if disk free space is less than this value, taosd service exit directly within startup process 117 | #TAOS_MINIMAL_DATA_DIR_G_B: "0.1" 118 | 119 | # One mnode is equal to the number of vnode consumed 120 | #TAOS_MNODE_EQUAL_VNODE_NUM: "4" 121 | 122 | # enbale/disable http service 123 | #TAOS_HTTP: "1" 124 | 125 | # enable/disable system monitor 126 | #TAOS_MONITOR: "1" 127 | 128 | # enable/disable async log 129 | #TAOS_ASYNC_LOG: "1" 130 | 131 | # 132 | # time of keeping log files, days 133 | #TAOS_LOG_KEEP_DAYS: "0" 134 | 135 | # The following parameters are used for debug purpose only. 136 | # debugFlag 8 bits mask: FILE-SCREEN-UNUSED-HeartBeat-DUMP-TRACE_WARN-ERROR 137 | # 131: output warning and error 138 | # 135: output debug, warning and error 139 | # 143: output trace, debug, warning and error to log 140 | # 199: output debug, warning and error to both screen and file 141 | # 207: output trace, debug, warning and error to both screen and file 142 | # 143 | # debug flag for all log type, take effect when non-zero value\ 144 | #TAOS_DEBUG_FLAG: "143" 145 | 146 | # generate core file when service crash 147 | #TAOS_ENABLE_CORE_FILE: "1" 148 | -------------------------------------------------------------------------------- /src/en/1.0-kubernetes.md: -------------------------------------------------------------------------------- 1 | # Start with Kubernetes 2 | 3 | We suppose you have known how kubernetes(`kubectl`) work and a kubernetes environment in use. 4 | 5 | If you start from scratch, you can try kubernetes with minikube or install with rancher by following the steps in next chapter. 6 | -------------------------------------------------------------------------------- /src/en/1.1-install-kubernetes-with-minikube.md: -------------------------------------------------------------------------------- 1 | # Try kubernetes with Minikube 2 | 3 | > This document will apply to linux host, others would go for more documentations. 4 | 5 | ## Install 6 | 7 | First, download and install minikube 8 | 9 | ```sh 10 | curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64 11 | sudo install minikube-linux-amd64 /usr/local/bin/minikube 12 | ``` 13 | 14 | ## Start 15 | 16 | Start a minikube cluster 17 | 18 | ```sh 19 | minikube start 20 | ``` 21 | 22 | ![minikube-start](../en/assets/minikube-start.png) 23 | 24 | ## Kubectl 25 | 26 | In minikube, you can use kubectl like: 27 | 28 | ```sh 29 | minikube kubectl -- get pods -A 30 | ``` 31 | 32 | But you can install and use kubectl as usual: 33 | 34 | ```sh 35 | curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" 36 | sudo install kubectl /usr/local/bin/kubectl 37 | ``` 38 | 39 | Get pods in all namespaces: 40 | 41 | ```sh 42 | kubectl get pods -A 43 | ``` 44 | 45 | Get storage class: 46 | 47 | ```sh 48 | kubectl get sc 49 | ``` 50 | 51 | Note that minikube will enable default storage class `standard`, which you should keep in mind. 52 | 53 | ## Dashboard 54 | 55 | Minikube provide dashboard as an extension, start it with: 56 | 57 | ```sh 58 | minikube dashboard 59 | ``` 60 | 61 | It will open in web browser: 62 | 63 | ![minikube-dashboard](../en/assets/minikube-dashboard.png) -------------------------------------------------------------------------------- /src/en/1.2-install-kubernetes-with-rancher.md: -------------------------------------------------------------------------------- 1 | # Introduction to Kubernetes 2 | 3 | We suppose you have known how kubernetes work and a kubernetes environment in use. 4 | 5 | Setup K8s Cluster with Rancher 6 | 7 | > Claim: I've built this at May 26 2021 in Beijing, China(UTC+8), China. Please refer to fitted documentations if any step changed. 8 | 9 | ## Install RancherD to deploy Rancher 10 | 11 | For most of the cases, just run the rancherd installer. 12 | 13 | ```sh 14 | curl -sfL https://get.rancher.io | sh - 15 | ``` 16 | 17 | Alternatively, you can download the latest rancherd package from github releases assets. 18 | 19 | ```sh 20 | # fill the proxy url if you use one 21 | export https_proxy= 22 | curl -s https://api.github.com/repos/rancher/rancher/releases/latest \ 23 | |jq '.assets[] | 24 | select(.browser_download_url|contains("rancherd-amd64.tar.gz")) | 25 | .browser_download_url' -r \ 26 | |wget -ci - 27 | ``` 28 | 29 | And install it. 30 | 31 | ```sh 32 | tar xzf rancherd-amd64.tar.gz -C /usr/local 33 | ``` 34 | 35 | Then start the rancherd service. 36 | 37 | ```sh 38 | systemctl enable rancherd-server 39 | systemctl start rancherd-server 40 | ``` 41 | 42 | Keep tracking with the service. 43 | 44 | ```sh 45 | journalctl -fu rancherd-server 46 | ``` 47 | 48 | End with log **successfully**: 49 | 50 | ```log 51 | "Event occurred" object="cn120" kind="Node" apiVersion="v1" \ 52 | type="Normal" reason="Synced" message="Node synced successfully" 53 | ``` 54 | 55 | ## Setup kubeconfig and kubectl 56 | 57 | Once the Kubernetes cluster is up, set up RancherD’s kubeconfig file and kubectl: 58 | 59 | ```sh 60 | export KUBECONFIG=/etc/rancher/rke2/rke2.yaml 61 | export PATH=$PATH:/var/lib/rancher/rke2/bin 62 | ``` 63 | 64 | Check rancher status with kubectl: 65 | 66 | ```sh 67 | kubectl get daemonset rancher -n cattle-system 68 | kubectl get pod -n cattle-system 69 | ``` 70 | 71 | Result: 72 | 73 | ``` 74 | NAME DESIRED CURRENT READY UP-TO-DATE AVAILABLE NODE SELECTOR AGE 75 | rancher 1 1 1 1 1 node-role.kubernetes.io/master=true 36m 76 | NAME READY STATUS RESTARTS AGE 77 | helm-operation-5c2wd 0/2 Completed 0 34m 78 | helm-operation-bdxlx 0/2 Completed 0 33m 79 | helm-operation-cgcvr 0/2 Completed 0 34m 80 | helm-operation-cj4g4 0/2 Completed 0 33m 81 | helm-operation-hq282 0/2 Completed 0 34m 82 | helm-operation-lp5nn 0/2 Completed 0 33m 83 | rancher-kf592 1/1 Running 0 36m 84 | rancher-webhook-65f558c486-vrjz9 1/1 Running 0 33m 85 | ``` 86 | 87 | ## Set Rancher Password 88 | 89 | ```sh 90 | rancherd reset-admin 91 | ``` 92 | 93 | You would see like this: 94 | 95 | ```text 96 | INFO[0000] Server URL: https://*.*.*.*:8443 97 | INFO[0000] Default admin and password created. Username: admin, Password: **** 98 | ``` 99 | 100 | Point to server url, you can see the login page. 101 | 102 | ![rancher-login-page](assets/rancher-login-page.png) 103 | 104 | Type right username and password, then enjoy rancher powered cluster dashboard. 105 | 106 | ![rancher-dashboard](assets/rancher-dashboard.png) 107 | 108 | ## HA Settings 109 | 110 | Check the token in `/var/lib/rancher/rke2/server/node-token`. 111 | 112 | Install rancherd-server in other nodes like first node: 113 | 114 | ```sh 115 | tar xzf rancherd-amd64.tar.gz -C /usr/local 116 | systemctl enable rancherd-server 117 | ``` 118 | 119 | Prepare config dir: 120 | 121 | ```sh 122 | mkdir -p /etc/rancher/rke2 123 | ``` 124 | 125 | Change the config file in `/etc/rancher/rke2/config.yaml`. 126 | 127 | ```yaml 128 | server: https://192.168.60.120:9345 129 | token: 130 | ``` 131 | 132 | Start rancherd 133 | 134 | ```sh 135 | systemctl start rancherd-server 136 | journalctl -fu rancherd-server 137 | ``` 138 | 139 | Other nodes just copy the config.yaml and start rancherd, and those will be joined to cluster automatically. 140 | 141 | Type `kubectl get daemonset rancher -n cattle-system`: 142 | 143 | ```text 144 | NAME DESIRED CURRENT READY UP-TO-DATE AVAILABLE NODE SELECTOR AGE 145 | rancher 3 3 3 3 3 node-role.kubernetes.io/master=true 129m 146 | ``` 147 | 148 | Three nodes rancher+k8s cluster are avalibale now. 149 | -------------------------------------------------------------------------------- /src/en/1.4-k8s-starter.md: -------------------------------------------------------------------------------- 1 | # K8s Starter 2 | 3 | Let's start using kubernetes from some starter project. If you are familiar enough with k8s, just ignore the chapter and go on. 4 | 5 | ## StatefulSets 6 | 7 | In `starter/stateful-nginx.yaml`: 8 | 9 | ```yaml 10 | apiVersion: v1 11 | kind: Service 12 | metadata: 13 | name: nginx 14 | labels: 15 | app: nginx 16 | spec: 17 | ports: 18 | - port: 80 19 | name: web 20 | clusterIP: None 21 | selector: 22 | app: nginx 23 | --- 24 | apiVersion: apps/v1 25 | kind: StatefulSet 26 | metadata: 27 | name: web 28 | spec: 29 | selector: 30 | matchLabels: 31 | app: nginx # has to match .spec.template.metadata.labels 32 | serviceName: "nginx" 33 | replicas: 3 # by default is 1 34 | template: 35 | metadata: 36 | labels: 37 | app: nginx # has to match .spec.selector.matchLabels 38 | spec: 39 | terminationGracePeriodSeconds: 10 40 | containers: 41 | - name: nginx 42 | image: nginx 43 | ports: 44 | - containerPort: 80 45 | name: web 46 | volumeMounts: 47 | - name: www 48 | mountPath: /usr/share/nginx/html 49 | volumeClaimTemplates: 50 | - metadata: 51 | name: www 52 | spec: 53 | accessModes: [ "ReadWriteOnce" ] 54 | storageClassName: "csi-rbd-sc" 55 | resources: 56 | requests: 57 | storage: 1Gi 58 | ``` 59 | 60 | ```sh 61 | kubectl apply -f starter/stateful-nginx.yaml 62 | ``` 63 | 64 | ## ConfigMap Mount as Volume 65 | 66 | A config map: 67 | 68 | ```yaml 69 | --- 70 | apiVersion: v1 71 | kind: ConfigMap 72 | metadata: 73 | name: starter-config-map 74 | data: 75 | debugFlag: 135 76 | keep: 3650 77 | --- 78 | apiVersion: v1 79 | kind: Pod 80 | metadata: 81 | name: starter-config-map-as-volume 82 | spec: 83 | containers: 84 | - name: test-container 85 | image: busybox 86 | command: [ "/bin/sh", "-c", "ls /etc/config/" ] 87 | volumeMounts: 88 | - name: starter-config-map-vol 89 | mountPath: /etc/config 90 | volumes: 91 | - name: starter-config-map-vol 92 | configMap: 93 | # Provide the name of the ConfigMap containing the files you want 94 | # to add to the container 95 | name: starter-config-map 96 | restartPolicy: Never 97 | ``` 98 | -------------------------------------------------------------------------------- /src/en/2.0-tdengine-on-kubernetes.md: -------------------------------------------------------------------------------- 1 | # Setup TDengine Cluster on Kubernetes 2 | 3 | In this chapter, we hope to introduce how to use YAML files to create a TDengine cluster from scratch step by step in the first subsection, and focus on the common operations of TDengine in the Kubernetes environment. You can learn about the deployment mechanism of TDengine in the Kubernetes cluster. The second section introduces how to use Helm to deploy TDengine. It is recommended to use the Helm Chart deployment method in the production environment. We will continue to update the TDengine Chart, so stay tuned. -------------------------------------------------------------------------------- /src/en/2.1-tdengine-step-by-step.md: -------------------------------------------------------------------------------- 1 | # Setup TDengine Cluster on Kubernetes 2 | 3 | ## Service 4 | 5 | Service config `taosd-service.yaml` for each port we will use, here note that the `metadata.name` (setted as `"taosd"`) will be used in next step: 6 | 7 | ```yaml 8 | {{#include ../tdengine/taosd-service.yaml }} 9 | ``` 10 | 11 | ## StatefulSet 12 | 13 | We use StatefulSet config `tdengine.yaml` for TDengine. 14 | 15 | ```yaml 16 | {{#include ../tdengine/tdengine.yaml }} 17 | ``` 18 | ## Start the cluster 19 | 20 | ```sh 21 | kubectl apply -f taosd-service.yaml 22 | kubectl apply -f tdengine.yaml 23 | ``` 24 | 25 | The script will create a three node TDengine cluster on k8s. 26 | 27 | Execute `show dnodes` in taos shell: 28 | 29 | ```sh 30 | kubectl exec -i -t tdengine-0 -- taos -s "show dnodes" 31 | kubectl exec -i -t tdengine-1 -- taos -s "show dnodes" 32 | kubectl exec -i -t tdengine-2 -- taos -s "show dnodes" 33 | ``` 34 | 35 | Well, the current dnodes list shows: 36 | 37 | ```sql 38 | Welcome to the TDengine shell from Linux, Client Version:3.0.0.0 39 | Copyright (c) 2022 by TAOS Data, Inc. All rights reserved. 40 | 41 | taos> show dnodes 42 | id | endpoint | vnodes | support_vnodes | status | create_time | note | 43 | ============================================================================================================================================ 44 | 1 | tdengine-0.taosd.default.sv... | 0 | 256 | ready | 2022-06-22 15:29:49.049 | | 45 | 2 | tdengine-1.taosd.default.sv... | 0 | 256 | ready | 2022-06-22 15:30:11.895 | | 46 | 3 | tdengine-2.taosd.default.sv... | 0 | 256 | ready | 2022-06-22 15:30:33.007 | | 47 | Query OK, 3 rows affected (0.004610s) 48 | ``` 49 | 50 | ## Scale Up 51 | 52 | TDengine on Kubernetes could automatically scale up with: 53 | 54 | ```sh 55 | kubectl scale statefulsets tdengine --replicas=4 56 | ``` 57 | 58 | Check if scale-up works: 59 | 60 | ```sh 61 | kubectl get pods -l app=tdengine 62 | ``` 63 | 64 | Results: 65 | 66 | ```text 67 | NAME READY STATUS RESTARTS AGE 68 | tdengine-0 1/1 Running 0 2m9s 69 | tdengine-1 1/1 Running 0 108s 70 | tdengine-2 1/1 Running 0 86s 71 | tdengine-3 1/1 Running 0 22s 72 | ``` 73 | 74 | Check TDengine dnodes: 75 | 76 | ```sh 77 | kubectl exec -i -t tdengine-0 -- taos -s "show dnodes" 78 | ``` 79 | 80 | Results: 81 | 82 | ```sql 83 | Welcome to the TDengine shell from Linux, Client Version:3.0.0.0 84 | Copyright (c) 2022 by TAOS Data, Inc. All rights reserved. 85 | 86 | taos> show dnodes 87 | id | endpoint | vnodes | support_vnodes | status | create_time | note | 88 | ============================================================================================================================================ 89 | 1 | tdengine-0.taosd.default.sv... | 0 | 256 | ready | 2022-06-22 15:29:49.049 | | 90 | 2 | tdengine-1.taosd.default.sv... | 0 | 256 | ready | 2022-06-22 15:30:11.895 | | 91 | 3 | tdengine-2.taosd.default.sv... | 0 | 256 | ready | 2022-06-22 15:30:33.007 | | 92 | 4 | tdengine-3.taosd.default.sv... | 0 | 256 | ready | 2022-06-22 15:31:36.204 | | 93 | Query OK, 4 rows affected (0.009594s) 94 | ``` 95 | 96 | ## Scale Down 97 | 98 | Let's try scale down from 4 to 3. 99 | 100 | To perform a right scale-down, we should drop the last dnode in taos shell first: 101 | 102 | ```sh 103 | kubectl exec -i -t tdengine-0 -- taos -s "drop dnode 4" 104 | ``` 105 | 106 | Then scale down to 3. 107 | 108 | ```sh 109 | kubectl scale statefulsets tdengine --replicas=3 110 | ``` 111 | 112 | Extra replicas pods will be terminated, and retain 3 pods. 113 | 114 | Type `kubectl get pods -l app=tdengine` to check pods. 115 | 116 | ```text 117 | NAME READY STATUS RESTARTS AGE 118 | tdengine-0 1/1 Running 0 4m17s 119 | tdengine-1 1/1 Running 0 3m56s 120 | tdengine-2 1/1 Running 0 3m34s 121 | ``` 122 | 123 | Also need to remove the pvc(if no, scale-up will be failed next): 124 | 125 | ```sh 126 | kubectl delete pvc taosdata-tdengine-3 127 | ``` 128 | 129 | Now your TDengine cluster is safe. 130 | 131 | Scale up again will be ok: 132 | 133 | ```sh 134 | kubectl scale statefulsets tdengine --replicas=3 135 | ``` 136 | 137 | `show dnodes` results: 138 | 139 | ```sql 140 | id | endpoint | vnodes | support_vnodes | status | create_time | note | 141 | ============================================================================================================================================ 142 | 1 | tdengine-0.taosd.default.sv... | 0 | 256 | ready | 2022-06-22 15:29:49.049 | | 143 | 2 | tdengine-1.taosd.default.sv... | 0 | 256 | ready | 2022-06-22 15:30:11.895 | | 144 | 3 | tdengine-2.taosd.default.sv... | 0 | 256 | ready | 2022-06-22 15:30:33.007 | | 145 | 5 | tdengine-3.taosd.default.sv... | 0 | 256 | ready | 2022-06-22 15:34:35.520 | | 146 | ``` 147 | 148 | ### Let's do something BAD Case 1 149 | 150 | Scale it up to 4 and then scale down to 2 directly. Deleted pods are `offline` now: 151 | 152 | ```text 153 | Welcome to the TDengine shell from Linux, Client Version:2.1.1.0 154 | Copyright (c) 2020 by TAOS Data, Inc. All rights reserved. 155 | 156 | taos> show dnodes 157 | id | endpoint | vnodes | support_vnodes | status | create_time | note | 158 | ============================================================================================================================================ 159 | 1 | tdengine-0.taosd.default.sv... | 0 | 256 | ready | 2022-06-22 15:29:49.049 | | 160 | 2 | tdengine-1.taosd.default.sv... | 0 | 256 | ready | 2022-06-22 15:30:11.895 | | 161 | 3 | tdengine-2.taosd.default.sv... | 0 | 256 | offline | 2022-06-22 15:30:33.007 | status msg timeout | 162 | 5 | tdengine-3.taosd.default.sv... | 0 | 256 | offline | 2022-06-22 15:34:35.520 | status msg timeout || 163 | Query OK, 4 row(s) in set (0.004293s) 164 | ``` 165 | 166 | But we can't drop tje offline dnodes, the dnode will stuck in `dropping` mode (if you call `drop dnode 'fqdn:6030'`). 167 | 168 | ### Let's do something BAD Case 2 169 | 170 | Note that if the remaining dnodes is less than the database `replica`, it will cause error until you scale it up again. 171 | 172 | Create database with `replica` 3, and insert data to a table: 173 | 174 | ```sh 175 | kubectl exec -i -t tdengine-0 -- \ 176 | taos -s \ 177 | "create database if not exists test replica 2; 178 | use test; 179 | create table if not exists t1(ts timestamp, n int); 180 | insert into t1 values(now, 1)(now+1s, 2);" 181 | ``` 182 | 183 | Scale down to replica 1 (bad behavior): 184 | 185 | ```sh 186 | kubectl scale statefulsets tdengine --replicas=1 187 | ``` 188 | 189 | Now in taos shell, all operations with database `test` are not valid. 190 | 191 | So, before scale-down, please check the max value of `replica` among all databases, and be sure to do `drop dnode` step. 192 | 193 | ## Clean Up TDengine StatefulSet 194 | 195 | To complete remove tdengine statefulset, type: 196 | 197 | ```sh 198 | kubectl delete statefulset -l app=tdengine 199 | kubectl delete svc -l app=tdengine 200 | kubectl delete pvc -l app=tdengine 201 | ``` 202 | -------------------------------------------------------------------------------- /src/en/2.2-tdengine-with-helm.md: -------------------------------------------------------------------------------- 1 | # Setup TDengine Cluster with helm 2 | 3 | Is it simple enough? Let's do something more. 4 | 5 | ## Install Helm 6 | 7 | ```sh 8 | curl -fsSL -o get_helm.sh \ 9 | https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 10 | chmod +x get_helm.sh 11 | ./get_helm.sh 12 | ``` 13 | 14 | Helm will use kubectl and the kubeconfig setted in chapter 1. 15 | 16 | ## Install TDengine Chart 17 | 18 | Download TDengine chart. 19 | 20 | ```sh 21 | wget https://github.com/taosdata/TDengine-Operator/raw/main/helm/tdengine-3.0.2.tgz 22 | ``` 23 | 24 | First, check your sotrage class name: 25 | 26 | ```sh 27 | kubectl get storageclass 28 | ``` 29 | 30 | In minikube, the default storageclass name is `standard`. 31 | 32 | And then deploy TDengine in one line: 33 | 34 | ```sh 35 | helm install tdengine tdengine-3.0.2.tgz \ 36 | --set storage.className= 37 | ``` 38 | 39 | If you are using minikube, you may want a smaller storage size for TDengine: 40 | 41 | ```sh 42 | helm install tdengine tdengine-3.0.2.tgz \ 43 | --set storage.className=standard \ 44 | --set storage.dataSize=2Gi \ 45 | --set storage.logSize=10Mi 46 | ``` 47 | 48 | If success, it will show an minimal usage of TDengine. 49 | 50 | ```sh 51 | export POD_NAME=$(kubectl get pods --namespace default \ 52 | -l "app.kubernetes.io/name=tdengine,app.kubernetes.io/instance=tdengine" \ 53 | -o jsonpath="{.items[0].metadata.name}") 54 | kubectl --namespace default exec $POD_NAME -- taos -s "show dnodes; show mnodes" 55 | kubectl --namespace default exec -it $POD_NAME -- taos 56 | ``` 57 | 58 | ![helm-install-with-sc](./assets/helm-install-with-sc.png) 59 | 60 | You can try it by yourself: 61 | 62 | ![helm-install-post-script](./assets/helm-install-post-script.png) 63 | 64 | For a small sql test: 65 | 66 | ```sh 67 | kubectl --namespace default exec $POD_NAME -- \ 68 | taos -s "create database test; 69 | use test; 70 | create table t1 (ts timestamp, n int); 71 | insert into t1 values(now, 1)(now + 1s, 2); 72 | select * from t1;" 73 | ``` 74 | 75 | ![taos-sql](assets/kubectl-taos-sql.png) 76 | 77 | ## Values 78 | 79 | TDengine support `values.yaml` append. 80 | 81 | To see a full list of values, use `helm show values`: 82 | 83 | ```sh 84 | helm show values tdengine-3.0.2.tgz 85 | ``` 86 | 87 | You cound save it to `values.yaml`, and do some changs on it, like replica count, storage class name, and so on. Then type: 88 | 89 | ```sh 90 | helm install tdengine tdengine-3.0.2.tgz -f values.yaml 91 | ``` 92 | 93 | The full list of values: 94 | 95 | ```yaml 96 | {{#include ../../helm/tdengine/values.yaml }} 97 | ``` 98 | 99 | ## Scale Up 100 | 101 | You could see the details in chapter 4. 102 | 103 | First, we should get the statefulset name in your deploy: 104 | 105 | ```sh 106 | export STS_NAME=$(kubectl get statefulset \ 107 | -l "app.kubernetes.io/name=tdengine" \ 108 | -o jsonpath="{.items[0].metadata.name}") 109 | ``` 110 | 111 | Scale up is very simple, the next line scale up the TDengine dnodes to 3, no other commands required. 112 | 113 | ```sh 114 | kubectl scale --replicas 3 statefulset/$STS_NAME 115 | ``` 116 | 117 | Re-call `show dnodes` `show mnodes` to check: 118 | 119 | ![helm-scale-up](assets/helm-scale-up.png) 120 | 121 | ## Scale Down 122 | 123 | > NOTE: scale-down is not completely work as expected, use it with caution. 124 | 125 | Also, scale down requires some extra step: 126 | 127 | Get the dnode endpoint and drop it iteratively: 128 | 129 | ```sh 130 | kubectl --namespace default exec $POD_NAME -- \ 131 | cat /var/lib/taos/dnode/dnodeEps.json \ 132 | | jq '.dnodeInfos[1:] |map(.dnodeFqdn + ":" + (.dnodePort|tostring)) | .[]' -r 133 | kubectl --namespace default exec $POD_NAME -- taos -s "show dnodes" 134 | kubectl --namespace default exec $POD_NAME -- taos -s 'drop dnode ""' 135 | ``` 136 | 137 | Drop one dnode may cause several seconds or minutes. 138 | 139 | ![helm-drop-dnode](assets/helm-drop-dnode.png) 140 | 141 | ## Uninstall 142 | 143 | ```sh 144 | helm uninstall tdengine 145 | ``` 146 | 147 | Helm doest not automatically drop pvc by now, you can drop it manually. 148 | -------------------------------------------------------------------------------- /src/en/README.md: -------------------------------------------------------------------------------- 1 | # TDengine on Kubernetes 2 | 3 | - Author: Huo Linhe 4 | - Updated:2021-06-09 16:24:00 5 | 6 | This document is for [TDengine] deployment on [Kubernetes(k8s)][K8s]. All the things we do is for who love [TDengine] and want to take it to k8s. We are hosting the ducumentation on [taosdata/TDengine-Operator](https://github.com/taosdata/TDengine-Operator). Anyone want to help improve the ducumentations could edit the markdown files. 7 | 8 | If you encounter problems following the operations, you can always add our official WeChat "tdengine" to join our chat group to get help from us and other TDengine users. 9 | 10 | Note: Please switch 2.0 branch if you want to run Kubernetes with TDengine 2.x. 11 | 12 | [TDengine]: https://github.com/taosdata/TDengine 13 | [K8s]: https://kubernetes.io/ 14 | -------------------------------------------------------------------------------- /src/en/SUMMARY.md: -------------------------------------------------------------------------------- 1 | # Summary 2 | 3 | - [Introduction](README.md) 4 | - [Start with Kubernetes](1.0-kubernetes.md) 5 | - [Try Kubernetes with Minikube](./1.1-install-kubernetes-with-minikube.md) 6 | - [Install Kubernetes with Rancher](./1.2-install-kubernetes-with-rancher.md) 7 | - [Start Using Kubernetes](./1.4-k8s-starter.md) 8 | - [Setup TDengine Cluster on Kubernetes](2.0-tdengine-on-kubernetes.md) 9 | - [Setup TDengine Cluster Step by Step](./2.1-tdengine-step-by-step.md) 10 | - [Setup TDengine Cluster with Helm](./2.2-tdengine-with-helm.md) 11 | -------------------------------------------------------------------------------- /src/en/assets/helm-drop-dnode.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/taosdata/TDengine-Operator/003111e2bb4a1503fbcf760159062017def15a0b/src/en/assets/helm-drop-dnode.png -------------------------------------------------------------------------------- /src/en/assets/helm-install-post-script.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/taosdata/TDengine-Operator/003111e2bb4a1503fbcf760159062017def15a0b/src/en/assets/helm-install-post-script.png -------------------------------------------------------------------------------- /src/en/assets/helm-install-with-sc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/taosdata/TDengine-Operator/003111e2bb4a1503fbcf760159062017def15a0b/src/en/assets/helm-install-with-sc.png -------------------------------------------------------------------------------- /src/en/assets/helm-scale-up.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/taosdata/TDengine-Operator/003111e2bb4a1503fbcf760159062017def15a0b/src/en/assets/helm-scale-up.png -------------------------------------------------------------------------------- /src/en/assets/kubectl-taos-sql.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/taosdata/TDengine-Operator/003111e2bb4a1503fbcf760159062017def15a0b/src/en/assets/kubectl-taos-sql.png -------------------------------------------------------------------------------- /src/en/assets/minikube-dashboard.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/taosdata/TDengine-Operator/003111e2bb4a1503fbcf760159062017def15a0b/src/en/assets/minikube-dashboard.png -------------------------------------------------------------------------------- /src/en/assets/minikube-start.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/taosdata/TDengine-Operator/003111e2bb4a1503fbcf760159062017def15a0b/src/en/assets/minikube-start.png -------------------------------------------------------------------------------- /src/en/assets/rancher-dashboard.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/taosdata/TDengine-Operator/003111e2bb4a1503fbcf760159062017def15a0b/src/en/assets/rancher-dashboard.png -------------------------------------------------------------------------------- /src/en/assets/rancher-login-page.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/taosdata/TDengine-Operator/003111e2bb4a1503fbcf760159062017def15a0b/src/en/assets/rancher-login-page.png -------------------------------------------------------------------------------- /src/en/assets/tdengine-deploy-with-2rep.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/taosdata/TDengine-Operator/003111e2bb4a1503fbcf760159062017def15a0b/src/en/assets/tdengine-deploy-with-2rep.png -------------------------------------------------------------------------------- /src/install/csi-config-map.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: v1 3 | kind: ConfigMap 4 | data: 5 | config.json: |- 6 | [{ 7 | "clusterID": "6177c398-f449-4d66-a00b-27cad7cd076f", 8 | "monitors":[ 9 | "192.168.60.90:6789", 10 | "192.168.60.206:6789", 11 | "192.168.60.207:6789", 12 | "192.168.60.208:6789", 13 | "192.168.60.209:6789", 14 | "192.168.60.210:6789" 15 | ] 16 | }] 17 | metadata: 18 | name: ceph-csi-config 19 | -------------------------------------------------------------------------------- /src/install/csi-rbd-sc.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: storage.k8s.io/v1 3 | kind: StorageClass 4 | metadata: 5 | name: csi-rbd-sc 6 | provisioner: rbd.csi.ceph.com 7 | parameters: 8 | clusterID: 6177c398-f449-4d66-a00b-27cad7cd076f 9 | pool: kubernetes 10 | imageFeatures: layering 11 | csi.storage.k8s.io/provisioner-secret-name: csi-rbd-secret 12 | csi.storage.k8s.io/provisioner-secret-namespace: default 13 | csi.storage.k8s.io/controller-expand-secret-name: csi-rbd-secret 14 | csi.storage.k8s.io/controller-expand-secret-namespace: default 15 | csi.storage.k8s.io/node-stage-secret-name: csi-rbd-secret 16 | csi.storage.k8s.io/node-stage-secret-namespace: default 17 | reclaimPolicy: Delete 18 | allowVolumeExpansion: true 19 | mountOptions: 20 | - discard 21 | -------------------------------------------------------------------------------- /src/install/csi-rbd-secret.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: v1 3 | kind: Secret 4 | metadata: 5 | name: csi-rbd-secret 6 | namespace: default 7 | stringData: 8 | userID: kubernetes 9 | userKey: AQC1Oq5gnLcWGhAACiFyohnB6n6Fovd/vNbqhw== 10 | -------------------------------------------------------------------------------- /src/install/csi-rbdplugin-provisioner.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | kind: Service 3 | apiVersion: v1 4 | metadata: 5 | name: csi-rbdplugin-provisioner 6 | labels: 7 | app: csi-metrics 8 | spec: 9 | selector: 10 | app: csi-rbdplugin-provisioner 11 | ports: 12 | - name: http-metrics 13 | port: 8080 14 | protocol: TCP 15 | targetPort: 8680 16 | 17 | --- 18 | kind: Deployment 19 | apiVersion: apps/v1 20 | metadata: 21 | name: csi-rbdplugin-provisioner 22 | spec: 23 | replicas: 3 24 | selector: 25 | matchLabels: 26 | app: csi-rbdplugin-provisioner 27 | template: 28 | metadata: 29 | labels: 30 | app: csi-rbdplugin-provisioner 31 | spec: 32 | affinity: 33 | podAntiAffinity: 34 | requiredDuringSchedulingIgnoredDuringExecution: 35 | - labelSelector: 36 | matchExpressions: 37 | - key: app 38 | operator: In 39 | values: 40 | - csi-rbdplugin-provisioner 41 | topologyKey: "kubernetes.io/hostname" 42 | serviceAccountName: rbd-csi-provisioner 43 | priorityClassName: system-cluster-critical 44 | containers: 45 | - name: csi-provisioner 46 | image: lvcisco/csi-provisioner:v2.0.4 47 | args: 48 | - "--csi-address=$(ADDRESS)" 49 | - "--v=5" 50 | - "--timeout=150s" 51 | - "--retry-interval-start=500ms" 52 | - "--leader-election=true" 53 | # set it to true to use topology based provisioning 54 | - "--feature-gates=Topology=false" 55 | # if fstype is not specified in storageclass, ext4 is default 56 | - "--default-fstype=ext4" 57 | - "--extra-create-metadata=true" 58 | env: 59 | - name: ADDRESS 60 | value: unix:///csi/csi-provisioner.sock 61 | imagePullPolicy: "IfNotPresent" 62 | volumeMounts: 63 | - name: socket-dir 64 | mountPath: /csi 65 | - name: csi-snapshotter 66 | image: lvcisco/csi-snapshotter:v4.0.0 67 | args: 68 | - "--csi-address=$(ADDRESS)" 69 | - "--v=5" 70 | - "--timeout=150s" 71 | - "--leader-election=true" 72 | env: 73 | - name: ADDRESS 74 | value: unix:///csi/csi-provisioner.sock 75 | imagePullPolicy: "IfNotPresent" 76 | securityContext: 77 | privileged: true 78 | volumeMounts: 79 | - name: socket-dir 80 | mountPath: /csi 81 | - name: csi-attacher 82 | image: lvcisco/csi-attacher:v3.0.2 83 | args: 84 | - "--v=5" 85 | - "--csi-address=$(ADDRESS)" 86 | - "--leader-election=true" 87 | - "--retry-interval-start=500ms" 88 | env: 89 | - name: ADDRESS 90 | value: /csi/csi-provisioner.sock 91 | imagePullPolicy: "IfNotPresent" 92 | volumeMounts: 93 | - name: socket-dir 94 | mountPath: /csi 95 | - name: csi-resizer 96 | image: lvcisco/csi-resizer:v1.0.1 97 | args: 98 | - "--csi-address=$(ADDRESS)" 99 | - "--v=5" 100 | - "--timeout=150s" 101 | - "--leader-election" 102 | - "--retry-interval-start=500ms" 103 | - "--handle-volume-inuse-error=false" 104 | env: 105 | - name: ADDRESS 106 | value: unix:///csi/csi-provisioner.sock 107 | imagePullPolicy: "IfNotPresent" 108 | volumeMounts: 109 | - name: socket-dir 110 | mountPath: /csi 111 | - name: csi-rbdplugin 112 | securityContext: 113 | privileged: true 114 | capabilities: 115 | add: ["SYS_ADMIN"] 116 | # for stable functionality replace canary with latest release version 117 | image: quay.io/cephcsi/cephcsi:canary 118 | args: 119 | - "--nodeid=$(NODE_ID)" 120 | - "--type=rbd" 121 | - "--controllerserver=true" 122 | - "--endpoint=$(CSI_ENDPOINT)" 123 | - "--v=5" 124 | - "--drivername=rbd.csi.ceph.com" 125 | - "--pidlimit=-1" 126 | - "--rbdhardmaxclonedepth=8" 127 | - "--rbdsoftmaxclonedepth=4" 128 | - "--enableprofiling=false" 129 | env: 130 | - name: POD_IP 131 | valueFrom: 132 | fieldRef: 133 | fieldPath: status.podIP 134 | - name: NODE_ID 135 | valueFrom: 136 | fieldRef: 137 | fieldPath: spec.nodeName 138 | # - name: POD_NAMESPACE 139 | # valueFrom: 140 | # fieldRef: 141 | # fieldPath: spec.namespace 142 | # - name: KMS_CONFIGMAP_NAME 143 | # value: encryptionConfig 144 | - name: CSI_ENDPOINT 145 | value: unix:///csi/csi-provisioner.sock 146 | imagePullPolicy: "IfNotPresent" 147 | volumeMounts: 148 | - name: socket-dir 149 | mountPath: /csi 150 | - mountPath: /dev 151 | name: host-dev 152 | - mountPath: /sys 153 | name: host-sys 154 | - mountPath: /lib/modules 155 | name: lib-modules 156 | readOnly: true 157 | - name: ceph-csi-config 158 | mountPath: /etc/ceph-csi-config/ 159 | - name: ceph-csi-encryption-kms-config 160 | mountPath: /etc/ceph-csi-encryption-kms-config/ 161 | - name: keys-tmp-dir 162 | mountPath: /tmp/csi/keys 163 | - name: csi-rbdplugin-controller 164 | securityContext: 165 | privileged: true 166 | capabilities: 167 | add: ["SYS_ADMIN"] 168 | # for stable functionality replace canary with latest release version 169 | image: quay.io/cephcsi/cephcsi:canary 170 | args: 171 | - "--type=controller" 172 | - "--v=5" 173 | - "--drivername=rbd.csi.ceph.com" 174 | - "--drivernamespace=$(DRIVER_NAMESPACE)" 175 | env: 176 | - name: DRIVER_NAMESPACE 177 | valueFrom: 178 | fieldRef: 179 | fieldPath: metadata.namespace 180 | imagePullPolicy: "IfNotPresent" 181 | volumeMounts: 182 | - name: ceph-csi-config 183 | mountPath: /etc/ceph-csi-config/ 184 | - name: keys-tmp-dir 185 | mountPath: /tmp/csi/keys 186 | - name: liveness-prometheus 187 | image: quay.io/cephcsi/cephcsi:canary 188 | args: 189 | - "--type=liveness" 190 | - "--endpoint=$(CSI_ENDPOINT)" 191 | - "--metricsport=8680" 192 | - "--metricspath=/metrics" 193 | - "--polltime=60s" 194 | - "--timeout=3s" 195 | env: 196 | - name: CSI_ENDPOINT 197 | value: unix:///csi/csi-provisioner.sock 198 | - name: POD_IP 199 | valueFrom: 200 | fieldRef: 201 | fieldPath: status.podIP 202 | volumeMounts: 203 | - name: socket-dir 204 | mountPath: /csi 205 | imagePullPolicy: "IfNotPresent" 206 | volumes: 207 | - name: host-dev 208 | hostPath: 209 | path: /dev 210 | - name: host-sys 211 | hostPath: 212 | path: /sys 213 | - name: lib-modules 214 | hostPath: 215 | path: /lib/modules 216 | - name: socket-dir 217 | emptyDir: { 218 | medium: "Memory" 219 | } 220 | - name: ceph-csi-config 221 | configMap: 222 | name: ceph-csi-config 223 | - name: ceph-csi-encryption-kms-config 224 | configMap: 225 | name: ceph-csi-encryption-kms-config 226 | - name: keys-tmp-dir 227 | emptyDir: { 228 | medium: "Memory" 229 | } 230 | -------------------------------------------------------------------------------- /src/install/csi-rbdplugin.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | kind: DaemonSet 3 | apiVersion: apps/v1 4 | metadata: 5 | name: csi-rbdplugin 6 | spec: 7 | selector: 8 | matchLabels: 9 | app: csi-rbdplugin 10 | template: 11 | metadata: 12 | labels: 13 | app: csi-rbdplugin 14 | spec: 15 | serviceAccountName: rbd-csi-nodeplugin 16 | hostNetwork: true 17 | hostPID: true 18 | priorityClassName: system-node-critical 19 | # to use e.g. Rook orchestrated cluster, and mons' FQDN is 20 | # resolved through k8s service, set dns policy to cluster first 21 | dnsPolicy: ClusterFirstWithHostNet 22 | containers: 23 | - name: driver-registrar 24 | # This is necessary only for systems with SELinux, where 25 | # non-privileged sidecar containers cannot access unix domain socket 26 | # created by privileged CSI driver container. 27 | securityContext: 28 | privileged: true 29 | image: lvcisco/csi-node-driver-registrar:v2.0.1 30 | args: 31 | - "--v=5" 32 | - "--csi-address=/csi/csi.sock" 33 | - "--kubelet-registration-path=/var/lib/kubelet/plugins/rbd.csi.ceph.com/csi.sock" 34 | env: 35 | - name: KUBE_NODE_NAME 36 | valueFrom: 37 | fieldRef: 38 | fieldPath: spec.nodeName 39 | volumeMounts: 40 | - name: socket-dir 41 | mountPath: /csi 42 | - name: registration-dir 43 | mountPath: /registration 44 | - name: csi-rbdplugin 45 | securityContext: 46 | privileged: true 47 | capabilities: 48 | add: ["SYS_ADMIN"] 49 | allowPrivilegeEscalation: true 50 | # for stable functionality replace canary with latest release version 51 | image: quay.io/cephcsi/cephcsi:canary 52 | args: 53 | - "--nodeid=$(NODE_ID)" 54 | - "--type=rbd" 55 | - "--nodeserver=true" 56 | - "--endpoint=$(CSI_ENDPOINT)" 57 | - "--v=5" 58 | - "--drivername=rbd.csi.ceph.com" 59 | - "--enableprofiling=false" 60 | # If topology based provisioning is desired, configure required 61 | # node labels representing the nodes topology domain 62 | # and pass the label names below, for CSI to consume and advertise 63 | # its equivalent topology domain 64 | # - "--domainlabels=failure-domain/region,failure-domain/zone" 65 | env: 66 | - name: POD_IP 67 | valueFrom: 68 | fieldRef: 69 | fieldPath: status.podIP 70 | - name: NODE_ID 71 | valueFrom: 72 | fieldRef: 73 | fieldPath: spec.nodeName 74 | # - name: POD_NAMESPACE 75 | # valueFrom: 76 | # fieldRef: 77 | # fieldPath: spec.namespace 78 | # - name: KMS_CONFIGMAP_NAME 79 | # value: encryptionConfig 80 | - name: CSI_ENDPOINT 81 | value: unix:///csi/csi.sock 82 | imagePullPolicy: "IfNotPresent" 83 | volumeMounts: 84 | - name: socket-dir 85 | mountPath: /csi 86 | - mountPath: /dev 87 | name: host-dev 88 | - mountPath: /sys 89 | name: host-sys 90 | - mountPath: /run/mount 91 | name: host-mount 92 | - mountPath: /lib/modules 93 | name: lib-modules 94 | readOnly: true 95 | - name: ceph-csi-config 96 | mountPath: /etc/ceph-csi-config/ 97 | - name: ceph-csi-encryption-kms-config 98 | mountPath: /etc/ceph-csi-encryption-kms-config/ 99 | - name: plugin-dir 100 | mountPath: /var/lib/kubelet/plugins 101 | mountPropagation: "Bidirectional" 102 | - name: mountpoint-dir 103 | mountPath: /var/lib/kubelet/pods 104 | mountPropagation: "Bidirectional" 105 | - name: keys-tmp-dir 106 | mountPath: /tmp/csi/keys 107 | - name: liveness-prometheus 108 | securityContext: 109 | privileged: true 110 | image: quay.io/cephcsi/cephcsi:canary 111 | args: 112 | - "--type=liveness" 113 | - "--endpoint=$(CSI_ENDPOINT)" 114 | - "--metricsport=8680" 115 | - "--metricspath=/metrics" 116 | - "--polltime=60s" 117 | - "--timeout=3s" 118 | env: 119 | - name: CSI_ENDPOINT 120 | value: unix:///csi/csi.sock 121 | - name: POD_IP 122 | valueFrom: 123 | fieldRef: 124 | fieldPath: status.podIP 125 | volumeMounts: 126 | - name: socket-dir 127 | mountPath: /csi 128 | imagePullPolicy: "IfNotPresent" 129 | volumes: 130 | - name: socket-dir 131 | hostPath: 132 | path: /var/lib/kubelet/plugins/rbd.csi.ceph.com 133 | type: DirectoryOrCreate 134 | - name: plugin-dir 135 | hostPath: 136 | path: /var/lib/kubelet/plugins 137 | type: Directory 138 | - name: mountpoint-dir 139 | hostPath: 140 | path: /var/lib/kubelet/pods 141 | type: DirectoryOrCreate 142 | - name: registration-dir 143 | hostPath: 144 | path: /var/lib/kubelet/plugins_registry/ 145 | type: Directory 146 | - name: host-dev 147 | hostPath: 148 | path: /dev 149 | - name: host-sys 150 | hostPath: 151 | path: /sys 152 | - name: host-mount 153 | hostPath: 154 | path: /run/mount 155 | - name: lib-modules 156 | hostPath: 157 | path: /lib/modules 158 | - name: ceph-csi-config 159 | configMap: 160 | name: ceph-csi-config 161 | - name: ceph-csi-encryption-kms-config 162 | configMap: 163 | name: ceph-csi-encryption-kms-config 164 | - name: keys-tmp-dir 165 | emptyDir: { 166 | medium: "Memory" 167 | } 168 | --- 169 | # This is a service to expose the liveness metrics 170 | apiVersion: v1 171 | kind: Service 172 | metadata: 173 | name: csi-metrics-rbdplugin 174 | labels: 175 | app: csi-metrics 176 | spec: 177 | ports: 178 | - name: http-metrics 179 | port: 8080 180 | protocol: TCP 181 | targetPort: 8680 182 | selector: 183 | app: csi-rbdplugin 184 | -------------------------------------------------------------------------------- /src/install/kms-config.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: v1 3 | kind: ConfigMap 4 | data: 5 | config.json: |- 6 | { 7 | "vault-test": { 8 | "encryptionKMSType": "vault", 9 | "vaultAddress": "http://vault.default.svc.cluster.local:8200", 10 | "vaultAuthPath": "/v1/auth/kubernetes/login", 11 | "vaultRole": "csi-kubernetes", 12 | "vaultPassphraseRoot": "/v1/secret", 13 | "vaultPassphrasePath": "ceph-csi/", 14 | "vaultCAVerify": "false" 15 | }, 16 | "vault-tokens-test": { 17 | "encryptionKMSType": "vaulttokens", 18 | "vaultAddress": "http://vault.default.svc.cluster.local:8200", 19 | "vaultBackendPath": "secret/", 20 | "vaultTLSServerName": "vault.default.svc.cluster.local", 21 | "vaultCAVerify": "false", 22 | "tenantConfigName": "ceph-csi-kms-config", 23 | "tenantTokenName": "ceph-csi-kms-token", 24 | "tenants": { 25 | "my-app": { 26 | "vaultAddress": "https://vault.example.com", 27 | "vaultCAVerify": "true" 28 | }, 29 | "an-other-app": { 30 | "tenantTokenName": "storage-encryption-token" 31 | } 32 | } 33 | } 34 | } 35 | metadata: 36 | name: ceph-csi-encryption-kms-config 37 | -------------------------------------------------------------------------------- /src/install/pod.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: v1 3 | kind: Pod 4 | metadata: 5 | name: csi-rbd-demo-pod 6 | spec: 7 | containers: 8 | - name: web-server 9 | image: nginx 10 | volumeMounts: 11 | - name: nginx-test 12 | mountPath: /var/lib/www/html 13 | volumes: 14 | - name: nginx-test 15 | persistentVolumeClaim: 16 | claimName: rbd-pvc 17 | readOnly: false 18 | -------------------------------------------------------------------------------- /src/install/pvc.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: v1 3 | kind: PersistentVolumeClaim 4 | metadata: 5 | name: rbd-pvc 6 | spec: 7 | accessModes: 8 | - ReadWriteOnce 9 | volumeMode: Filesystem 10 | resources: 11 | requests: 12 | storage: 1Gi 13 | storageClassName: csi-rbd-sc 14 | -------------------------------------------------------------------------------- /src/install/raw-block-pod.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: v1 3 | kind: Pod 4 | metadata: 5 | name: pod-with-raw-block-volume 6 | spec: 7 | containers: 8 | - name: fc-container 9 | image: fedora:26 10 | command: ["/bin/sh", "-c"] 11 | args: ["tail -f /dev/null"] 12 | volumeDevices: 13 | - name: data 14 | devicePath: /dev/xvda 15 | volumes: 16 | - name: data 17 | persistentVolumeClaim: 18 | claimName: raw-block-pvc 19 | -------------------------------------------------------------------------------- /src/install/raw-block-pvc.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: v1 3 | kind: PersistentVolumeClaim 4 | metadata: 5 | name: raw-block-pvc 6 | spec: 7 | accessModes: 8 | - ReadWriteOnce 9 | volumeMode: Block 10 | resources: 11 | requests: 12 | storage: 1Gi 13 | storageClassName: csi-rbd-sc 14 | -------------------------------------------------------------------------------- /src/starter/config-map-as-volume.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: v1 3 | kind: ConfigMap 4 | metadata: 5 | name: starter-config-map 6 | data: 7 | taos.cfg: |- 8 | debugFlag 135 9 | keep 3650 10 | inited: "false" 11 | --- 12 | apiVersion: v1 13 | kind: Pod 14 | metadata: 15 | name: starter-config-map-as-volume 16 | spec: 17 | containers: 18 | - name: test-container 19 | image: busybox 20 | command: ["/bin/sh", "-c", "cat /etc/config/taos.cfg; echo fqdn test-container >> /etc/config/taos.cfg"] 21 | volumeMounts: 22 | - name: starter-config-map-vol 23 | mountPath: /etc/config 24 | volumes: 25 | - name: starter-config-map-vol 26 | configMap: 27 | # Provide the name of the ConfigMap containing the files you want 28 | # to add to the container 29 | name: starter-config-map 30 | restartPolicy: Never 31 | -------------------------------------------------------------------------------- /src/starter/dnsutils.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Pod 3 | metadata: 4 | name: dnsutils 5 | namespace: default 6 | spec: 7 | containers: 8 | - name: dnsutils 9 | image: bantianyinshi/dnsutils:1.3 10 | command: 11 | - sleep 12 | - "3600" 13 | imagePullPolicy: IfNotPresent 14 | restartPolicy: Always 15 | -------------------------------------------------------------------------------- /src/starter/stateful-nginx.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | name: nginx 5 | labels: 6 | app: nginx 7 | spec: 8 | ports: 9 | - port: 80 10 | name: web 11 | clusterIP: None 12 | selector: 13 | app: nginx 14 | --- 15 | apiVersion: apps/v1 16 | kind: StatefulSet 17 | metadata: 18 | name: web 19 | spec: 20 | selector: 21 | matchLabels: 22 | app: nginx # has to match .spec.template.metadata.labels 23 | serviceName: "nginx" 24 | replicas: 3 # by default is 1 25 | template: 26 | metadata: 27 | labels: 28 | app: nginx # has to match .spec.selector.matchLabels 29 | spec: 30 | terminationGracePeriodSeconds: 10 31 | containers: 32 | - name: nginx 33 | image: nginx 34 | ports: 35 | - containerPort: 80 36 | name: web 37 | volumeMounts: 38 | - name: www 39 | mountPath: /usr/share/nginx/html 40 | volumeClaimTemplates: 41 | - metadata: 42 | name: www 43 | spec: 44 | accessModes: [ "ReadWriteOnce" ] 45 | storageClassName: "csi-rbd-sc" 46 | resources: 47 | requests: 48 | storage: 1Gi 49 | -------------------------------------------------------------------------------- /src/tdengine/taosd-service.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: v1 3 | kind: Service 4 | metadata: 5 | name: "taosd" 6 | labels: 7 | app: "tdengine" 8 | spec: 9 | ports: 10 | - name: tcp6030 11 | protocol: "TCP" 12 | port: 6030 13 | - name: tcp6041 14 | protocol: "TCP" 15 | port: 6041 16 | selector: 17 | app: "tdengine" 18 | -------------------------------------------------------------------------------- /src/tdengine/tdengine-delete.sh: -------------------------------------------------------------------------------- 1 | kubectl delete statefulset -l app=tdengine 2 | kubectl delete svc -l app=tdengine 3 | kubectl delete pvc -l app=tdengine 4 | 5 | -------------------------------------------------------------------------------- /src/tdengine/tdengine-deployment.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: v1 3 | kind: Service 4 | metadata: 5 | name: "taosd" 6 | labels: 7 | app: "tdengine" 8 | spec: 9 | ports: 10 | - name: tcp6030 11 | protocol: "TCP" 12 | port: 6030 13 | selector: 14 | app: "tdengine" 15 | --- 16 | apiVersion: apps/v1 17 | kind: StatefulSet 18 | metadata: 19 | name: "tdengine" 20 | labels: 21 | app: "tdengine" 22 | spec: 23 | serviceName: "taosd" 24 | replicas: 2 25 | updateStrategy: 26 | type: RollingUpdate 27 | selector: 28 | matchLabels: 29 | app: "tdengine" 30 | template: 31 | metadata: 32 | name: "tdengine" 33 | labels: 34 | app: "tdengine" 35 | spec: 36 | containers: 37 | - name: "tdengine" 38 | image: "taosd:3.0" 39 | imagePullPolicy: "IfNotPresent" 40 | ports: 41 | - name: tcp6030 42 | protocol: "TCP" 43 | containerPort: 6030 44 | - name: tcp6041 45 | protocol: "TCP" 46 | containerPort: 6041 47 | env: 48 | # POD_NAME for FQDN config 49 | - name: POD_NAME 50 | valueFrom: 51 | fieldRef: 52 | fieldPath: metadata.name 53 | # SERVICE_NAME and NAMESPACE for fqdn resolve 54 | - name: SERVICE_NAME 55 | value: "taosd" 56 | - name: STS_NAME 57 | value: "tdengine" 58 | - name: STS_NAMESPACE 59 | valueFrom: 60 | fieldRef: 61 | fieldPath: metadata.namespace 62 | # TZ for timezone settings, we recommend to always set it. 63 | - name: TZ 64 | value: "Asia/Shanghai" 65 | # TAOS_ prefix will configured in taos.cfg, strip prefix and camelCase. 66 | - name: TAOS_SERVER_PORT 67 | value: "6030" 68 | # Must set if you want a cluster. 69 | - name: TAOS_FIRST_EP 70 | value: "$(STS_NAME)-0.$(SERVICE_NAME).$(STS_NAMESPACE).svc.cluster.local:$(TAOS_SERVER_PORT)" 71 | # TAOS_FQND should always be setted in k8s env. 72 | - name: TAOS_FQDN 73 | value: "$(POD_NAME).$(SERVICE_NAME).$(STS_NAMESPACE).svc.cluster.local" 74 | volumeMounts: 75 | - name: taosdata 76 | mountPath: /var/lib/taos 77 | readinessProbe: 78 | exec: 79 | command: 80 | - taos-check 81 | initialDelaySeconds: 5 82 | timeoutSeconds: 5000 83 | livenessProbe: 84 | exec: 85 | command: 86 | - taos-check 87 | initialDelaySeconds: 15 88 | periodSeconds: 20 89 | volumeClaimTemplates: 90 | - metadata: 91 | name: taosdata 92 | spec: 93 | accessModes: 94 | - "ReadWriteOnce" 95 | resources: 96 | requests: 97 | storage: "10Gi" 98 | -------------------------------------------------------------------------------- /src/tdengine/tdengine.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: apps/v1 3 | kind: StatefulSet 4 | metadata: 5 | name: "tdengine" 6 | labels: 7 | app: "tdengine" 8 | spec: 9 | serviceName: "taosd" 10 | replicas: 3 11 | updateStrategy: 12 | type: RollingUpdate 13 | selector: 14 | matchLabels: 15 | app: "tdengine" 16 | template: 17 | metadata: 18 | name: "tdengine" 19 | labels: 20 | app: "tdengine" 21 | spec: 22 | containers: 23 | - name: "tdengine" 24 | image: "tdengine/tdengine:3.0.7.1" 25 | imagePullPolicy: "IfNotPresent" 26 | ports: 27 | - name: tcp6030 28 | protocol: "TCP" 29 | containerPort: 6030 30 | - name: tcp6041 31 | protocol: "TCP" 32 | containerPort: 6041 33 | env: 34 | # POD_NAME for FQDN config 35 | - name: POD_NAME 36 | valueFrom: 37 | fieldRef: 38 | fieldPath: metadata.name 39 | # SERVICE_NAME and NAMESPACE for fqdn resolve 40 | - name: SERVICE_NAME 41 | value: "taosd" 42 | - name: STS_NAME 43 | value: "tdengine" 44 | - name: STS_NAMESPACE 45 | valueFrom: 46 | fieldRef: 47 | fieldPath: metadata.namespace 48 | # TZ for timezone settings, we recommend to always set it. 49 | - name: TZ 50 | value: "Asia/Shanghai" 51 | # TAOS_ prefix will configured in taos.cfg, strip prefix and camelCase. 52 | - name: TAOS_SERVER_PORT 53 | value: "6030" 54 | # Must set if you want a cluster. 55 | - name: TAOS_FIRST_EP 56 | value: "$(STS_NAME)-0.$(SERVICE_NAME).$(STS_NAMESPACE).svc.cluster.local:$(TAOS_SERVER_PORT)" 57 | # TAOS_FQND should always be set in k8s env. 58 | - name: TAOS_FQDN 59 | value: "$(POD_NAME).$(SERVICE_NAME).$(STS_NAMESPACE).svc.cluster.local" 60 | volumeMounts: 61 | - name: taosdata 62 | mountPath: /var/lib/taos 63 | startupProbe: 64 | exec: 65 | command: 66 | - taos-check 67 | failureThreshold: 360 68 | periodSeconds: 10 69 | readinessProbe: 70 | exec: 71 | command: 72 | - taos-check 73 | initialDelaySeconds: 5 74 | timeoutSeconds: 5000 75 | livenessProbe: 76 | exec: 77 | command: 78 | - taos-check 79 | initialDelaySeconds: 15 80 | periodSeconds: 20 81 | volumeClaimTemplates: 82 | - metadata: 83 | name: taosdata 84 | spec: 85 | accessModes: 86 | - "ReadWriteOnce" 87 | storageClassName: "standard" 88 | resources: 89 | requests: 90 | storage: "5Gi" -------------------------------------------------------------------------------- /src/zh/1.0-kubernetes.md: -------------------------------------------------------------------------------- 1 | # 从 Kubernetes开始 2 | 3 | 在 Wikipedia 上的 Kubernetes 简介如此: 4 | 5 | > Kubernetes(常简称为K8s)是用于自动部署、扩展和管理「容器化(containerized)应用程序」的开源系统。 該系統由Google设计并捐赠给Cloud Native Computing Foundation(今属Linux基金会)来使用。 6 | 7 | 鉴于 Kubernetes 已经是目前集群编排和自动化部署的事实标准,TDengine 将会逐步推进 TDengine Server 集群及相关生态工具在 Kubernetes 上部署及应用的支持。 8 | 9 | 在进入下一步之前,希望你对 Kubernetes 有了一定的了解,并对 `kubectl` 基本命令用法有一定的基础(如果没有,请按照提示进行操作即可,但建议您[了解更多](https://kubernetes.io/docs/home/)),并有一个可用的集群环境进行测试。 10 | 11 | 如果当前没有集群环境,可参考下一节的安装指导,使用 Minikube 或 Rancher 进行 Kubernetes 的安装。 12 | -------------------------------------------------------------------------------- /src/zh/1.1-install-kubernetes-with-minikube.md: -------------------------------------------------------------------------------- 1 | # 使用 Minikube 尝鲜 Kubernetes 2 | 3 | > 本文档仅适用于 Linux,其他平台请参[考官方文档](https://minikube.sigs.k8s.io/docs/start/)。 4 | 5 | ## 安装 6 | 7 | 首先,我们需要下载并安装 Minikube: 8 | 9 | ```sh 10 | curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64 11 | sudo install minikube-linux-amd64 /usr/local/bin/minikube 12 | ``` 13 | 14 | ## Start 15 | 16 | 启动一个 Minikube 实例: 17 | 18 | ```sh 19 | minikube start 20 | ``` 21 | 22 | Minikube 将使用 Docker(需要提前安装好,安装Docker请参考[Docker 官方文档](https://docs.docker.com/engine/install/))创建一个 Kubernetes 环境: 23 | 24 | ![minikube-start](./assets/minikube-start.png) 25 | 26 | ## `kubectl` 命令 27 | 28 | 在 minikube 中,可以使用 `minikube kubectl` 命令使用 `kubectl`,以下是获取所有 POD 资源的示例命令: 29 | 30 | ```sh 31 | minikube kubectl -- get pods -A 32 | ``` 33 | 34 | 我们仍然可以正常安装和使用独立的 `kubectl` 命令: 35 | 36 | ```sh 37 | curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" 38 | sudo install kubectl /usr/local/bin/kubectl 39 | ``` 40 | 41 | 以上 `minikube kubectl` 命令的等价版本如下: 42 | 43 | ```sh 44 | kubectl get pods -A 45 | ``` 46 | 47 | 获取存储类名称: 48 | 49 | ```sh 50 | kubectl get sc 51 | ``` 52 | 53 | Minikube 默认情况下会启动名为 `standard` 的默认存储类,存储类的名称我们将会在部署 TDengine 时用到。 54 | 55 | ## 仪表盘 56 | 57 | Minikube 提供了 Kubernetes 仪表盘,使用如下命令启动: 58 | 59 | ```sh 60 | minikube dashboard 61 | ``` 62 | 63 | 将会在浏览器打开仪表盘网址,用于查看资源: 64 | 65 | ![minikube-dashboard](assets/minikube-dashboard.png) 66 | -------------------------------------------------------------------------------- /src/zh/1.2-install-kubernetes-with-rancher.md: -------------------------------------------------------------------------------- 1 | # 使用 Rancher 安装 Kubernetes 2 | 3 | > 如果 Rancher 安装方式发生变化,请始终参考 Rancher 官方文档。 4 | 5 | ## 安装 RancherD 6 | 7 | RancherD 是 Rancher 最新支持的一种部署方案,运行以下命令来安装 RancherD 以进行 Rancher + Kubernetes 的部署。 8 | 9 | ```sh 10 | curl -sfL https://get.rancher.io | sh - 11 | ``` 12 | 13 | 如果遇到网络问题,可以先行下载 rancherD 的安装包再进行手动安装。 14 | 15 | ```sh 16 | # fill the proxy url if you use one 17 | export https_proxy= 18 | curl -s https://api.github.com/repos/rancher/rancher/releases/latest \ 19 | |jq '.assets[] | 20 | select(.browser_download_url|contains("rancherd-amd64.tar.gz")) | 21 | .browser_download_url' -r \ 22 | |wget -ci - 23 | tar xzf rancherd-amd64.tar.gz -C /usr/local 24 | ``` 25 | 26 | 之后只需要启动 rancherd-server 服务就可以得到一个 Kubernetes 环境。 27 | 28 | ```sh 29 | systemctl enable rancherd-server 30 | systemctl start rancherd-server 31 | ``` 32 | 33 | 查看 Kubernetes 安装状态: 34 | 35 | ```sh 36 | journalctl -fu rancherd-server 37 | ``` 38 | 39 | 最后看到 **successfully**,说明 Kubernetes 已安装完成。 40 | 41 | ```log 42 | "Event occurred" object="cn120" kind="Node" apiVersion="v1" \ 43 | type="Normal" reason="Synced" message="Node synced successfully" 44 | ``` 45 | 46 | ## 使用 `kubectl` 47 | 48 | 集群启动后,配置 KUBECONFIG,并将 `rke2` 路径加入环境变量以使用 `kubectl` 命令: 49 | 50 | ```sh 51 | export KUBECONFIG=/etc/rancher/rke2/rke2.yaml 52 | export PATH=$PATH:/var/lib/rancher/rke2/bin 53 | ``` 54 | 55 | 查看 Rancher 部署状态: 56 | 57 | ```sh 58 | kubectl get daemonset rancher -n cattle-system 59 | kubectl get pod -n cattle-system 60 | ``` 61 | 62 | Result: 63 | 64 | ```text 65 | NAME DESIRED CURRENT READY UP-TO-DATE AVAILABLE NODE SELECTOR AGE 66 | rancher 1 1 1 1 1 node-role.kubernetes.io/master=true 36m 67 | NAME READY STATUS RESTARTS AGE 68 | helm-operation-5c2wd 0/2 Completed 0 34m 69 | helm-operation-bdxlx 0/2 Completed 0 33m 70 | helm-operation-cgcvr 0/2 Completed 0 34m 71 | helm-operation-cj4g4 0/2 Completed 0 33m 72 | helm-operation-hq282 0/2 Completed 0 34m 73 | helm-operation-lp5nn 0/2 Completed 0 33m 74 | rancher-kf592 1/1 Running 0 36m 75 | rancher-webhook-65f558c486-vrjz9 1/1 Running 0 33m 76 | ``` 77 | 78 | ## 设置 Rancher 用户名及密码 79 | 80 | ```sh 81 | rancherd reset-admin 82 | ``` 83 | 84 | 你会看到如下的结果: 85 | 86 | ```text 87 | INFO[0000] Server URL: https://*.*.*.*:8443 88 | INFO[0000] Default admin and password created. Username: admin, Password: **** 89 | ``` 90 | 91 | 打开 `:8443` 的网址,可以看到登录页面: 92 | 93 | ![rancher-login-page](assets/rancher-login-page.png) 94 | 95 | 输入上面设置的用户名和密码,进入 Rancher 仪表盘。 96 | 97 | ![rancher-dashboard](assets/rancher-dashboard.png) 98 | 99 | ## 高可用设置 100 | 101 | 获取集群当前的token: `/var/lib/rancher/rke2/server/node-token`。 102 | 103 | 在其他节点上安装 `rancherd-server` 。 104 | 105 | ```sh 106 | tar xzf rancherd-amd64.tar.gz -C /usr/local 107 | systemctl enable rancherd-server 108 | ``` 109 | 110 | 创建 RKE2 配置所在目录: 111 | 112 | ```sh 113 | mkdir -p /etc/rancher/rke2 114 | ``` 115 | 116 | 添加配置文件 `/etc/rancher/rke2/config.yaml`。 117 | 118 | ```yaml 119 | server: https://192.168.60.120:9345 120 | token: 121 | ``` 122 | 123 | `server` 为第一个启动的节点地址加端口号 `9345`,`token` 为上面从文件获取的 token 值。 124 | 125 | 启动 `rancherd-server` 服务,就可以将此节点加入 Kubernetes 集群。 126 | 127 | ```sh 128 | systemctl start rancherd-server 129 | journalctl -fu rancherd-server 130 | ``` 131 | 132 | 其他节点可复制配置和操作,直到所有节点都加入集群。 133 | 134 | 我们使用3个节点,输入 `kubectl get daemonset rancher -n cattle-system`查看当前启动的 rancher 节点数量: 135 | 136 | ```text 137 | NAME DESIRED CURRENT READY UP-TO-DATE AVAILABLE NODE SELECTOR AGE 138 | rancher 3 3 3 3 3 node-role.kubernetes.io/master=true 129m 139 | ``` 140 | 141 | 至此,一个三节点的高可用 Rancher + Kubernetes 集群已经安装成功。 142 | -------------------------------------------------------------------------------- /src/zh/1.4-k8s-starter.md: -------------------------------------------------------------------------------- 1 | # 开始使用 Kubernetes 2 | 3 | 现在我们可以开始用 Kubernetes 了。 4 | 5 | ## StatefulSets 6 | 7 | `starter/stateful-nginx.yaml`: 8 | 9 | ```yaml 10 | apiVersion: v1 11 | kind: Service 12 | metadata: 13 | name: nginx 14 | labels: 15 | app: nginx 16 | spec: 17 | ports: 18 | - port: 80 19 | name: web 20 | clusterIP: None 21 | selector: 22 | app: nginx 23 | --- 24 | apiVersion: apps/v1 25 | kind: StatefulSet 26 | metadata: 27 | name: web 28 | spec: 29 | selector: 30 | matchLabels: 31 | app: nginx # has to match .spec.template.metadata.labels 32 | serviceName: "nginx" 33 | replicas: 3 # by default is 1 34 | template: 35 | metadata: 36 | labels: 37 | app: nginx # has to match .spec.selector.matchLabels 38 | spec: 39 | terminationGracePeriodSeconds: 10 40 | containers: 41 | - name: nginx 42 | image: nginx 43 | ports: 44 | - containerPort: 80 45 | name: web 46 | volumeMounts: 47 | - name: www 48 | mountPath: /usr/share/nginx/html 49 | volumeClaimTemplates: 50 | - metadata: 51 | name: www 52 | spec: 53 | accessModes: [ "ReadWriteOnce" ] 54 | storageClassName: "csi-rbd-sc" 55 | resources: 56 | requests: 57 | storage: 1Gi 58 | ``` 59 | 60 | ```sh 61 | kubectl apply -f starter/stateful-nginx.yaml 62 | ``` 63 | 64 | ## 将 ConfigMap 映射为 Volume 65 | 66 | ```yaml 67 | --- 68 | apiVersion: v1 69 | kind: ConfigMap 70 | metadata: 71 | name: starter-config-map 72 | data: 73 | debugFlag: 135 74 | keep: 3650 75 | --- 76 | apiVersion: v1 77 | kind: Pod 78 | metadata: 79 | name: starter-config-map-as-volume 80 | spec: 81 | containers: 82 | - name: test-container 83 | image: busybox 84 | command: [ "/bin/sh", "-c", "ls /etc/config/" ] 85 | volumeMounts: 86 | - name: starter-config-map-vol 87 | mountPath: /etc/config 88 | volumes: 89 | - name: starter-config-map-vol 90 | configMap: 91 | # Provide the name of the ConfigMap containing the files you want 92 | # to add to the container 93 | name: starter-config-map 94 | restartPolicy: Never 95 | ``` 96 | -------------------------------------------------------------------------------- /src/zh/2.0-tdengine-on-kubernetes.md: -------------------------------------------------------------------------------- 1 | # 在 Kubernetes 上部署 TDengine 集群 2 | 3 | 在本章节,我们希望在第一小节中介绍如何使用 YAML 文件一步一步从头创建一个 TDengine 集群,并重点介绍 Kubernetes 环境下 TDengine 的常用操作,您可以了解到 TDengine 在 Kubernetes 集群中的部署机制。在第二小节中介绍如何使用 Helm 进行 TDengine 的部署,建议在生产环境中使用 Helm Chart 部署方式。我们会持续更新 TDengine Chart,敬请关注。 4 | -------------------------------------------------------------------------------- /src/zh/2.1-tdengine-step-by-step.md: -------------------------------------------------------------------------------- 1 | # 一步一步创建 TDengine 集群 2 | 3 | ## Service 服务 4 | 5 | 创建一个 service 配置文件:`taosd-service.yaml`,服务名称 `metadata.name` (此处为 `"taosd"`) 将在下一步中使用到。添加 TDengine 所用到的所有端口: 6 | 7 | ```yaml 8 | {{#include ../tdengine/taosd-service.yaml }} 9 | ``` 10 | 11 | ## StatefulSet 有状态服务 12 | 13 | 根据 Kubernetes 对各类部署的说明,我们将使用 StatefulSet 作为 TDengine 的服务类型,创建文件 `tdengine.yaml` : 14 | 15 | ```yaml 16 | {{#include ../tdengine/tdengine.yaml }} 17 | ``` 18 | 19 | ## 启动集群 20 | 21 | ```sh 22 | kubectl apply -f taosd-service.yaml 23 | kubectl apply -f tdengine.yaml 24 | ``` 25 | 26 | 上面的配置将生成一个三节点的 TDengine 集群,dnode 是自动配置的,可以使用 `show dnodes` 命令查看当前集群的节点: 27 | 28 | ```sh 29 | kubectl exec -i -t tdengine-0 -- taos -s "show dnodes" 30 | kubectl exec -i -t tdengine-1 -- taos -s "show dnodes" 31 | kubectl exec -i -t tdengine-2 -- taos -s "show dnodes" 32 | ``` 33 | 34 | 一个三节点集群,应输出如下: 35 | 36 | ```sql 37 | Welcome to the TDengine shell from Linux, Client Version:3.0.0.0 38 | Copyright (c) 2022 by TAOS Data, Inc. All rights reserved. 39 | 40 | taos> show dnodes 41 | id | endpoint | vnodes | support_vnodes | status | create_time | note | 42 | ============================================================================================================================================ 43 | 1 | tdengine-0.taosd.default.sv... | 0 | 256 | ready | 2022-06-22 15:29:49.049 | | 44 | 2 | tdengine-1.taosd.default.sv... | 0 | 256 | ready | 2022-06-22 15:30:11.895 | | 45 | 3 | tdengine-2.taosd.default.sv... | 0 | 256 | ready | 2022-06-22 15:30:33.007 | | 46 | Query OK, 3 rows affected (0.004610s) 47 | ``` 48 | 49 | ## 扩容 50 | 51 | TDengine 支持自动扩容: 52 | 53 | ```sh 54 | kubectl scale statefulsets tdengine --replicas=4 55 | ``` 56 | 57 | 检查一下是否生效,首先看下 POD 状态: 58 | 59 | ```sh 60 | kubectl get pods -l app=tdengine 61 | ``` 62 | 63 | Results: 64 | 65 | ```text 66 | NAME READY STATUS RESTARTS AGE 67 | tdengine-0 1/1 Running 0 2m9s 68 | tdengine-1 1/1 Running 0 108s 69 | tdengine-2 1/1 Running 0 86s 70 | tdengine-3 1/1 Running 0 22s 71 | ``` 72 | 73 | TDengine Dnode 状态需要等 POD `ready` 后才能看到: 74 | 75 | ```sh 76 | kubectl exec -i -t tdengine-0 -- taos -s "show dnodes" 77 | ``` 78 | 79 | 扩容后的四节点 TDengine 集群的 dnode 列表: 80 | 81 | ```sql 82 | Welcome to the TDengine shell from Linux, Client Version:3.0.0.0 83 | Copyright (c) 2022 by TAOS Data, Inc. All rights reserved. 84 | 85 | taos> show dnodes 86 | id | endpoint | vnodes | support_vnodes | status | create_time | note | 87 | ============================================================================================================================================ 88 | 1 | tdengine-0.taosd.default.sv... | 0 | 256 | ready | 2022-06-22 15:29:49.049 | | 89 | 2 | tdengine-1.taosd.default.sv... | 0 | 256 | ready | 2022-06-22 15:30:11.895 | | 90 | 3 | tdengine-2.taosd.default.sv... | 0 | 256 | ready | 2022-06-22 15:30:33.007 | | 91 | 4 | tdengine-3.taosd.default.sv... | 0 | 256 | ready | 2022-06-22 15:31:36.204 | | 92 | Query OK, 4 rows affected (0.009594s) 93 | ``` 94 | 95 | ## 缩容 96 | 97 | TDengine 的缩容并没有自动化,我们尝试将一个四节点集群缩容到三节点。 98 | 99 | 想要安全的缩容,首先需要将节点从 dnode 列表中移除: 100 | 101 | ```sh 102 | kubectl exec -i -t tdengine-0 -- taos -s "drop dnode 4" 103 | ``` 104 | 105 | 确认移除成功后(使用 `kubectl exec -i -t tdengine-0 -- taos -s "show dnodes"` 查看和确认 dnode 列表),使用 `kubectl` 命令移除 POD: 106 | 107 | ```sh 108 | kubectl scale statefulsets tdengine --replicas=3 109 | ``` 110 | 111 | 最后一个 POD 将会被删除。使用命令 `kubectl get pods -l app=tdengine` 查看POD状态: 112 | 113 | ```text 114 | NAME READY STATUS RESTARTS AGE 115 | tdengine-0 1/1 Running 0 4m17s 116 | tdengine-1 1/1 Running 0 3m56s 117 | tdengine-2 1/1 Running 0 3m34s 118 | ``` 119 | 120 | POD删除后,需要手动删除PVC,否则下次扩容时会继续使用以前的数据导致无法正常加入集群。 121 | 122 | ```sh 123 | kubectl delete pvc taosdata-tdengine-3 124 | ``` 125 | 126 | 此时TDengine集群才是安全的。之后还可以正常扩容: 127 | 128 | ```sh 129 | kubectl scale statefulsets tdengine --replicas=4 130 | ``` 131 | 132 | `kubectl exec -i -t tdengine-0 -- taos -s "show dnodes"` 结果如下: 133 | 134 | ```sql 135 | id | endpoint | vnodes | support_vnodes | status | create_time | note | 136 | ============================================================================================================================================ 137 | 1 | tdengine-0.taosd.default.sv... | 0 | 256 | ready | 2022-06-22 15:29:49.049 | | 138 | 2 | tdengine-1.taosd.default.sv... | 0 | 256 | ready | 2022-06-22 15:30:11.895 | | 139 | 3 | tdengine-2.taosd.default.sv... | 0 | 256 | ready | 2022-06-22 15:30:33.007 | | 140 | 5 | tdengine-3.taosd.default.sv... | 0 | 256 | ready | 2022-06-22 15:34:35.520 | | 141 | ``` 142 | 143 | ### 错误行为 1 144 | 145 | 扩容到四节点之后缩容到两节点,删除的 POD 会进入 `offline` 状态: 146 | 147 | ```text 148 | Welcome to the TDengine shell from Linux, Client Version:2.1.1.0 149 | Copyright (c) 2020 by TAOS Data, Inc. All rights reserved. 150 | 151 | taos> show dnodes 152 | id | endpoint | vnodes | support_vnodes | status | create_time | note | 153 | ============================================================================================================================================ 154 | 1 | tdengine-0.taosd.default.sv... | 0 | 256 | ready | 2022-06-22 15:29:49.049 | | 155 | 2 | tdengine-1.taosd.default.sv... | 0 | 256 | ready | 2022-06-22 15:30:11.895 | | 156 | 3 | tdengine-2.taosd.default.sv... | 0 | 256 | offline | 2022-06-22 15:30:33.007 | status msg timeout | 157 | 5 | tdengine-3.taosd.default.sv... | 0 | 256 | offline | 2022-06-22 15:34:35.520 | status msg timeout || 158 | Query OK, 4 row(s) in set (0.004293s) 159 | ``` 160 | 161 | 但 `drop dnode` 行为将不会按照预期执行,且下次集群重启后,所有的 dnode 节点将无法启动 `dropping` 状态无法退出。 162 | 163 | ### 错误行为 2 164 | 165 | TDengine集群会持有 `replica` 参数,如果缩容后的节点数小于这个值,集群将无法使用: 166 | 167 | 创建一个库使用 `replica` 参数为 3,插入部分数据: 168 | 169 | ```sh 170 | kubectl exec -i -t tdengine-0 -- \ 171 | taos -s \ 172 | "create database if not exists test replica 3; 173 | use test; 174 | create table if not exists t1(ts timestamp, n int); 175 | insert into t1 values(now, 1)(now+1s, 2);" 176 | ``` 177 | 178 | 缩容到单节点: 179 | 180 | ```sh 181 | kubectl scale statefulsets tdengine --replicas=1 182 | ``` 183 | 184 | 在 taos shell 中的所有数据库操作将无法成功。 185 | 186 | ## 清理 TDengine 集群 187 | 188 | 完整移除 TDengine 集群,需要分别清理 statefulset、svc、pvc。 189 | 190 | ```sh 191 | kubectl delete statefulset -l app=tdengine 192 | kubectl delete svc -l app=tdengine 193 | kubectl delete pvc -l app=tdengine 194 | ``` 195 | 196 | 在下一节,我们将使用 Helm 来提供更灵活便捷的操作方式。 197 | -------------------------------------------------------------------------------- /src/zh/2.2-tdengine-with-helm.md: -------------------------------------------------------------------------------- 1 | # 使用Helm部署TDengine集群 2 | 3 | Helm 是 Kubernetes 的包管理器,上一节中的操作已经足够简单,但Helm依然可以提供更强大的能力。 4 | 5 | ## 安装 Helm 6 | 7 | ```sh 8 | curl -fsSL -o get_helm.sh \ 9 | https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 10 | chmod +x get_helm.sh 11 | ./get_helm.sh 12 | ``` 13 | 14 | Helm 会使用 `kubectl` 和 kubeconfig 的配置来操作 Kubernetes,可以参考 Rancher 安装 Kubernetes 的配置来进行设置。 15 | 16 | ## 安装 TDengine Chart 17 | 18 | TDengine Chart 尚未发布到 Helm 仓库,当前可以从GitHub直接下载: 19 | 20 | ```sh 21 | wget https://github.com/taosdata/TDengine-Operator/raw/3.0/helm/tdengine-3.0.2.tgz 22 | ``` 23 | 24 | 获取当前 Kubernetes 的存储类: 25 | 26 | ```sh 27 | kubectl get storageclass 28 | ``` 29 | 30 | 在 minikube 默认为 `standard`. 31 | 32 | 之后,使用`helm`命令安装: 33 | 34 | ```sh 35 | helm install tdengine tdengine-3.0.2.tgz \ 36 | --set storage.className= 37 | ``` 38 | 39 | 在 minikube 环境下,可以设置一个较小的容量避免超出磁盘可用空间: 40 | 41 | ```sh 42 | helm install tdengine tdengine-3.0.2.tgz \ 43 | --set storage.className=standard \ 44 | --set storage.dataSize=2Gi \ 45 | --set storage.logSize=10Mi 46 | ``` 47 | 48 | 部署成功后,TDengine Chart将会输出操作TDengine的说明: 49 | 50 | ```sh 51 | export POD_NAME=$(kubectl get pods --namespace default \ 52 | -l "app.kubernetes.io/name=tdengine,app.kubernetes.io/instance=tdengine" \ 53 | -o jsonpath="{.items[0].metadata.name}") 54 | kubectl --namespace default exec $POD_NAME -- taos -s "show dnodes; show mnodes" 55 | kubectl --namespace default exec -it $POD_NAME -- taos 56 | ``` 57 | 58 | ![helm-install-with-sc](./assets/helm-install-with-sc.png) 59 | 60 | 您可以自行尝试一下,就像这样: 61 | 62 | ![helm-install-post-script](./assets/helm-install-post-script.png) 63 | 64 | 可以创建一个表进行测试: 65 | 66 | ```sh 67 | kubectl --namespace default exec $POD_NAME -- \ 68 | taos -s "create database test; 69 | use test; 70 | create table t1 (ts timestamp, n int); 71 | insert into t1 values(now, 1)(now + 1s, 2); 72 | select * from t1;" 73 | ``` 74 | 75 | ![taos-sql](assets/kubectl-taos-sql.png) 76 | 77 | ## Values 配置 78 | 79 | TDengine 支持 `values.yaml` 自定义。 80 | 81 | 通过 `helm show values` 可以获取TDengine Chart支持的全部values列表: 82 | 83 | ```sh 84 | helm show values tdengine-3.0.2.tgz 85 | ``` 86 | 87 | 你可以将结果保存为 `values.yaml`,之后可以修改其中的各项参数,如 replica 数量,存储类名称,容量大小,TDengine 配置等,然后使用如下命令安装 TDengine 集群: 88 | 89 | ```sh 90 | helm install tdengine tdengine-3.0.2.tgz -f values.yaml 91 | ``` 92 | 93 | 全部参数如下: 94 | 95 | ```yaml 96 | {{#include ../../helm/tdengine/values.yaml }} 97 | ``` 98 | 99 | ## 扩容 100 | 101 | 关于扩容可参考上一小节的说明,有一些额外的操作需要从 helm 的部署中获取。 102 | 103 | 首先,从部署中获取 StatefulSet 的名称。 104 | 105 | ```sh 106 | export STS_NAME=$(kubectl get statefulset \ 107 | -l "app.kubernetes.io/name=tdengine" \ 108 | -o jsonpath="{.items[0].metadata.name}") 109 | ``` 110 | 111 | 扩容操作极其简单,增加replica即可。以下命令将TDengine扩充到三节点: 112 | 113 | ```sh 114 | kubectl scale --replicas 3 statefulset/$STS_NAME 115 | ``` 116 | 117 | 使用命令 `show dnodes` `show mnodes` 检查是否扩容成功: 118 | 119 | ![helm-scale-up](assets/helm-scale-up.png) 120 | 121 | ## 缩容 122 | 123 | > 缩容操作并没有完整测试,可能造成数据风险,请谨慎使用。 124 | 125 | 相较与上一小节,缩容也需要额外的步骤。 126 | 127 | 获取需要缩容的dnode列表,并手动Drop。 128 | 129 | ```sh 130 | kubectl --namespace default exec $POD_NAME -- \ 131 | cat /var/lib/taos/dnode/dnodeEps.json \ 132 | | jq '.dnodeInfos[1:] |map(.dnodeFqdn + ":" + (.dnodePort|tostring)) | .[]' -r 133 | kubectl --namespace default exec $POD_NAME -- taos -s "show dnodes" 134 | kubectl --namespace default exec $POD_NAME -- taos -s 'drop dnode ""' 135 | ``` 136 | 137 | ![helm-drop-dnode](assets/helm-drop-dnode.png) 138 | 139 | ## 清理 140 | 141 | Helm管理下,清理操作也变得简单: 142 | 143 | ```sh 144 | helm uninstall tdengine 145 | ``` 146 | 147 | 但Helm也不会自动移除PVC,需要手动获取PVC然后删除掉。 148 | -------------------------------------------------------------------------------- /src/zh/README.md: -------------------------------------------------------------------------------- 1 | # TDengine 在 Kubernetes 上的部署 2 | 3 | - 作者:Huo Linhe 4 | - 更新日期:2021-06-09 16:24:00 5 | 6 | 为了支持 [TDengine] 在 [Kubernetes][K8s] 上的部署,特编写此文档。此文档完全开源,源码托管在 [taosdata/TDengine-Operator](https://github.com/taosdata/TDengine-Operator),并欢迎所有人对此文档进行修改,您可以直接提交 Pull Request,也可以添加 Issue,任何一种方式都将是我们的荣幸。TDengine 完善离不开社区的共同努力,谢谢! 7 | 8 | 在本文档中,我们将从部署一套 Kubernetes 环境开始,介绍如何启动 Kubernetes,并在 Kubernetes 上从头部署 TDengine 集群,简单介绍如何在 K8s 环境中进行 TDengine 集群的扩容和缩容,其中我们未能完整支持的地方也会有说明,可能出现问题的操作也作了简要的提示。 9 | 10 | 如果在实际操作过程中遇到问题,您总是可以通过官方微信 tdengine 联系到我们。 11 | 12 | [TDengine]: https://github.com/taosdata/TDengine 13 | [K8s]: https://kubernetes.io/ 14 | -------------------------------------------------------------------------------- /src/zh/SUMMARY.md: -------------------------------------------------------------------------------- 1 | # Summary 2 | 3 | - [Introduction](README.md) 4 | - [从Kubernetes开始](1.0-kubernetes.md) 5 | - [使用Minikube尝鲜Kubernetes](./1.1-install-kubernetes-with-minikube.md) 6 | - [使用Rancher安装Kubernetes](./1.2-install-kubernetes-with-rancher.md) 7 | - [开始使用Kubernetes](./1.4-k8s-starter.md) 8 | - [在Kubernetes上部署TDengine集群](2.0-tdengine-on-kubernetes.md) 9 | - [一步一步创建TDengine集群](./2.1-tdengine-step-by-step.md) 10 | - [使用Helm部署TDengine集群](./2.2-tdengine-with-helm.md) 11 | -------------------------------------------------------------------------------- /src/zh/test.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: v1 3 | kind: ConfigMap 4 | metadata: 5 | name: starter-config-map 6 | data: 7 | debugFlag: "135" 8 | keep: "3650" 9 | --- 10 | apiVersion: v1 11 | kind: Pod 12 | metadata: 13 | name: starter-config-map-as-volume 14 | spec: 15 | containers: 16 | - name: test-container 17 | image: busybox 18 | command: [ "/bin/sh", "-c", "export" ] 19 | envFrom: 20 | - configMapRef: 21 | name: starter-config-map 22 | restartPolicy: Never 23 | --------------------------------------------------------------------------------