├── .gitignore ├── README.md ├── redis-with-acl ├── config │ └── redis.conf └── docker-compose.yaml ├── redis-with-command ├── command │ └── sets.txt ├── config │ └── redis.conf └── docker-compose.yaml ├── redis-with-config ├── config │ └── redis.conf └── docker-compose.yaml ├── redis-with-security ├── config │ └── redis.conf └── docker-compose.yaml └── redis └── docker-compose.yaml /.gitignore: -------------------------------------------------------------------------------- 1 | # Created by .ignore support plugin (hsz.mobi) 2 | ### VisualStudioCode template 3 | .vscode/* 4 | !.vscode/settings.json 5 | !.vscode/tasks.json 6 | !.vscode/launch.json 7 | !.vscode/extensions.json 8 | *.code-workspace 9 | 10 | # Local History for Visual Studio Code 11 | .history/ 12 | 13 | ### JetBrains template 14 | # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider 15 | # Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 16 | 17 | # User-specific stuff 18 | .idea 19 | .idea/**/workspace.xml 20 | .idea/**/tasks.xml 21 | .idea/**/usage.statistics.xml 22 | .idea/**/dictionaries 23 | .idea/**/shelf 24 | 25 | # Generated files 26 | .idea/**/contentModel.xml 27 | 28 | # Sensitive or high-churn files 29 | .idea/**/dataSources/ 30 | .idea/**/dataSources.ids 31 | .idea/**/dataSources.local.xml 32 | .idea/**/sqlDataSources.xml 33 | .idea/**/dynamic.xml 34 | .idea/**/uiDesigner.xml 35 | .idea/**/dbnavigator.xml 36 | 37 | # Gradle 38 | .idea/**/gradle.xml 39 | .idea/**/libraries 40 | 41 | # Gradle and Maven with auto-import 42 | # When using Gradle or Maven with auto-import, you should exclude module files, 43 | # since they will be recreated, and may cause churn. Uncomment if using 44 | # auto-import. 45 | # .idea/artifacts 46 | # .idea/compiler.xml 47 | # .idea/jarRepositories.xml 48 | # .idea/modules.xml 49 | # .idea/*.iml 50 | # .idea/modules 51 | # *.iml 52 | # *.ipr 53 | 54 | # CMake 55 | cmake-build-*/ 56 | 57 | # Mongo Explorer plugin 58 | .idea/**/mongoSettings.xml 59 | 60 | # File-based project format 61 | *.iws 62 | 63 | # IntelliJ 64 | out/ 65 | 66 | # mpeltonen/sbt-idea plugin 67 | .idea_modules/ 68 | 69 | # JIRA plugin 70 | atlassian-ide-plugin.xml 71 | 72 | # Cursive Clojure plugin 73 | .idea/replstate.xml 74 | 75 | # Crashlytics plugin (for Android Studio and IntelliJ) 76 | com_crashlytics_export_strings.xml 77 | crashlytics.properties 78 | crashlytics-build.properties 79 | fabric.properties 80 | 81 | # Editor-based Rest Client 82 | .idea/httpRequests 83 | 84 | # Android studio 3.1+ serialized cache file 85 | .idea/caches/build_file_checksums.ser 86 | 87 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Belajar Redis 2 | 3 | by Programmer Zaman Now -------------------------------------------------------------------------------- /redis-with-acl/docker-compose.yaml: -------------------------------------------------------------------------------- 1 | version: '3.5' 2 | 3 | services: 4 | redis: 5 | container_name: redis 6 | image: redis:6 7 | command: redis-server /usr/local/etc/redis/redis.conf 8 | ports: 9 | - 6379:6379 10 | volumes: 11 | - ./config/redis.conf:/usr/local/etc/redis/redis.conf 12 | redis-client: 13 | container_name: redis-client 14 | image: redis:6 15 | -------------------------------------------------------------------------------- /redis-with-command/command/sets.txt: -------------------------------------------------------------------------------- 1 | set 1 1 2 | set 2 2 3 | set 3 3 4 | set 4 4 5 | set 5 5 6 | set 6 6 7 | set 7 7 8 | set 8 8 9 | set 9 9 10 | set 10 10 11 | set 11 11 12 | set 12 12 13 | set 13 13 14 | set 14 14 15 | set 15 15 16 | set 16 16 17 | set 17 17 18 | set 18 18 19 | set 19 19 20 | set 20 20 21 | set 21 21 22 | set 22 22 23 | set 23 23 24 | set 24 24 25 | set 25 25 26 | set 26 26 27 | set 27 27 28 | set 28 28 29 | set 29 29 30 | set 30 30 31 | set 31 31 32 | set 32 32 33 | set 33 33 34 | set 34 34 35 | set 35 35 36 | set 36 36 37 | set 37 37 38 | set 38 38 39 | set 39 39 40 | set 40 40 41 | set 41 41 42 | set 42 42 43 | set 43 43 44 | set 44 44 45 | set 45 45 46 | set 46 46 47 | set 47 47 48 | set 48 48 49 | set 49 49 50 | set 50 50 51 | set 51 51 52 | set 52 52 53 | set 53 53 54 | set 54 54 55 | set 55 55 56 | set 56 56 57 | set 57 57 58 | set 58 58 59 | set 59 59 60 | set 60 60 61 | set 61 61 62 | set 62 62 63 | set 63 63 64 | set 64 64 65 | set 65 65 66 | set 66 66 67 | set 67 67 68 | set 68 68 69 | set 69 69 70 | set 70 70 71 | set 71 71 72 | set 72 72 73 | set 73 73 74 | set 74 74 75 | set 75 75 76 | set 76 76 77 | set 77 77 78 | set 78 78 79 | set 79 79 80 | set 80 80 81 | set 81 81 82 | set 82 82 83 | set 83 83 84 | set 84 84 85 | set 85 85 86 | set 86 86 87 | set 87 87 88 | set 88 88 89 | set 89 89 90 | set 90 90 91 | set 91 91 92 | set 92 92 93 | set 93 93 94 | set 94 94 95 | set 95 95 96 | set 96 96 97 | set 97 97 98 | set 98 98 99 | set 99 99 100 | set 100 100 101 | set 101 101 102 | set 102 102 103 | set 103 103 104 | set 104 104 105 | set 105 105 106 | set 106 106 107 | set 107 107 108 | set 108 108 109 | set 109 109 110 | set 110 110 111 | set 111 111 112 | set 112 112 113 | set 113 113 114 | set 114 114 115 | set 115 115 116 | set 116 116 117 | set 117 117 118 | set 118 118 119 | set 119 119 120 | set 120 120 121 | set 121 121 122 | set 122 122 123 | set 123 123 124 | set 124 124 125 | set 125 125 126 | set 126 126 127 | set 127 127 128 | set 128 128 129 | set 129 129 130 | set 130 130 131 | set 131 131 132 | set 132 132 133 | set 133 133 134 | set 134 134 135 | set 135 135 136 | set 136 136 137 | set 137 137 138 | set 138 138 139 | set 139 139 140 | set 140 140 141 | set 141 141 142 | set 142 142 143 | set 143 143 144 | set 144 144 145 | set 145 145 146 | set 146 146 147 | set 147 147 148 | set 148 148 149 | set 149 149 150 | set 150 150 151 | set 151 151 152 | set 152 152 153 | set 153 153 154 | set 154 154 155 | set 155 155 156 | set 156 156 157 | set 157 157 158 | set 158 158 159 | set 159 159 160 | set 160 160 161 | set 161 161 162 | set 162 162 163 | set 163 163 164 | set 164 164 165 | set 165 165 166 | set 166 166 167 | set 167 167 168 | set 168 168 169 | set 169 169 170 | set 170 170 171 | set 171 171 172 | set 172 172 173 | set 173 173 174 | set 174 174 175 | set 175 175 176 | set 176 176 177 | set 177 177 178 | set 178 178 179 | set 179 179 180 | set 180 180 181 | set 181 181 182 | set 182 182 183 | set 183 183 184 | set 184 184 185 | set 185 185 186 | set 186 186 187 | set 187 187 188 | set 188 188 189 | set 189 189 190 | set 190 190 191 | set 191 191 192 | set 192 192 193 | set 193 193 194 | set 194 194 195 | set 195 195 196 | set 196 196 197 | set 197 197 198 | set 198 198 199 | set 199 199 200 | set 200 200 201 | set 201 201 202 | set 202 202 203 | set 203 203 204 | set 204 204 205 | set 205 205 206 | set 206 206 207 | set 207 207 208 | set 208 208 209 | set 209 209 210 | set 210 210 211 | set 211 211 212 | set 212 212 213 | set 213 213 214 | set 214 214 215 | set 215 215 216 | set 216 216 217 | set 217 217 218 | set 218 218 219 | set 219 219 220 | set 220 220 221 | set 221 221 222 | set 222 222 223 | set 223 223 224 | set 224 224 225 | set 225 225 226 | set 226 226 227 | set 227 227 228 | set 228 228 229 | set 229 229 230 | set 230 230 231 | set 231 231 232 | set 232 232 233 | set 233 233 234 | set 234 234 235 | set 235 235 236 | set 236 236 237 | set 237 237 238 | set 238 238 239 | set 239 239 240 | set 240 240 241 | set 241 241 242 | set 242 242 243 | set 243 243 244 | set 244 244 245 | set 245 245 246 | set 246 246 247 | set 247 247 248 | set 248 248 249 | set 249 249 250 | set 250 250 251 | set 251 251 252 | set 252 252 253 | set 253 253 254 | set 254 254 255 | set 255 255 256 | set 256 256 257 | set 257 257 258 | set 258 258 259 | set 259 259 260 | set 260 260 261 | set 261 261 262 | set 262 262 263 | set 263 263 264 | set 264 264 265 | set 265 265 266 | set 266 266 267 | set 267 267 268 | set 268 268 269 | set 269 269 270 | set 270 270 271 | set 271 271 272 | set 272 272 273 | set 273 273 274 | set 274 274 275 | set 275 275 276 | set 276 276 277 | set 277 277 278 | set 278 278 279 | set 279 279 280 | set 280 280 281 | set 281 281 282 | set 282 282 283 | set 283 283 284 | set 284 284 285 | set 285 285 286 | set 286 286 287 | set 287 287 288 | set 288 288 289 | set 289 289 290 | set 290 290 291 | set 291 291 292 | set 292 292 293 | set 293 293 294 | set 294 294 295 | set 295 295 296 | set 296 296 297 | set 297 297 298 | set 298 298 299 | set 299 299 300 | set 300 300 301 | set 301 301 302 | set 302 302 303 | set 303 303 304 | set 304 304 305 | set 305 305 306 | set 306 306 307 | set 307 307 308 | set 308 308 309 | set 309 309 310 | set 310 310 311 | set 311 311 312 | set 312 312 313 | set 313 313 314 | set 314 314 315 | set 315 315 316 | set 316 316 317 | set 317 317 318 | set 318 318 319 | set 319 319 320 | set 320 320 321 | set 321 321 322 | set 322 322 323 | set 323 323 324 | set 324 324 325 | set 325 325 326 | set 326 326 327 | set 327 327 328 | set 328 328 329 | set 329 329 330 | set 330 330 331 | set 331 331 332 | set 332 332 333 | set 333 333 334 | set 334 334 335 | set 335 335 336 | set 336 336 337 | set 337 337 338 | set 338 338 339 | set 339 339 340 | set 340 340 341 | set 341 341 342 | set 342 342 343 | set 343 343 344 | set 344 344 345 | set 345 345 346 | set 346 346 347 | set 347 347 348 | set 348 348 349 | set 349 349 350 | set 350 350 351 | set 351 351 352 | set 352 352 353 | set 353 353 354 | set 354 354 355 | set 355 355 356 | set 356 356 357 | set 357 357 358 | set 358 358 359 | set 359 359 360 | set 360 360 361 | set 361 361 362 | set 362 362 363 | set 363 363 364 | set 364 364 365 | set 365 365 366 | set 366 366 367 | set 367 367 368 | set 368 368 369 | set 369 369 370 | set 370 370 371 | set 371 371 372 | set 372 372 373 | set 373 373 374 | set 374 374 375 | set 375 375 376 | set 376 376 377 | set 377 377 378 | set 378 378 379 | set 379 379 380 | set 380 380 381 | set 381 381 382 | set 382 382 383 | set 383 383 384 | set 384 384 385 | set 385 385 386 | set 386 386 387 | set 387 387 388 | set 388 388 389 | set 389 389 390 | set 390 390 391 | set 391 391 392 | set 392 392 393 | set 393 393 394 | set 394 394 395 | set 395 395 396 | set 396 396 397 | set 397 397 398 | set 398 398 399 | set 399 399 400 | set 400 400 401 | set 401 401 402 | set 402 402 403 | set 403 403 404 | set 404 404 405 | set 405 405 406 | set 406 406 407 | set 407 407 408 | set 408 408 409 | set 409 409 410 | set 410 410 411 | set 411 411 412 | set 412 412 413 | set 413 413 414 | set 414 414 415 | set 415 415 416 | set 416 416 417 | set 417 417 418 | set 418 418 419 | set 419 419 420 | set 420 420 421 | set 421 421 422 | set 422 422 423 | set 423 423 424 | set 424 424 425 | set 425 425 426 | set 426 426 427 | set 427 427 428 | set 428 428 429 | set 429 429 430 | set 430 430 431 | set 431 431 432 | set 432 432 433 | set 433 433 434 | set 434 434 435 | set 435 435 436 | set 436 436 437 | set 437 437 438 | set 438 438 439 | set 439 439 440 | set 440 440 441 | set 441 441 442 | set 442 442 443 | set 443 443 444 | set 444 444 445 | set 445 445 446 | set 446 446 447 | set 447 447 448 | set 448 448 449 | set 449 449 450 | set 450 450 451 | set 451 451 452 | set 452 452 453 | set 453 453 454 | set 454 454 455 | set 455 455 456 | set 456 456 457 | set 457 457 458 | set 458 458 459 | set 459 459 460 | set 460 460 461 | set 461 461 462 | set 462 462 463 | set 463 463 464 | set 464 464 465 | set 465 465 466 | set 466 466 467 | set 467 467 468 | set 468 468 469 | set 469 469 470 | set 470 470 471 | set 471 471 472 | set 472 472 473 | set 473 473 474 | set 474 474 475 | set 475 475 476 | set 476 476 477 | set 477 477 478 | set 478 478 479 | set 479 479 480 | set 480 480 481 | set 481 481 482 | set 482 482 483 | set 483 483 484 | set 484 484 485 | set 485 485 486 | set 486 486 487 | set 487 487 488 | set 488 488 489 | set 489 489 490 | set 490 490 491 | set 491 491 492 | set 492 492 493 | set 493 493 494 | set 494 494 495 | set 495 495 496 | set 496 496 497 | set 497 497 498 | set 498 498 499 | set 499 499 500 | set 500 500 501 | set 501 501 502 | set 502 502 503 | set 503 503 504 | set 504 504 505 | set 505 505 506 | set 506 506 507 | set 507 507 508 | set 508 508 509 | set 509 509 510 | set 510 510 511 | set 511 511 512 | set 512 512 513 | set 513 513 514 | set 514 514 515 | set 515 515 516 | set 516 516 517 | set 517 517 518 | set 518 518 519 | set 519 519 520 | set 520 520 521 | set 521 521 522 | set 522 522 523 | set 523 523 524 | set 524 524 525 | set 525 525 526 | set 526 526 527 | set 527 527 528 | set 528 528 529 | set 529 529 530 | set 530 530 531 | set 531 531 532 | set 532 532 533 | set 533 533 534 | set 534 534 535 | set 535 535 536 | set 536 536 537 | set 537 537 538 | set 538 538 539 | set 539 539 540 | set 540 540 541 | set 541 541 542 | set 542 542 543 | set 543 543 544 | set 544 544 545 | set 545 545 546 | set 546 546 547 | set 547 547 548 | set 548 548 549 | set 549 549 550 | set 550 550 551 | set 551 551 552 | set 552 552 553 | set 553 553 554 | set 554 554 555 | set 555 555 556 | set 556 556 557 | set 557 557 558 | set 558 558 559 | set 559 559 560 | set 560 560 561 | set 561 561 562 | set 562 562 563 | set 563 563 564 | set 564 564 565 | set 565 565 566 | set 566 566 567 | set 567 567 568 | set 568 568 569 | set 569 569 570 | set 570 570 571 | set 571 571 572 | set 572 572 573 | set 573 573 574 | set 574 574 575 | set 575 575 576 | set 576 576 577 | set 577 577 578 | set 578 578 579 | set 579 579 580 | set 580 580 581 | set 581 581 582 | set 582 582 583 | set 583 583 584 | set 584 584 585 | set 585 585 586 | set 586 586 587 | set 587 587 588 | set 588 588 589 | set 589 589 590 | set 590 590 591 | set 591 591 592 | set 592 592 593 | set 593 593 594 | set 594 594 595 | set 595 595 596 | set 596 596 597 | set 597 597 598 | set 598 598 599 | set 599 599 600 | set 600 600 601 | set 601 601 602 | set 602 602 603 | set 603 603 604 | set 604 604 605 | set 605 605 606 | set 606 606 607 | set 607 607 608 | set 608 608 609 | set 609 609 610 | set 610 610 611 | set 611 611 612 | set 612 612 613 | set 613 613 614 | set 614 614 615 | set 615 615 616 | set 616 616 617 | set 617 617 618 | set 618 618 619 | set 619 619 620 | set 620 620 621 | set 621 621 622 | set 622 622 623 | set 623 623 624 | set 624 624 625 | set 625 625 626 | set 626 626 627 | set 627 627 628 | set 628 628 629 | set 629 629 630 | set 630 630 631 | set 631 631 632 | set 632 632 633 | set 633 633 634 | set 634 634 635 | set 635 635 636 | set 636 636 637 | set 637 637 638 | set 638 638 639 | set 639 639 640 | set 640 640 641 | set 641 641 642 | set 642 642 643 | set 643 643 644 | set 644 644 645 | set 645 645 646 | set 646 646 647 | set 647 647 648 | set 648 648 649 | set 649 649 650 | set 650 650 651 | set 651 651 652 | set 652 652 653 | set 653 653 654 | set 654 654 655 | set 655 655 656 | set 656 656 657 | set 657 657 658 | set 658 658 659 | set 659 659 660 | set 660 660 661 | set 661 661 662 | set 662 662 663 | set 663 663 664 | set 664 664 665 | set 665 665 666 | set 666 666 667 | set 667 667 668 | set 668 668 669 | set 669 669 670 | set 670 670 671 | set 671 671 672 | set 672 672 673 | set 673 673 674 | set 674 674 675 | set 675 675 676 | set 676 676 677 | set 677 677 678 | set 678 678 679 | set 679 679 680 | set 680 680 681 | set 681 681 682 | set 682 682 683 | set 683 683 684 | set 684 684 685 | set 685 685 686 | set 686 686 687 | set 687 687 688 | set 688 688 689 | set 689 689 690 | set 690 690 691 | set 691 691 692 | set 692 692 693 | set 693 693 694 | set 694 694 695 | set 695 695 696 | set 696 696 697 | set 697 697 698 | set 698 698 699 | set 699 699 700 | set 700 700 701 | set 701 701 702 | set 702 702 703 | set 703 703 704 | set 704 704 705 | set 705 705 706 | set 706 706 707 | set 707 707 708 | set 708 708 709 | set 709 709 710 | set 710 710 711 | set 711 711 712 | set 712 712 713 | set 713 713 714 | set 714 714 715 | set 715 715 716 | set 716 716 717 | set 717 717 718 | set 718 718 719 | set 719 719 720 | set 720 720 721 | set 721 721 722 | set 722 722 723 | set 723 723 724 | set 724 724 725 | set 725 725 726 | set 726 726 727 | set 727 727 728 | set 728 728 729 | set 729 729 730 | set 730 730 731 | set 731 731 732 | set 732 732 733 | set 733 733 734 | set 734 734 735 | set 735 735 736 | set 736 736 737 | set 737 737 738 | set 738 738 739 | set 739 739 740 | set 740 740 741 | set 741 741 742 | set 742 742 743 | set 743 743 744 | set 744 744 745 | set 745 745 746 | set 746 746 747 | set 747 747 748 | set 748 748 749 | set 749 749 750 | set 750 750 751 | set 751 751 752 | set 752 752 753 | set 753 753 754 | set 754 754 755 | set 755 755 756 | set 756 756 757 | set 757 757 758 | set 758 758 759 | set 759 759 760 | set 760 760 761 | set 761 761 762 | set 762 762 763 | set 763 763 764 | set 764 764 765 | set 765 765 766 | set 766 766 767 | set 767 767 768 | set 768 768 769 | set 769 769 770 | set 770 770 771 | set 771 771 772 | set 772 772 773 | set 773 773 774 | set 774 774 775 | set 775 775 776 | set 776 776 777 | set 777 777 778 | set 778 778 779 | set 779 779 780 | set 780 780 781 | set 781 781 782 | set 782 782 783 | set 783 783 784 | set 784 784 785 | set 785 785 786 | set 786 786 787 | set 787 787 788 | set 788 788 789 | set 789 789 790 | set 790 790 791 | set 791 791 792 | set 792 792 793 | set 793 793 794 | set 794 794 795 | set 795 795 796 | set 796 796 797 | set 797 797 798 | set 798 798 799 | set 799 799 800 | set 800 800 801 | set 801 801 802 | set 802 802 803 | set 803 803 804 | set 804 804 805 | set 805 805 806 | set 806 806 807 | set 807 807 808 | set 808 808 809 | set 809 809 810 | set 810 810 811 | set 811 811 812 | set 812 812 813 | set 813 813 814 | set 814 814 815 | set 815 815 816 | set 816 816 817 | set 817 817 818 | set 818 818 819 | set 819 819 820 | set 820 820 821 | set 821 821 822 | set 822 822 823 | set 823 823 824 | set 824 824 825 | set 825 825 826 | set 826 826 827 | set 827 827 828 | set 828 828 829 | set 829 829 830 | set 830 830 831 | set 831 831 832 | set 832 832 833 | set 833 833 834 | set 834 834 835 | set 835 835 836 | set 836 836 837 | set 837 837 838 | set 838 838 839 | set 839 839 840 | set 840 840 841 | set 841 841 842 | set 842 842 843 | set 843 843 844 | set 844 844 845 | set 845 845 846 | set 846 846 847 | set 847 847 848 | set 848 848 849 | set 849 849 850 | set 850 850 851 | set 851 851 852 | set 852 852 853 | set 853 853 854 | set 854 854 855 | set 855 855 856 | set 856 856 857 | set 857 857 858 | set 858 858 859 | set 859 859 860 | set 860 860 861 | set 861 861 862 | set 862 862 863 | set 863 863 864 | set 864 864 865 | set 865 865 866 | set 866 866 867 | set 867 867 868 | set 868 868 869 | set 869 869 870 | set 870 870 871 | set 871 871 872 | set 872 872 873 | set 873 873 874 | set 874 874 875 | set 875 875 876 | set 876 876 877 | set 877 877 878 | set 878 878 879 | set 879 879 880 | set 880 880 881 | set 881 881 882 | set 882 882 883 | set 883 883 884 | set 884 884 885 | set 885 885 886 | set 886 886 887 | set 887 887 888 | set 888 888 889 | set 889 889 890 | set 890 890 891 | set 891 891 892 | set 892 892 893 | set 893 893 894 | set 894 894 895 | set 895 895 896 | set 896 896 897 | set 897 897 898 | set 898 898 899 | set 899 899 900 | set 900 900 901 | set 901 901 902 | set 902 902 903 | set 903 903 904 | set 904 904 905 | set 905 905 906 | set 906 906 907 | set 907 907 908 | set 908 908 909 | set 909 909 910 | set 910 910 911 | set 911 911 912 | set 912 912 913 | set 913 913 914 | set 914 914 915 | set 915 915 916 | set 916 916 917 | set 917 917 918 | set 918 918 919 | set 919 919 920 | set 920 920 921 | set 921 921 922 | set 922 922 923 | set 923 923 924 | set 924 924 925 | set 925 925 926 | set 926 926 927 | set 927 927 928 | set 928 928 929 | set 929 929 930 | set 930 930 931 | set 931 931 932 | set 932 932 933 | set 933 933 934 | set 934 934 935 | set 935 935 936 | set 936 936 937 | set 937 937 938 | set 938 938 939 | set 939 939 940 | set 940 940 941 | set 941 941 942 | set 942 942 943 | set 943 943 944 | set 944 944 945 | set 945 945 946 | set 946 946 947 | set 947 947 948 | set 948 948 949 | set 949 949 950 | set 950 950 951 | set 951 951 952 | set 952 952 953 | set 953 953 954 | set 954 954 955 | set 955 955 956 | set 956 956 957 | set 957 957 958 | set 958 958 959 | set 959 959 960 | set 960 960 961 | set 961 961 962 | set 962 962 963 | set 963 963 964 | set 964 964 965 | set 965 965 966 | set 966 966 967 | set 967 967 968 | set 968 968 969 | set 969 969 970 | set 970 970 971 | set 971 971 972 | set 972 972 973 | set 973 973 974 | set 974 974 975 | set 975 975 976 | set 976 976 977 | set 977 977 978 | set 978 978 979 | set 979 979 980 | set 980 980 981 | set 981 981 982 | set 982 982 983 | set 983 983 984 | set 984 984 985 | set 985 985 986 | set 986 986 987 | set 987 987 988 | set 988 988 989 | set 989 989 990 | set 990 990 991 | set 991 991 992 | set 992 992 993 | set 993 993 994 | set 994 994 995 | set 995 995 996 | set 996 996 997 | set 997 997 998 | set 998 998 999 | set 999 999 1000 | set 1000 1000 1001 | -------------------------------------------------------------------------------- /redis-with-command/config/redis.conf: -------------------------------------------------------------------------------- 1 | # Redis configuration file example. 2 | # 3 | # Note that in order to read the configuration file, Redis must be 4 | # started with the file path as first argument: 5 | # 6 | # ./redis-server /path/to/redis.conf 7 | 8 | # Note on units: when memory size is needed, it is possible to specify 9 | # it in the usual form of 1k 5GB 4M and so forth: 10 | # 11 | # 1k => 1000 bytes 12 | # 1kb => 1024 bytes 13 | # 1m => 1000000 bytes 14 | # 1mb => 1024*1024 bytes 15 | # 1g => 1000000000 bytes 16 | # 1gb => 1024*1024*1024 bytes 17 | # 18 | # units are case insensitive so 1GB 1Gb 1gB are all the same. 19 | 20 | ################################## INCLUDES ################################### 21 | 22 | # Include one or more other config files here. This is useful if you 23 | # have a standard template that goes to all Redis servers but also need 24 | # to customize a few per-server settings. Include files can include 25 | # other files, so use this wisely. 26 | # 27 | # Notice option "include" won't be rewritten by command "CONFIG REWRITE" 28 | # from admin or Redis Sentinel. Since Redis always uses the last processed 29 | # line as value of a configuration directive, you'd better put includes 30 | # at the beginning of this file to avoid overwriting config change at runtime. 31 | # 32 | # If instead you are interested in using includes to override configuration 33 | # options, it is better to use include as the last line. 34 | # 35 | # include /path/to/local.conf 36 | # include /path/to/other.conf 37 | 38 | ################################## MODULES ##################################### 39 | 40 | # Load modules at startup. If the server is not able to load modules 41 | # it will abort. It is possible to use multiple loadmodule directives. 42 | # 43 | # loadmodule /path/to/my_module.so 44 | # loadmodule /path/to/other_module.so 45 | 46 | ################################## NETWORK ##################################### 47 | 48 | # By default, if no "bind" configuration directive is specified, Redis listens 49 | # for connections from all the network interfaces available on the server. 50 | # It is possible to listen to just one or multiple selected interfaces using 51 | # the "bind" configuration directive, followed by one or more IP addresses. 52 | # 53 | # Examples: 54 | # 55 | # bind 192.168.1.100 10.0.0.1 56 | # bind 127.0.0.1 ::1 57 | # 58 | # ~~~ WARNING ~~~ If the computer running Redis is directly exposed to the 59 | # internet, binding to all the interfaces is dangerous and will expose the 60 | # instance to everybody on the internet. So by default we uncomment the 61 | # following bind directive, that will force Redis to listen only into 62 | # the IPv4 loopback interface address (this means Redis will be able to 63 | # accept connections only from clients running into the same computer it 64 | # is running). 65 | # 66 | # IF YOU ARE SURE YOU WANT YOUR INSTANCE TO LISTEN TO ALL THE INTERFACES 67 | # JUST COMMENT THE FOLLOWING LINE. 68 | # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 69 | bind 127.0.0.1 70 | 71 | # Protected mode is a layer of security protection, in order to avoid that 72 | # Redis instances left open on the internet are accessed and exploited. 73 | # 74 | # When protected mode is on and if: 75 | # 76 | # 1) The server is not binding explicitly to a set of addresses using the 77 | # "bind" directive. 78 | # 2) No password is configured. 79 | # 80 | # The server only accepts connections from clients connecting from the 81 | # IPv4 and IPv6 loopback addresses 127.0.0.1 and ::1, and from Unix domain 82 | # sockets. 83 | # 84 | # By default protected mode is enabled. You should disable it only if 85 | # you are sure you want clients from other hosts to connect to Redis 86 | # even if no authentication is configured, nor a specific set of interfaces 87 | # are explicitly listed using the "bind" directive. 88 | protected-mode yes 89 | 90 | # Accept connections on the specified port, default is 6379 (IANA #815344). 91 | # If port 0 is specified Redis will not listen on a TCP socket. 92 | port 6379 93 | 94 | # TCP listen() backlog. 95 | # 96 | # In high requests-per-second environments you need an high backlog in order 97 | # to avoid slow clients connections issues. Note that the Linux kernel 98 | # will silently truncate it to the value of /proc/sys/net/core/somaxconn so 99 | # make sure to raise both the value of somaxconn and tcp_max_syn_backlog 100 | # in order to get the desired effect. 101 | tcp-backlog 511 102 | 103 | # Unix socket. 104 | # 105 | # Specify the path for the Unix socket that will be used to listen for 106 | # incoming connections. There is no default, so Redis will not listen 107 | # on a unix socket when not specified. 108 | # 109 | # unixsocket /tmp/redis.sock 110 | # unixsocketperm 700 111 | 112 | # Close the connection after a client is idle for N seconds (0 to disable) 113 | timeout 0 114 | 115 | # TCP keepalive. 116 | # 117 | # If non-zero, use SO_KEEPALIVE to send TCP ACKs to clients in absence 118 | # of communication. This is useful for two reasons: 119 | # 120 | # 1) Detect dead peers. 121 | # 2) Take the connection alive from the point of view of network 122 | # equipment in the middle. 123 | # 124 | # On Linux, the specified value (in seconds) is the period used to send ACKs. 125 | # Note that to close the connection the double of the time is needed. 126 | # On other kernels the period depends on the kernel configuration. 127 | # 128 | # A reasonable value for this option is 300 seconds, which is the new 129 | # Redis default starting with Redis 3.2.1. 130 | tcp-keepalive 300 131 | 132 | ################################# TLS/SSL ##################################### 133 | 134 | # By default, TLS/SSL is disabled. To enable it, the "tls-port" configuration 135 | # directive can be used to define TLS-listening ports. To enable TLS on the 136 | # default port, use: 137 | # 138 | # port 0 139 | # tls-port 6379 140 | 141 | # Configure a X.509 certificate and private key to use for authenticating the 142 | # server to connected clients, masters or cluster peers. These files should be 143 | # PEM formatted. 144 | # 145 | # tls-cert-file redis.crt 146 | # tls-key-file redis.key 147 | 148 | # Configure a DH parameters file to enable Diffie-Hellman (DH) key exchange: 149 | # 150 | # tls-dh-params-file redis.dh 151 | 152 | # Configure a CA certificate(s) bundle or directory to authenticate TLS/SSL 153 | # clients and peers. Redis requires an explicit configuration of at least one 154 | # of these, and will not implicitly use the system wide configuration. 155 | # 156 | # tls-ca-cert-file ca.crt 157 | # tls-ca-cert-dir /etc/ssl/certs 158 | 159 | # By default, clients (including replica servers) on a TLS port are required 160 | # to authenticate using valid client side certificates. 161 | # 162 | # It is possible to disable authentication using this directive. 163 | # 164 | # tls-auth-clients no 165 | 166 | # By default, a Redis replica does not attempt to establish a TLS connection 167 | # with its master. 168 | # 169 | # Use the following directive to enable TLS on replication links. 170 | # 171 | # tls-replication yes 172 | 173 | # By default, the Redis Cluster bus uses a plain TCP connection. To enable 174 | # TLS for the bus protocol, use the following directive: 175 | # 176 | # tls-cluster yes 177 | 178 | # Explicitly specify TLS versions to support. Allowed values are case insensitive 179 | # and include "TLSv1", "TLSv1.1", "TLSv1.2", "TLSv1.3" (OpenSSL >= 1.1.1) 180 | # 181 | # tls-protocols TLSv1.2 182 | 183 | # Configure allowed ciphers. See the ciphers(1ssl) manpage for more information 184 | # about the syntax of this string. 185 | # 186 | # Note: this configuration applies only to <= TLSv1.2. 187 | # 188 | # tls-ciphers DEFAULT:!MEDIUM 189 | 190 | # Configure allowed TLSv1.3 ciphersuites. See the ciphers(1ssl) manpage for more 191 | # information about the syntax of this string, and specifically for TLSv1.3 192 | # ciphersuites. 193 | # 194 | # tls-ciphersuites TLS_CHACHA20_POLY1305_SHA256 195 | 196 | # When choosing a cipher, use the server's preference instead of the client 197 | # preference. By default, the server follows the client's preference. 198 | # 199 | # tls-prefer-server-ciphers yes 200 | 201 | ################################# GENERAL ##################################### 202 | 203 | # By default Redis does not run as a daemon. Use 'yes' if you need it. 204 | # Note that Redis will write a pid file in /var/run/redis.pid when daemonized. 205 | daemonize no 206 | 207 | # If you run Redis from upstart or systemd, Redis can interact with your 208 | # supervision tree. Options: 209 | # supervised no - no supervision interaction 210 | # supervised upstart - signal upstart by putting Redis into SIGSTOP mode 211 | # supervised systemd - signal systemd by writing READY=1 to $NOTIFY_SOCKET 212 | # supervised auto - detect upstart or systemd method based on 213 | # UPSTART_JOB or NOTIFY_SOCKET environment variables 214 | # Note: these supervision methods only signal "process is ready." 215 | # They do not enable continuous liveness pings back to your supervisor. 216 | supervised no 217 | 218 | # If a pid file is specified, Redis writes it where specified at startup 219 | # and removes it at exit. 220 | # 221 | # When the server runs non daemonized, no pid file is created if none is 222 | # specified in the configuration. When the server is daemonized, the pid file 223 | # is used even if not specified, defaulting to "/var/run/redis.pid". 224 | # 225 | # Creating a pid file is best effort: if Redis is not able to create it 226 | # nothing bad happens, the server will start and run normally. 227 | pidfile /var/run/redis_6379.pid 228 | 229 | # Specify the server verbosity level. 230 | # This can be one of: 231 | # debug (a lot of information, useful for development/testing) 232 | # verbose (many rarely useful info, but not a mess like the debug level) 233 | # notice (moderately verbose, what you want in production probably) 234 | # warning (only very important / critical messages are logged) 235 | loglevel notice 236 | 237 | # Specify the log file name. Also the empty string can be used to force 238 | # Redis to log on the standard output. Note that if you use standard 239 | # output for logging but daemonize, logs will be sent to /dev/null 240 | logfile "" 241 | 242 | # To enable logging to the system logger, just set 'syslog-enabled' to yes, 243 | # and optionally update the other syslog parameters to suit your needs. 244 | # syslog-enabled no 245 | 246 | # Specify the syslog identity. 247 | # syslog-ident redis 248 | 249 | # Specify the syslog facility. Must be USER or between LOCAL0-LOCAL7. 250 | # syslog-facility local0 251 | 252 | # Set the number of databases. The default database is DB 0, you can select 253 | # a different one on a per-connection basis using SELECT where 254 | # dbid is a number between 0 and 'databases'-1 255 | databases 16 256 | 257 | # By default Redis shows an ASCII art logo only when started to log to the 258 | # standard output and if the standard output is a TTY. Basically this means 259 | # that normally a logo is displayed only in interactive sessions. 260 | # 261 | # However it is possible to force the pre-4.0 behavior and always show a 262 | # ASCII art logo in startup logs by setting the following option to yes. 263 | always-show-logo yes 264 | 265 | ################################ SNAPSHOTTING ################################ 266 | # 267 | # Save the DB on disk: 268 | # 269 | # save 270 | # 271 | # Will save the DB if both the given number of seconds and the given 272 | # number of write operations against the DB occurred. 273 | # 274 | # In the example below the behaviour will be to save: 275 | # after 900 sec (15 min) if at least 1 key changed 276 | # after 300 sec (5 min) if at least 10 keys changed 277 | # after 60 sec if at least 10000 keys changed 278 | # 279 | # Note: you can disable saving completely by commenting out all "save" lines. 280 | # 281 | # It is also possible to remove all the previously configured save 282 | # points by adding a save directive with a single empty string argument 283 | # like in the following example: 284 | # 285 | # save "" 286 | 287 | save 900 1 288 | save 300 10 289 | save 60 10000 290 | 291 | # By default Redis will stop accepting writes if RDB snapshots are enabled 292 | # (at least one save point) and the latest background save failed. 293 | # This will make the user aware (in a hard way) that data is not persisting 294 | # on disk properly, otherwise chances are that no one will notice and some 295 | # disaster will happen. 296 | # 297 | # If the background saving process will start working again Redis will 298 | # automatically allow writes again. 299 | # 300 | # However if you have setup your proper monitoring of the Redis server 301 | # and persistence, you may want to disable this feature so that Redis will 302 | # continue to work as usual even if there are problems with disk, 303 | # permissions, and so forth. 304 | stop-writes-on-bgsave-error yes 305 | 306 | # Compress string objects using LZF when dump .rdb databases? 307 | # For default that's set to 'yes' as it's almost always a win. 308 | # If you want to save some CPU in the saving child set it to 'no' but 309 | # the dataset will likely be bigger if you have compressible values or keys. 310 | rdbcompression yes 311 | 312 | # Since version 5 of RDB a CRC64 checksum is placed at the end of the file. 313 | # This makes the format more resistant to corruption but there is a performance 314 | # hit to pay (around 10%) when saving and loading RDB files, so you can disable it 315 | # for maximum performances. 316 | # 317 | # RDB files created with checksum disabled have a checksum of zero that will 318 | # tell the loading code to skip the check. 319 | rdbchecksum yes 320 | 321 | # The filename where to dump the DB 322 | dbfilename dump.rdb 323 | 324 | # Remove RDB files used by replication in instances without persistence 325 | # enabled. By default this option is disabled, however there are environments 326 | # where for regulations or other security concerns, RDB files persisted on 327 | # disk by masters in order to feed replicas, or stored on disk by replicas 328 | # in order to load them for the initial synchronization, should be deleted 329 | # ASAP. Note that this option ONLY WORKS in instances that have both AOF 330 | # and RDB persistence disabled, otherwise is completely ignored. 331 | # 332 | # An alternative (and sometimes better) way to obtain the same effect is 333 | # to use diskless replication on both master and replicas instances. However 334 | # in the case of replicas, diskless is not always an option. 335 | rdb-del-sync-files no 336 | 337 | # The working directory. 338 | # 339 | # The DB will be written inside this directory, with the filename specified 340 | # above using the 'dbfilename' configuration directive. 341 | # 342 | # The Append Only File will also be created inside this directory. 343 | # 344 | # Note that you must specify a directory here, not a file name. 345 | dir ./ 346 | 347 | ################################# REPLICATION ################################# 348 | 349 | # Master-Replica replication. Use replicaof to make a Redis instance a copy of 350 | # another Redis server. A few things to understand ASAP about Redis replication. 351 | # 352 | # +------------------+ +---------------+ 353 | # | Master | ---> | Replica | 354 | # | (receive writes) | | (exact copy) | 355 | # +------------------+ +---------------+ 356 | # 357 | # 1) Redis replication is asynchronous, but you can configure a master to 358 | # stop accepting writes if it appears to be not connected with at least 359 | # a given number of replicas. 360 | # 2) Redis replicas are able to perform a partial resynchronization with the 361 | # master if the replication link is lost for a relatively small amount of 362 | # time. You may want to configure the replication backlog size (see the next 363 | # sections of this file) with a sensible value depending on your needs. 364 | # 3) Replication is automatic and does not need user intervention. After a 365 | # network partition replicas automatically try to reconnect to masters 366 | # and resynchronize with them. 367 | # 368 | # replicaof 369 | 370 | # If the master is password protected (using the "requirepass" configuration 371 | # directive below) it is possible to tell the replica to authenticate before 372 | # starting the replication synchronization process, otherwise the master will 373 | # refuse the replica request. 374 | # 375 | # masterauth 376 | # 377 | # However this is not enough if you are using Redis ACLs (for Redis version 378 | # 6 or greater), and the default user is not capable of running the PSYNC 379 | # command and/or other commands needed for replication. In this case it's 380 | # better to configure a special user to use with replication, and specify the 381 | # masteruser configuration as such: 382 | # 383 | # masteruser 384 | # 385 | # When masteruser is specified, the replica will authenticate against its 386 | # master using the new AUTH form: AUTH . 387 | 388 | # When a replica loses its connection with the master, or when the replication 389 | # is still in progress, the replica can act in two different ways: 390 | # 391 | # 1) if replica-serve-stale-data is set to 'yes' (the default) the replica will 392 | # still reply to client requests, possibly with out of date data, or the 393 | # data set may just be empty if this is the first synchronization. 394 | # 395 | # 2) if replica-serve-stale-data is set to 'no' the replica will reply with 396 | # an error "SYNC with master in progress" to all the kind of commands 397 | # but to INFO, replicaOF, AUTH, PING, SHUTDOWN, REPLCONF, ROLE, CONFIG, 398 | # SUBSCRIBE, UNSUBSCRIBE, PSUBSCRIBE, PUNSUBSCRIBE, PUBLISH, PUBSUB, 399 | # COMMAND, POST, HOST: and LATENCY. 400 | # 401 | replica-serve-stale-data yes 402 | 403 | # You can configure a replica instance to accept writes or not. Writing against 404 | # a replica instance may be useful to store some ephemeral data (because data 405 | # written on a replica will be easily deleted after resync with the master) but 406 | # may also cause problems if clients are writing to it because of a 407 | # misconfiguration. 408 | # 409 | # Since Redis 2.6 by default replicas are read-only. 410 | # 411 | # Note: read only replicas are not designed to be exposed to untrusted clients 412 | # on the internet. It's just a protection layer against misuse of the instance. 413 | # Still a read only replica exports by default all the administrative commands 414 | # such as CONFIG, DEBUG, and so forth. To a limited extent you can improve 415 | # security of read only replicas using 'rename-command' to shadow all the 416 | # administrative / dangerous commands. 417 | replica-read-only yes 418 | 419 | # Replication SYNC strategy: disk or socket. 420 | # 421 | # New replicas and reconnecting replicas that are not able to continue the 422 | # replication process just receiving differences, need to do what is called a 423 | # "full synchronization". An RDB file is transmitted from the master to the 424 | # replicas. 425 | # 426 | # The transmission can happen in two different ways: 427 | # 428 | # 1) Disk-backed: The Redis master creates a new process that writes the RDB 429 | # file on disk. Later the file is transferred by the parent 430 | # process to the replicas incrementally. 431 | # 2) Diskless: The Redis master creates a new process that directly writes the 432 | # RDB file to replica sockets, without touching the disk at all. 433 | # 434 | # With disk-backed replication, while the RDB file is generated, more replicas 435 | # can be queued and served with the RDB file as soon as the current child 436 | # producing the RDB file finishes its work. With diskless replication instead 437 | # once the transfer starts, new replicas arriving will be queued and a new 438 | # transfer will start when the current one terminates. 439 | # 440 | # When diskless replication is used, the master waits a configurable amount of 441 | # time (in seconds) before starting the transfer in the hope that multiple 442 | # replicas will arrive and the transfer can be parallelized. 443 | # 444 | # With slow disks and fast (large bandwidth) networks, diskless replication 445 | # works better. 446 | repl-diskless-sync no 447 | 448 | # When diskless replication is enabled, it is possible to configure the delay 449 | # the server waits in order to spawn the child that transfers the RDB via socket 450 | # to the replicas. 451 | # 452 | # This is important since once the transfer starts, it is not possible to serve 453 | # new replicas arriving, that will be queued for the next RDB transfer, so the 454 | # server waits a delay in order to let more replicas arrive. 455 | # 456 | # The delay is specified in seconds, and by default is 5 seconds. To disable 457 | # it entirely just set it to 0 seconds and the transfer will start ASAP. 458 | repl-diskless-sync-delay 5 459 | 460 | # ----------------------------------------------------------------------------- 461 | # WARNING: RDB diskless load is experimental. Since in this setup the replica 462 | # does not immediately store an RDB on disk, it may cause data loss during 463 | # failovers. RDB diskless load + Redis modules not handling I/O reads may also 464 | # cause Redis to abort in case of I/O errors during the initial synchronization 465 | # stage with the master. Use only if your do what you are doing. 466 | # ----------------------------------------------------------------------------- 467 | # 468 | # Replica can load the RDB it reads from the replication link directly from the 469 | # socket, or store the RDB to a file and read that file after it was completely 470 | # recived from the master. 471 | # 472 | # In many cases the disk is slower than the network, and storing and loading 473 | # the RDB file may increase replication time (and even increase the master's 474 | # Copy on Write memory and salve buffers). 475 | # However, parsing the RDB file directly from the socket may mean that we have 476 | # to flush the contents of the current database before the full rdb was 477 | # received. For this reason we have the following options: 478 | # 479 | # "disabled" - Don't use diskless load (store the rdb file to the disk first) 480 | # "on-empty-db" - Use diskless load only when it is completely safe. 481 | # "swapdb" - Keep a copy of the current db contents in RAM while parsing 482 | # the data directly from the socket. note that this requires 483 | # sufficient memory, if you don't have it, you risk an OOM kill. 484 | repl-diskless-load disabled 485 | 486 | # Replicas send PINGs to server in a predefined interval. It's possible to 487 | # change this interval with the repl_ping_replica_period option. The default 488 | # value is 10 seconds. 489 | # 490 | # repl-ping-replica-period 10 491 | 492 | # The following option sets the replication timeout for: 493 | # 494 | # 1) Bulk transfer I/O during SYNC, from the point of view of replica. 495 | # 2) Master timeout from the point of view of replicas (data, pings). 496 | # 3) Replica timeout from the point of view of masters (REPLCONF ACK pings). 497 | # 498 | # It is important to make sure that this value is greater than the value 499 | # specified for repl-ping-replica-period otherwise a timeout will be detected 500 | # every time there is low traffic between the master and the replica. 501 | # 502 | # repl-timeout 60 503 | 504 | # Disable TCP_NODELAY on the replica socket after SYNC? 505 | # 506 | # If you select "yes" Redis will use a smaller number of TCP packets and 507 | # less bandwidth to send data to replicas. But this can add a delay for 508 | # the data to appear on the replica side, up to 40 milliseconds with 509 | # Linux kernels using a default configuration. 510 | # 511 | # If you select "no" the delay for data to appear on the replica side will 512 | # be reduced but more bandwidth will be used for replication. 513 | # 514 | # By default we optimize for low latency, but in very high traffic conditions 515 | # or when the master and replicas are many hops away, turning this to "yes" may 516 | # be a good idea. 517 | repl-disable-tcp-nodelay no 518 | 519 | # Set the replication backlog size. The backlog is a buffer that accumulates 520 | # replica data when replicas are disconnected for some time, so that when a 521 | # replica wants to reconnect again, often a full resync is not needed, but a 522 | # partial resync is enough, just passing the portion of data the replica 523 | # missed while disconnected. 524 | # 525 | # The bigger the replication backlog, the longer the time the replica can be 526 | # disconnected and later be able to perform a partial resynchronization. 527 | # 528 | # The backlog is only allocated once there is at least a replica connected. 529 | # 530 | # repl-backlog-size 1mb 531 | 532 | # After a master has no longer connected replicas for some time, the backlog 533 | # will be freed. The following option configures the amount of seconds that 534 | # need to elapse, starting from the time the last replica disconnected, for 535 | # the backlog buffer to be freed. 536 | # 537 | # Note that replicas never free the backlog for timeout, since they may be 538 | # promoted to masters later, and should be able to correctly "partially 539 | # resynchronize" with the replicas: hence they should always accumulate backlog. 540 | # 541 | # A value of 0 means to never release the backlog. 542 | # 543 | # repl-backlog-ttl 3600 544 | 545 | # The replica priority is an integer number published by Redis in the INFO 546 | # output. It is used by Redis Sentinel in order to select a replica to promote 547 | # into a master if the master is no longer working correctly. 548 | # 549 | # A replica with a low priority number is considered better for promotion, so 550 | # for instance if there are three replicas with priority 10, 100, 25 Sentinel 551 | # will pick the one with priority 10, that is the lowest. 552 | # 553 | # However a special priority of 0 marks the replica as not able to perform the 554 | # role of master, so a replica with priority of 0 will never be selected by 555 | # Redis Sentinel for promotion. 556 | # 557 | # By default the priority is 100. 558 | replica-priority 100 559 | 560 | # It is possible for a master to stop accepting writes if there are less than 561 | # N replicas connected, having a lag less or equal than M seconds. 562 | # 563 | # The N replicas need to be in "online" state. 564 | # 565 | # The lag in seconds, that must be <= the specified value, is calculated from 566 | # the last ping received from the replica, that is usually sent every second. 567 | # 568 | # This option does not GUARANTEE that N replicas will accept the write, but 569 | # will limit the window of exposure for lost writes in case not enough replicas 570 | # are available, to the specified number of seconds. 571 | # 572 | # For example to require at least 3 replicas with a lag <= 10 seconds use: 573 | # 574 | # min-replicas-to-write 3 575 | # min-replicas-max-lag 10 576 | # 577 | # Setting one or the other to 0 disables the feature. 578 | # 579 | # By default min-replicas-to-write is set to 0 (feature disabled) and 580 | # min-replicas-max-lag is set to 10. 581 | 582 | # A Redis master is able to list the address and port of the attached 583 | # replicas in different ways. For example the "INFO replication" section 584 | # offers this information, which is used, among other tools, by 585 | # Redis Sentinel in order to discover replica instances. 586 | # Another place where this info is available is in the output of the 587 | # "ROLE" command of a master. 588 | # 589 | # The listed IP and address normally reported by a replica is obtained 590 | # in the following way: 591 | # 592 | # IP: The address is auto detected by checking the peer address 593 | # of the socket used by the replica to connect with the master. 594 | # 595 | # Port: The port is communicated by the replica during the replication 596 | # handshake, and is normally the port that the replica is using to 597 | # listen for connections. 598 | # 599 | # However when port forwarding or Network Address Translation (NAT) is 600 | # used, the replica may be actually reachable via different IP and port 601 | # pairs. The following two options can be used by a replica in order to 602 | # report to its master a specific set of IP and port, so that both INFO 603 | # and ROLE will report those values. 604 | # 605 | # There is no need to use both the options if you need to override just 606 | # the port or the IP address. 607 | # 608 | # replica-announce-ip 5.5.5.5 609 | # replica-announce-port 1234 610 | 611 | ############################### KEYS TRACKING ################################# 612 | 613 | # Redis implements server assisted support for client side caching of values. 614 | # This is implemented using an invalidation table that remembers, using 615 | # 16 millions of slots, what clients may have certain subsets of keys. In turn 616 | # this is used in order to send invalidation messages to clients. Please 617 | # to understand more about the feature check this page: 618 | # 619 | # https://redis.io/topics/client-side-caching 620 | # 621 | # When tracking is enabled for a client, all the read only queries are assumed 622 | # to be cached: this will force Redis to store information in the invalidation 623 | # table. When keys are modified, such information is flushed away, and 624 | # invalidation messages are sent to the clients. However if the workload is 625 | # heavily dominated by reads, Redis could use more and more memory in order 626 | # to track the keys fetched by many clients. 627 | # 628 | # For this reason it is possible to configure a maximum fill value for the 629 | # invalidation table. By default it is set to 1M of keys, and once this limit 630 | # is reached, Redis will start to evict keys in the invalidation table 631 | # even if they were not modified, just to reclaim memory: this will in turn 632 | # force the clients to invalidate the cached values. Basically the table 633 | # maximum size is a trade off between the memory you want to spend server 634 | # side to track information about who cached what, and the ability of clients 635 | # to retain cached objects in memory. 636 | # 637 | # If you set the value to 0, it means there are no limits, and Redis will 638 | # retain as many keys as needed in the invalidation table. 639 | # In the "stats" INFO section, you can find information about the number of 640 | # keys in the invalidation table at every given moment. 641 | # 642 | # Note: when key tracking is used in broadcasting mode, no memory is used 643 | # in the server side so this setting is useless. 644 | # 645 | # tracking-table-max-keys 1000000 646 | 647 | ################################## SECURITY ################################### 648 | 649 | # Warning: since Redis is pretty fast an outside user can try up to 650 | # 1 million passwords per second against a modern box. This means that you 651 | # should use very strong passwords, otherwise they will be very easy to break. 652 | # Note that because the password is really a shared secret between the client 653 | # and the server, and should not be memorized by any human, the password 654 | # can be easily a long string from /dev/urandom or whatever, so by using a 655 | # long and unguessable password no brute force attack will be possible. 656 | 657 | # Redis ACL users are defined in the following format: 658 | # 659 | # user ... acl rules ... 660 | # 661 | # For example: 662 | # 663 | # user worker +@list +@connection ~jobs:* on >ffa9203c493aa99 664 | # 665 | # The special username "default" is used for new connections. If this user 666 | # has the "nopass" rule, then new connections will be immediately authenticated 667 | # as the "default" user without the need of any password provided via the 668 | # AUTH command. Otherwise if the "default" user is not flagged with "nopass" 669 | # the connections will start in not authenticated state, and will require 670 | # AUTH (or the HELLO command AUTH option) in order to be authenticated and 671 | # start to work. 672 | # 673 | # The ACL rules that describe what an user can do are the following: 674 | # 675 | # on Enable the user: it is possible to authenticate as this user. 676 | # off Disable the user: it's no longer possible to authenticate 677 | # with this user, however the already authenticated connections 678 | # will still work. 679 | # + Allow the execution of that command 680 | # - Disallow the execution of that command 681 | # +@ Allow the execution of all the commands in such category 682 | # with valid categories are like @admin, @set, @sortedset, ... 683 | # and so forth, see the full list in the server.c file where 684 | # the Redis command table is described and defined. 685 | # The special category @all means all the commands, but currently 686 | # present in the server, and that will be loaded in the future 687 | # via modules. 688 | # +|subcommand Allow a specific subcommand of an otherwise 689 | # disabled command. Note that this form is not 690 | # allowed as negative like -DEBUG|SEGFAULT, but 691 | # only additive starting with "+". 692 | # allcommands Alias for +@all. Note that it implies the ability to execute 693 | # all the future commands loaded via the modules system. 694 | # nocommands Alias for -@all. 695 | # ~ Add a pattern of keys that can be mentioned as part of 696 | # commands. For instance ~* allows all the keys. The pattern 697 | # is a glob-style pattern like the one of KEYS. 698 | # It is possible to specify multiple patterns. 699 | # allkeys Alias for ~* 700 | # resetkeys Flush the list of allowed keys patterns. 701 | # > Add this passowrd to the list of valid password for the user. 702 | # For example >mypass will add "mypass" to the list. 703 | # This directive clears the "nopass" flag (see later). 704 | # < Remove this password from the list of valid passwords. 705 | # nopass All the set passwords of the user are removed, and the user 706 | # is flagged as requiring no password: it means that every 707 | # password will work against this user. If this directive is 708 | # used for the default user, every new connection will be 709 | # immediately authenticated with the default user without 710 | # any explicit AUTH command required. Note that the "resetpass" 711 | # directive will clear this condition. 712 | # resetpass Flush the list of allowed passwords. Moreover removes the 713 | # "nopass" status. After "resetpass" the user has no associated 714 | # passwords and there is no way to authenticate without adding 715 | # some password (or setting it as "nopass" later). 716 | # reset Performs the following actions: resetpass, resetkeys, off, 717 | # -@all. The user returns to the same state it has immediately 718 | # after its creation. 719 | # 720 | # ACL rules can be specified in any order: for instance you can start with 721 | # passwords, then flags, or key patterns. However note that the additive 722 | # and subtractive rules will CHANGE MEANING depending on the ordering. 723 | # For instance see the following example: 724 | # 725 | # user alice on +@all -DEBUG ~* >somepassword 726 | # 727 | # This will allow "alice" to use all the commands with the exception of the 728 | # DEBUG command, since +@all added all the commands to the set of the commands 729 | # alice can use, and later DEBUG was removed. However if we invert the order 730 | # of two ACL rules the result will be different: 731 | # 732 | # user alice on -DEBUG +@all ~* >somepassword 733 | # 734 | # Now DEBUG was removed when alice had yet no commands in the set of allowed 735 | # commands, later all the commands are added, so the user will be able to 736 | # execute everything. 737 | # 738 | # Basically ACL rules are processed left-to-right. 739 | # 740 | # For more information about ACL configuration please refer to 741 | # the Redis web site at https://redis.io/topics/acl 742 | 743 | # ACL LOG 744 | # 745 | # The ACL Log tracks failed commands and authentication events associated 746 | # with ACLs. The ACL Log is useful to troubleshoot failed commands blocked 747 | # by ACLs. The ACL Log is stored in and consumes memory. There is no limit 748 | # to its length.You can reclaim memory with ACL LOG RESET or set a maximum 749 | # length below. 750 | acllog-max-len 128 751 | 752 | # Using an external ACL file 753 | # 754 | # Instead of configuring users here in this file, it is possible to use 755 | # a stand-alone file just listing users. The two methods cannot be mixed: 756 | # if you configure users here and at the same time you activate the exteranl 757 | # ACL file, the server will refuse to start. 758 | # 759 | # The format of the external ACL user file is exactly the same as the 760 | # format that is used inside redis.conf to describe users. 761 | # 762 | # aclfile /etc/redis/users.acl 763 | 764 | # IMPORTANT NOTE: starting with Redis 6 "requirepass" is just a compatiblity 765 | # layer on top of the new ACL system. The option effect will be just setting 766 | # the password for the default user. Clients will still authenticate using 767 | # AUTH as usually, or more explicitly with AUTH default 768 | # if they follow the new protocol: both will work. 769 | # 770 | # requirepass foobared 771 | 772 | # Command renaming (DEPRECATED). 773 | # 774 | # ------------------------------------------------------------------------ 775 | # WARNING: avoid using this option if possible. Instead use ACLs to remove 776 | # commands from the default user, and put them only in some admin user you 777 | # create for administrative purposes. 778 | # ------------------------------------------------------------------------ 779 | # 780 | # It is possible to change the name of dangerous commands in a shared 781 | # environment. For instance the CONFIG command may be renamed into something 782 | # hard to guess so that it will still be available for internal-use tools 783 | # but not available for general clients. 784 | # 785 | # Example: 786 | # 787 | # rename-command CONFIG b840fc02d524045429941cc15f59e41cb7be6c52 788 | # 789 | # It is also possible to completely kill a command by renaming it into 790 | # an empty string: 791 | # 792 | # rename-command CONFIG "" 793 | # 794 | # Please note that changing the name of commands that are logged into the 795 | # AOF file or transmitted to replicas may cause problems. 796 | 797 | ################################### CLIENTS #################################### 798 | 799 | # Set the max number of connected clients at the same time. By default 800 | # this limit is set to 10000 clients, however if the Redis server is not 801 | # able to configure the process file limit to allow for the specified limit 802 | # the max number of allowed clients is set to the current file limit 803 | # minus 32 (as Redis reserves a few file descriptors for internal uses). 804 | # 805 | # Once the limit is reached Redis will close all the new connections sending 806 | # an error 'max number of clients reached'. 807 | # 808 | # maxclients 10000 809 | 810 | ############################## MEMORY MANAGEMENT ################################ 811 | 812 | # Set a memory usage limit to the specified amount of bytes. 813 | # When the memory limit is reached Redis will try to remove keys 814 | # according to the eviction policy selected (see maxmemory-policy). 815 | # 816 | # If Redis can't remove keys according to the policy, or if the policy is 817 | # set to 'noeviction', Redis will start to reply with errors to commands 818 | # that would use more memory, like SET, LPUSH, and so on, and will continue 819 | # to reply to read-only commands like GET. 820 | # 821 | # This option is usually useful when using Redis as an LRU or LFU cache, or to 822 | # set a hard memory limit for an instance (using the 'noeviction' policy). 823 | # 824 | # WARNING: If you have replicas attached to an instance with maxmemory on, 825 | # the size of the output buffers needed to feed the replicas are subtracted 826 | # from the used memory count, so that network problems / resyncs will 827 | # not trigger a loop where keys are evicted, and in turn the output 828 | # buffer of replicas is full with DELs of keys evicted triggering the deletion 829 | # of more keys, and so forth until the database is completely emptied. 830 | # 831 | # In short... if you have replicas attached it is suggested that you set a lower 832 | # limit for maxmemory so that there is some free RAM on the system for replica 833 | # output buffers (but this is not needed if the policy is 'noeviction'). 834 | # 835 | # maxmemory 836 | 837 | # MAXMEMORY POLICY: how Redis will select what to remove when maxmemory 838 | # is reached. You can select one from the following behaviors: 839 | # 840 | # volatile-lru -> Evict using approximated LRU, only keys with an expire set. 841 | # allkeys-lru -> Evict any key using approximated LRU. 842 | # volatile-lfu -> Evict using approximated LFU, only keys with an expire set. 843 | # allkeys-lfu -> Evict any key using approximated LFU. 844 | # volatile-random -> Remove a random key having an expire set. 845 | # allkeys-random -> Remove a random key, any key. 846 | # volatile-ttl -> Remove the key with the nearest expire time (minor TTL) 847 | # noeviction -> Don't evict anything, just return an error on write operations. 848 | # 849 | # LRU means Least Recently Used 850 | # LFU means Least Frequently Used 851 | # 852 | # Both LRU, LFU and volatile-ttl are implemented using approximated 853 | # randomized algorithms. 854 | # 855 | # Note: with any of the above policies, Redis will return an error on write 856 | # operations, when there are no suitable keys for eviction. 857 | # 858 | # At the date of writing these commands are: set setnx setex append 859 | # incr decr rpush lpush rpushx lpushx linsert lset rpoplpush sadd 860 | # sinter sinterstore sunion sunionstore sdiff sdiffstore zadd zincrby 861 | # zunionstore zinterstore hset hsetnx hmset hincrby incrby decrby 862 | # getset mset msetnx exec sort 863 | # 864 | # The default is: 865 | # 866 | # maxmemory-policy noeviction 867 | 868 | # LRU, LFU and minimal TTL algorithms are not precise algorithms but approximated 869 | # algorithms (in order to save memory), so you can tune it for speed or 870 | # accuracy. For default Redis will check five keys and pick the one that was 871 | # used less recently, you can change the sample size using the following 872 | # configuration directive. 873 | # 874 | # The default of 5 produces good enough results. 10 Approximates very closely 875 | # true LRU but costs more CPU. 3 is faster but not very accurate. 876 | # 877 | # maxmemory-samples 5 878 | 879 | # Starting from Redis 5, by default a replica will ignore its maxmemory setting 880 | # (unless it is promoted to master after a failover or manually). It means 881 | # that the eviction of keys will be just handled by the master, sending the 882 | # DEL commands to the replica as keys evict in the master side. 883 | # 884 | # This behavior ensures that masters and replicas stay consistent, and is usually 885 | # what you want, however if your replica is writable, or you want the replica 886 | # to have a different memory setting, and you are sure all the writes performed 887 | # to the replica are idempotent, then you may change this default (but be sure 888 | # to understand what you are doing). 889 | # 890 | # Note that since the replica by default does not evict, it may end using more 891 | # memory than the one set via maxmemory (there are certain buffers that may 892 | # be larger on the replica, or data structures may sometimes take more memory 893 | # and so forth). So make sure you monitor your replicas and make sure they 894 | # have enough memory to never hit a real out-of-memory condition before the 895 | # master hits the configured maxmemory setting. 896 | # 897 | # replica-ignore-maxmemory yes 898 | 899 | # Redis reclaims expired keys in two ways: upon access when those keys are 900 | # found to be expired, and also in background, in what is called the 901 | # "active expire key". The key space is slowly and interactively scanned 902 | # looking for expired keys to reclaim, so that it is possible to free memory 903 | # of keys that are expired and will never be accessed again in a short time. 904 | # 905 | # The default effort of the expire cycle will try to avoid having more than 906 | # ten percent of expired keys still in memory, and will try to avoid consuming 907 | # more than 25% of total memory and to add latency to the system. However 908 | # it is possible to increase the expire "effort" that is normally set to 909 | # "1", to a greater value, up to the value "10". At its maximum value the 910 | # system will use more CPU, longer cycles (and technically may introduce 911 | # more latency), and will tollerate less already expired keys still present 912 | # in the system. It's a tradeoff betweeen memory, CPU and latecy. 913 | # 914 | # active-expire-effort 1 915 | 916 | ############################# LAZY FREEING #################################### 917 | 918 | # Redis has two primitives to delete keys. One is called DEL and is a blocking 919 | # deletion of the object. It means that the server stops processing new commands 920 | # in order to reclaim all the memory associated with an object in a synchronous 921 | # way. If the key deleted is associated with a small object, the time needed 922 | # in order to execute the DEL command is very small and comparable to most other 923 | # O(1) or O(log_N) commands in Redis. However if the key is associated with an 924 | # aggregated value containing millions of elements, the server can block for 925 | # a long time (even seconds) in order to complete the operation. 926 | # 927 | # For the above reasons Redis also offers non blocking deletion primitives 928 | # such as UNLINK (non blocking DEL) and the ASYNC option of FLUSHALL and 929 | # FLUSHDB commands, in order to reclaim memory in background. Those commands 930 | # are executed in constant time. Another thread will incrementally free the 931 | # object in the background as fast as possible. 932 | # 933 | # DEL, UNLINK and ASYNC option of FLUSHALL and FLUSHDB are user-controlled. 934 | # It's up to the design of the application to understand when it is a good 935 | # idea to use one or the other. However the Redis server sometimes has to 936 | # delete keys or flush the whole database as a side effect of other operations. 937 | # Specifically Redis deletes objects independently of a user call in the 938 | # following scenarios: 939 | # 940 | # 1) On eviction, because of the maxmemory and maxmemory policy configurations, 941 | # in order to make room for new data, without going over the specified 942 | # memory limit. 943 | # 2) Because of expire: when a key with an associated time to live (see the 944 | # EXPIRE command) must be deleted from memory. 945 | # 3) Because of a side effect of a command that stores data on a key that may 946 | # already exist. For example the RENAME command may delete the old key 947 | # content when it is replaced with another one. Similarly SUNIONSTORE 948 | # or SORT with STORE option may delete existing keys. The SET command 949 | # itself removes any old content of the specified key in order to replace 950 | # it with the specified string. 951 | # 4) During replication, when a replica performs a full resynchronization with 952 | # its master, the content of the whole database is removed in order to 953 | # load the RDB file just transferred. 954 | # 955 | # In all the above cases the default is to delete objects in a blocking way, 956 | # like if DEL was called. However you can configure each case specifically 957 | # in order to instead release memory in a non-blocking way like if UNLINK 958 | # was called, using the following configuration directives. 959 | 960 | lazyfree-lazy-eviction no 961 | lazyfree-lazy-expire no 962 | lazyfree-lazy-server-del no 963 | replica-lazy-flush no 964 | 965 | # It is also possible, for the case when to replace the user code DEL calls 966 | # with UNLINK calls is not easy, to modify the default behavior of the DEL 967 | # command to act exactly like UNLINK, using the following configuration 968 | # directive: 969 | 970 | lazyfree-lazy-user-del no 971 | 972 | ################################ THREADED I/O ################################# 973 | 974 | # Redis is mostly single threaded, however there are certain threaded 975 | # operations such as UNLINK, slow I/O accesses and other things that are 976 | # performed on side threads. 977 | # 978 | # Now it is also possible to handle Redis clients socket reads and writes 979 | # in different I/O threads. Since especially writing is so slow, normally 980 | # Redis users use pipelining in order to speedup the Redis performances per 981 | # core, and spawn multiple instances in order to scale more. Using I/O 982 | # threads it is possible to easily speedup two times Redis without resorting 983 | # to pipelining nor sharding of the instance. 984 | # 985 | # By default threading is disabled, we suggest enabling it only in machines 986 | # that have at least 4 or more cores, leaving at least one spare core. 987 | # Using more than 8 threads is unlikely to help much. We also recommend using 988 | # threaded I/O only if you actually have performance problems, with Redis 989 | # instances being able to use a quite big percentage of CPU time, otherwise 990 | # there is no point in using this feature. 991 | # 992 | # So for instance if you have a four cores boxes, try to use 2 or 3 I/O 993 | # threads, if you have a 8 cores, try to use 6 threads. In order to 994 | # enable I/O threads use the following configuration directive: 995 | # 996 | # io-threads 4 997 | # 998 | # Setting io-threads to 1 will just use the main thread as usually. 999 | # When I/O threads are enabled, we only use threads for writes, that is 1000 | # to thread the write(2) syscall and transfer the client buffers to the 1001 | # socket. However it is also possible to enable threading of reads and 1002 | # protocol parsing using the following configuration directive, by setting 1003 | # it to yes: 1004 | # 1005 | # io-threads-do-reads no 1006 | # 1007 | # Usually threading reads doesn't help much. 1008 | # 1009 | # NOTE 1: This configuration directive cannot be changed at runtime via 1010 | # CONFIG SET. Aso this feature currently does not work when SSL is 1011 | # enabled. 1012 | # 1013 | # NOTE 2: If you want to test the Redis speedup using redis-benchmark, make 1014 | # sure you also run the benchmark itself in threaded mode, using the 1015 | # --threads option to match the number of Redis theads, otherwise you'll not 1016 | # be able to notice the improvements. 1017 | 1018 | ############################## APPEND ONLY MODE ############################### 1019 | 1020 | # By default Redis asynchronously dumps the dataset on disk. This mode is 1021 | # good enough in many applications, but an issue with the Redis process or 1022 | # a power outage may result into a few minutes of writes lost (depending on 1023 | # the configured save points). 1024 | # 1025 | # The Append Only File is an alternative persistence mode that provides 1026 | # much better durability. For instance using the default data fsync policy 1027 | # (see later in the config file) Redis can lose just one second of writes in a 1028 | # dramatic event like a server power outage, or a single write if something 1029 | # wrong with the Redis process itself happens, but the operating system is 1030 | # still running correctly. 1031 | # 1032 | # AOF and RDB persistence can be enabled at the same time without problems. 1033 | # If the AOF is enabled on startup Redis will load the AOF, that is the file 1034 | # with the better durability guarantees. 1035 | # 1036 | # Please check http://redis.io/topics/persistence for more information. 1037 | 1038 | appendonly no 1039 | 1040 | # The name of the append only file (default: "appendonly.aof") 1041 | 1042 | appendfilename "appendonly.aof" 1043 | 1044 | # The fsync() call tells the Operating System to actually write data on disk 1045 | # instead of waiting for more data in the output buffer. Some OS will really flush 1046 | # data on disk, some other OS will just try to do it ASAP. 1047 | # 1048 | # Redis supports three different modes: 1049 | # 1050 | # no: don't fsync, just let the OS flush the data when it wants. Faster. 1051 | # always: fsync after every write to the append only log. Slow, Safest. 1052 | # everysec: fsync only one time every second. Compromise. 1053 | # 1054 | # The default is "everysec", as that's usually the right compromise between 1055 | # speed and data safety. It's up to you to understand if you can relax this to 1056 | # "no" that will let the operating system flush the output buffer when 1057 | # it wants, for better performances (but if you can live with the idea of 1058 | # some data loss consider the default persistence mode that's snapshotting), 1059 | # or on the contrary, use "always" that's very slow but a bit safer than 1060 | # everysec. 1061 | # 1062 | # More details please check the following article: 1063 | # http://antirez.com/post/redis-persistence-demystified.html 1064 | # 1065 | # If unsure, use "everysec". 1066 | 1067 | # appendfsync always 1068 | appendfsync everysec 1069 | # appendfsync no 1070 | 1071 | # When the AOF fsync policy is set to always or everysec, and a background 1072 | # saving process (a background save or AOF log background rewriting) is 1073 | # performing a lot of I/O against the disk, in some Linux configurations 1074 | # Redis may block too long on the fsync() call. Note that there is no fix for 1075 | # this currently, as even performing fsync in a different thread will block 1076 | # our synchronous write(2) call. 1077 | # 1078 | # In order to mitigate this problem it's possible to use the following option 1079 | # that will prevent fsync() from being called in the main process while a 1080 | # BGSAVE or BGREWRITEAOF is in progress. 1081 | # 1082 | # This means that while another child is saving, the durability of Redis is 1083 | # the same as "appendfsync none". In practical terms, this means that it is 1084 | # possible to lose up to 30 seconds of log in the worst scenario (with the 1085 | # default Linux settings). 1086 | # 1087 | # If you have latency problems turn this to "yes". Otherwise leave it as 1088 | # "no" that is the safest pick from the point of view of durability. 1089 | 1090 | no-appendfsync-on-rewrite no 1091 | 1092 | # Automatic rewrite of the append only file. 1093 | # Redis is able to automatically rewrite the log file implicitly calling 1094 | # BGREWRITEAOF when the AOF log size grows by the specified percentage. 1095 | # 1096 | # This is how it works: Redis remembers the size of the AOF file after the 1097 | # latest rewrite (if no rewrite has happened since the restart, the size of 1098 | # the AOF at startup is used). 1099 | # 1100 | # This base size is compared to the current size. If the current size is 1101 | # bigger than the specified percentage, the rewrite is triggered. Also 1102 | # you need to specify a minimal size for the AOF file to be rewritten, this 1103 | # is useful to avoid rewriting the AOF file even if the percentage increase 1104 | # is reached but it is still pretty small. 1105 | # 1106 | # Specify a percentage of zero in order to disable the automatic AOF 1107 | # rewrite feature. 1108 | 1109 | auto-aof-rewrite-percentage 100 1110 | auto-aof-rewrite-min-size 64mb 1111 | 1112 | # An AOF file may be found to be truncated at the end during the Redis 1113 | # startup process, when the AOF data gets loaded back into memory. 1114 | # This may happen when the system where Redis is running 1115 | # crashes, especially when an ext4 filesystem is mounted without the 1116 | # data=ordered option (however this can't happen when Redis itself 1117 | # crashes or aborts but the operating system still works correctly). 1118 | # 1119 | # Redis can either exit with an error when this happens, or load as much 1120 | # data as possible (the default now) and start if the AOF file is found 1121 | # to be truncated at the end. The following option controls this behavior. 1122 | # 1123 | # If aof-load-truncated is set to yes, a truncated AOF file is loaded and 1124 | # the Redis server starts emitting a log to inform the user of the event. 1125 | # Otherwise if the option is set to no, the server aborts with an error 1126 | # and refuses to start. When the option is set to no, the user requires 1127 | # to fix the AOF file using the "redis-check-aof" utility before to restart 1128 | # the server. 1129 | # 1130 | # Note that if the AOF file will be found to be corrupted in the middle 1131 | # the server will still exit with an error. This option only applies when 1132 | # Redis will try to read more data from the AOF file but not enough bytes 1133 | # will be found. 1134 | aof-load-truncated yes 1135 | 1136 | # When rewriting the AOF file, Redis is able to use an RDB preamble in the 1137 | # AOF file for faster rewrites and recoveries. When this option is turned 1138 | # on the rewritten AOF file is composed of two different stanzas: 1139 | # 1140 | # [RDB file][AOF tail] 1141 | # 1142 | # When loading Redis recognizes that the AOF file starts with the "REDIS" 1143 | # string and loads the prefixed RDB file, and continues loading the AOF 1144 | # tail. 1145 | aof-use-rdb-preamble yes 1146 | 1147 | ################################ LUA SCRIPTING ############################### 1148 | 1149 | # Max execution time of a Lua script in milliseconds. 1150 | # 1151 | # If the maximum execution time is reached Redis will log that a script is 1152 | # still in execution after the maximum allowed time and will start to 1153 | # reply to queries with an error. 1154 | # 1155 | # When a long running script exceeds the maximum execution time only the 1156 | # SCRIPT KILL and SHUTDOWN NOSAVE commands are available. The first can be 1157 | # used to stop a script that did not yet called write commands. The second 1158 | # is the only way to shut down the server in the case a write command was 1159 | # already issued by the script but the user doesn't want to wait for the natural 1160 | # termination of the script. 1161 | # 1162 | # Set it to 0 or a negative value for unlimited execution without warnings. 1163 | lua-time-limit 5000 1164 | 1165 | ################################ REDIS CLUSTER ############################### 1166 | 1167 | # Normal Redis instances can't be part of a Redis Cluster; only nodes that are 1168 | # started as cluster nodes can. In order to start a Redis instance as a 1169 | # cluster node enable the cluster support uncommenting the following: 1170 | # 1171 | # cluster-enabled yes 1172 | 1173 | # Every cluster node has a cluster configuration file. This file is not 1174 | # intended to be edited by hand. It is created and updated by Redis nodes. 1175 | # Every Redis Cluster node requires a different cluster configuration file. 1176 | # Make sure that instances running in the same system do not have 1177 | # overlapping cluster configuration file names. 1178 | # 1179 | # cluster-config-file nodes-6379.conf 1180 | 1181 | # Cluster node timeout is the amount of milliseconds a node must be unreachable 1182 | # for it to be considered in failure state. 1183 | # Most other internal time limits are multiple of the node timeout. 1184 | # 1185 | # cluster-node-timeout 15000 1186 | 1187 | # A replica of a failing master will avoid to start a failover if its data 1188 | # looks too old. 1189 | # 1190 | # There is no simple way for a replica to actually have an exact measure of 1191 | # its "data age", so the following two checks are performed: 1192 | # 1193 | # 1) If there are multiple replicas able to failover, they exchange messages 1194 | # in order to try to give an advantage to the replica with the best 1195 | # replication offset (more data from the master processed). 1196 | # Replicas will try to get their rank by offset, and apply to the start 1197 | # of the failover a delay proportional to their rank. 1198 | # 1199 | # 2) Every single replica computes the time of the last interaction with 1200 | # its master. This can be the last ping or command received (if the master 1201 | # is still in the "connected" state), or the time that elapsed since the 1202 | # disconnection with the master (if the replication link is currently down). 1203 | # If the last interaction is too old, the replica will not try to failover 1204 | # at all. 1205 | # 1206 | # The point "2" can be tuned by user. Specifically a replica will not perform 1207 | # the failover if, since the last interaction with the master, the time 1208 | # elapsed is greater than: 1209 | # 1210 | # (node-timeout * replica-validity-factor) + repl-ping-replica-period 1211 | # 1212 | # So for example if node-timeout is 30 seconds, and the replica-validity-factor 1213 | # is 10, and assuming a default repl-ping-replica-period of 10 seconds, the 1214 | # replica will not try to failover if it was not able to talk with the master 1215 | # for longer than 310 seconds. 1216 | # 1217 | # A large replica-validity-factor may allow replicas with too old data to failover 1218 | # a master, while a too small value may prevent the cluster from being able to 1219 | # elect a replica at all. 1220 | # 1221 | # For maximum availability, it is possible to set the replica-validity-factor 1222 | # to a value of 0, which means, that replicas will always try to failover the 1223 | # master regardless of the last time they interacted with the master. 1224 | # (However they'll always try to apply a delay proportional to their 1225 | # offset rank). 1226 | # 1227 | # Zero is the only value able to guarantee that when all the partitions heal 1228 | # the cluster will always be able to continue. 1229 | # 1230 | # cluster-replica-validity-factor 10 1231 | 1232 | # Cluster replicas are able to migrate to orphaned masters, that are masters 1233 | # that are left without working replicas. This improves the cluster ability 1234 | # to resist to failures as otherwise an orphaned master can't be failed over 1235 | # in case of failure if it has no working replicas. 1236 | # 1237 | # Replicas migrate to orphaned masters only if there are still at least a 1238 | # given number of other working replicas for their old master. This number 1239 | # is the "migration barrier". A migration barrier of 1 means that a replica 1240 | # will migrate only if there is at least 1 other working replica for its master 1241 | # and so forth. It usually reflects the number of replicas you want for every 1242 | # master in your cluster. 1243 | # 1244 | # Default is 1 (replicas migrate only if their masters remain with at least 1245 | # one replica). To disable migration just set it to a very large value. 1246 | # A value of 0 can be set but is useful only for debugging and dangerous 1247 | # in production. 1248 | # 1249 | # cluster-migration-barrier 1 1250 | 1251 | # By default Redis Cluster nodes stop accepting queries if they detect there 1252 | # is at least an hash slot uncovered (no available node is serving it). 1253 | # This way if the cluster is partially down (for example a range of hash slots 1254 | # are no longer covered) all the cluster becomes, eventually, unavailable. 1255 | # It automatically returns available as soon as all the slots are covered again. 1256 | # 1257 | # However sometimes you want the subset of the cluster which is working, 1258 | # to continue to accept queries for the part of the key space that is still 1259 | # covered. In order to do so, just set the cluster-require-full-coverage 1260 | # option to no. 1261 | # 1262 | # cluster-require-full-coverage yes 1263 | 1264 | # This option, when set to yes, prevents replicas from trying to failover its 1265 | # master during master failures. However the master can still perform a 1266 | # manual failover, if forced to do so. 1267 | # 1268 | # This is useful in different scenarios, especially in the case of multiple 1269 | # data center operations, where we want one side to never be promoted if not 1270 | # in the case of a total DC failure. 1271 | # 1272 | # cluster-replica-no-failover no 1273 | 1274 | # This option, when set to yes, allows nodes to serve read traffic while the 1275 | # the cluster is in a down state, as long as it believes it owns the slots. 1276 | # 1277 | # This is useful for two cases. The first case is for when an application 1278 | # doesn't require consistency of data during node failures or network partitions. 1279 | # One example of this is a cache, where as long as the node has the data it 1280 | # should be able to serve it. 1281 | # 1282 | # The second use case is for configurations that don't meet the recommended 1283 | # three shards but want to enable cluster mode and scale later. A 1284 | # master outage in a 1 or 2 shard configuration causes a read/write outage to the 1285 | # entire cluster without this option set, with it set there is only a write outage. 1286 | # Without a quorum of masters, slot ownership will not change automatically. 1287 | # 1288 | # cluster-allow-reads-when-down no 1289 | 1290 | # In order to setup your cluster make sure to read the documentation 1291 | # available at http://redis.io web site. 1292 | 1293 | ########################## CLUSTER DOCKER/NAT support ######################## 1294 | 1295 | # In certain deployments, Redis Cluster nodes address discovery fails, because 1296 | # addresses are NAT-ted or because ports are forwarded (the typical case is 1297 | # Docker and other containers). 1298 | # 1299 | # In order to make Redis Cluster working in such environments, a static 1300 | # configuration where each node knows its public address is needed. The 1301 | # following two options are used for this scope, and are: 1302 | # 1303 | # * cluster-announce-ip 1304 | # * cluster-announce-port 1305 | # * cluster-announce-bus-port 1306 | # 1307 | # Each instruct the node about its address, client port, and cluster message 1308 | # bus port. The information is then published in the header of the bus packets 1309 | # so that other nodes will be able to correctly map the address of the node 1310 | # publishing the information. 1311 | # 1312 | # If the above options are not used, the normal Redis Cluster auto-detection 1313 | # will be used instead. 1314 | # 1315 | # Note that when remapped, the bus port may not be at the fixed offset of 1316 | # clients port + 10000, so you can specify any port and bus-port depending 1317 | # on how they get remapped. If the bus-port is not set, a fixed offset of 1318 | # 10000 will be used as usually. 1319 | # 1320 | # Example: 1321 | # 1322 | # cluster-announce-ip 10.1.1.5 1323 | # cluster-announce-port 6379 1324 | # cluster-announce-bus-port 6380 1325 | 1326 | ################################## SLOW LOG ################################### 1327 | 1328 | # The Redis Slow Log is a system to log queries that exceeded a specified 1329 | # execution time. The execution time does not include the I/O operations 1330 | # like talking with the client, sending the reply and so forth, 1331 | # but just the time needed to actually execute the command (this is the only 1332 | # stage of command execution where the thread is blocked and can not serve 1333 | # other requests in the meantime). 1334 | # 1335 | # You can configure the slow log with two parameters: one tells Redis 1336 | # what is the execution time, in microseconds, to exceed in order for the 1337 | # command to get logged, and the other parameter is the length of the 1338 | # slow log. When a new command is logged the oldest one is removed from the 1339 | # queue of logged commands. 1340 | 1341 | # The following time is expressed in microseconds, so 1000000 is equivalent 1342 | # to one second. Note that a negative number disables the slow log, while 1343 | # a value of zero forces the logging of every command. 1344 | slowlog-log-slower-than 10000 1345 | 1346 | # There is no limit to this length. Just be aware that it will consume memory. 1347 | # You can reclaim memory used by the slow log with SLOWLOG RESET. 1348 | slowlog-max-len 128 1349 | 1350 | ################################ LATENCY MONITOR ############################## 1351 | 1352 | # The Redis latency monitoring subsystem samples different operations 1353 | # at runtime in order to collect data related to possible sources of 1354 | # latency of a Redis instance. 1355 | # 1356 | # Via the LATENCY command this information is available to the user that can 1357 | # print graphs and obtain reports. 1358 | # 1359 | # The system only logs operations that were performed in a time equal or 1360 | # greater than the amount of milliseconds specified via the 1361 | # latency-monitor-threshold configuration directive. When its value is set 1362 | # to zero, the latency monitor is turned off. 1363 | # 1364 | # By default latency monitoring is disabled since it is mostly not needed 1365 | # if you don't have latency issues, and collecting data has a performance 1366 | # impact, that while very small, can be measured under big load. Latency 1367 | # monitoring can easily be enabled at runtime using the command 1368 | # "CONFIG SET latency-monitor-threshold " if needed. 1369 | latency-monitor-threshold 0 1370 | 1371 | ############################# EVENT NOTIFICATION ############################## 1372 | 1373 | # Redis can notify Pub/Sub clients about events happening in the key space. 1374 | # This feature is documented at http://redis.io/topics/notifications 1375 | # 1376 | # For instance if keyspace events notification is enabled, and a client 1377 | # performs a DEL operation on key "foo" stored in the Database 0, two 1378 | # messages will be published via Pub/Sub: 1379 | # 1380 | # PUBLISH __keyspace@0__:foo del 1381 | # PUBLISH __keyevent@0__:del foo 1382 | # 1383 | # It is possible to select the events that Redis will notify among a set 1384 | # of classes. Every class is identified by a single character: 1385 | # 1386 | # K Keyspace events, published with __keyspace@__ prefix. 1387 | # E Keyevent events, published with __keyevent@__ prefix. 1388 | # g Generic commands (non-type specific) like DEL, EXPIRE, RENAME, ... 1389 | # $ String commands 1390 | # l List commands 1391 | # s Set commands 1392 | # h Hash commands 1393 | # z Sorted set commands 1394 | # x Expired events (events generated every time a key expires) 1395 | # e Evicted events (events generated when a key is evicted for maxmemory) 1396 | # t Stream commands 1397 | # m Key-miss events (Note: It is not included in the 'A' class) 1398 | # A Alias for g$lshzxet, so that the "AKE" string means all the events 1399 | # (Except key-miss events which are excluded from 'A' due to their 1400 | # unique nature). 1401 | # 1402 | # The "notify-keyspace-events" takes as argument a string that is composed 1403 | # of zero or multiple characters. The empty string means that notifications 1404 | # are disabled. 1405 | # 1406 | # Example: to enable list and generic events, from the point of view of the 1407 | # event name, use: 1408 | # 1409 | # notify-keyspace-events Elg 1410 | # 1411 | # Example 2: to get the stream of the expired keys subscribing to channel 1412 | # name __keyevent@0__:expired use: 1413 | # 1414 | # notify-keyspace-events Ex 1415 | # 1416 | # By default all notifications are disabled because most users don't need 1417 | # this feature and the feature has some overhead. Note that if you don't 1418 | # specify at least one of K or E, no events will be delivered. 1419 | notify-keyspace-events "" 1420 | 1421 | ############################### GOPHER SERVER ################################# 1422 | 1423 | # Redis contains an implementation of the Gopher protocol, as specified in 1424 | # the RFC 1436 (https://www.ietf.org/rfc/rfc1436.txt). 1425 | # 1426 | # The Gopher protocol was very popular in the late '90s. It is an alternative 1427 | # to the web, and the implementation both server and client side is so simple 1428 | # that the Redis server has just 100 lines of code in order to implement this 1429 | # support. 1430 | # 1431 | # What do you do with Gopher nowadays? Well Gopher never *really* died, and 1432 | # lately there is a movement in order for the Gopher more hierarchical content 1433 | # composed of just plain text documents to be resurrected. Some want a simpler 1434 | # internet, others believe that the mainstream internet became too much 1435 | # controlled, and it's cool to create an alternative space for people that 1436 | # want a bit of fresh air. 1437 | # 1438 | # Anyway for the 10nth birthday of the Redis, we gave it the Gopher protocol 1439 | # as a gift. 1440 | # 1441 | # --- HOW IT WORKS? --- 1442 | # 1443 | # The Redis Gopher support uses the inline protocol of Redis, and specifically 1444 | # two kind of inline requests that were anyway illegal: an empty request 1445 | # or any request that starts with "/" (there are no Redis commands starting 1446 | # with such a slash). Normal RESP2/RESP3 requests are completely out of the 1447 | # path of the Gopher protocol implementation and are served as usually as well. 1448 | # 1449 | # If you open a connection to Redis when Gopher is enabled and send it 1450 | # a string like "/foo", if there is a key named "/foo" it is served via the 1451 | # Gopher protocol. 1452 | # 1453 | # In order to create a real Gopher "hole" (the name of a Gopher site in Gopher 1454 | # talking), you likely need a script like the following: 1455 | # 1456 | # https://github.com/antirez/gopher2redis 1457 | # 1458 | # --- SECURITY WARNING --- 1459 | # 1460 | # If you plan to put Redis on the internet in a publicly accessible address 1461 | # to server Gopher pages MAKE SURE TO SET A PASSWORD to the instance. 1462 | # Once a password is set: 1463 | # 1464 | # 1. The Gopher server (when enabled, not by default) will still serve 1465 | # content via Gopher. 1466 | # 2. However other commands cannot be called before the client will 1467 | # authenticate. 1468 | # 1469 | # So use the 'requirepass' option to protect your instance. 1470 | # 1471 | # To enable Gopher support uncomment the following line and set 1472 | # the option from no (the default) to yes. 1473 | # 1474 | # gopher-enabled no 1475 | 1476 | ############################### ADVANCED CONFIG ############################### 1477 | 1478 | # Hashes are encoded using a memory efficient data structure when they have a 1479 | # small number of entries, and the biggest entry does not exceed a given 1480 | # threshold. These thresholds can be configured using the following directives. 1481 | hash-max-ziplist-entries 512 1482 | hash-max-ziplist-value 64 1483 | 1484 | # Lists are also encoded in a special way to save a lot of space. 1485 | # The number of entries allowed per internal list node can be specified 1486 | # as a fixed maximum size or a maximum number of elements. 1487 | # For a fixed maximum size, use -5 through -1, meaning: 1488 | # -5: max size: 64 Kb <-- not recommended for normal workloads 1489 | # -4: max size: 32 Kb <-- not recommended 1490 | # -3: max size: 16 Kb <-- probably not recommended 1491 | # -2: max size: 8 Kb <-- good 1492 | # -1: max size: 4 Kb <-- good 1493 | # Positive numbers mean store up to _exactly_ that number of elements 1494 | # per list node. 1495 | # The highest performing option is usually -2 (8 Kb size) or -1 (4 Kb size), 1496 | # but if your use case is unique, adjust the settings as necessary. 1497 | list-max-ziplist-size -2 1498 | 1499 | # Lists may also be compressed. 1500 | # Compress depth is the number of quicklist ziplist nodes from *each* side of 1501 | # the list to *exclude* from compression. The head and tail of the list 1502 | # are always uncompressed for fast push/pop operations. Settings are: 1503 | # 0: disable all list compression 1504 | # 1: depth 1 means "don't start compressing until after 1 node into the list, 1505 | # going from either the head or tail" 1506 | # So: [head]->node->node->...->node->[tail] 1507 | # [head], [tail] will always be uncompressed; inner nodes will compress. 1508 | # 2: [head]->[next]->node->node->...->node->[prev]->[tail] 1509 | # 2 here means: don't compress head or head->next or tail->prev or tail, 1510 | # but compress all nodes between them. 1511 | # 3: [head]->[next]->[next]->node->node->...->node->[prev]->[prev]->[tail] 1512 | # etc. 1513 | list-compress-depth 0 1514 | 1515 | # Sets have a special encoding in just one case: when a set is composed 1516 | # of just strings that happen to be integers in radix 10 in the range 1517 | # of 64 bit signed integers. 1518 | # The following configuration setting sets the limit in the size of the 1519 | # set in order to use this special memory saving encoding. 1520 | set-max-intset-entries 512 1521 | 1522 | # Similarly to hashes and lists, sorted sets are also specially encoded in 1523 | # order to save a lot of space. This encoding is only used when the length and 1524 | # elements of a sorted set are below the following limits: 1525 | zset-max-ziplist-entries 128 1526 | zset-max-ziplist-value 64 1527 | 1528 | # HyperLogLog sparse representation bytes limit. The limit includes the 1529 | # 16 bytes header. When an HyperLogLog using the sparse representation crosses 1530 | # this limit, it is converted into the dense representation. 1531 | # 1532 | # A value greater than 16000 is totally useless, since at that point the 1533 | # dense representation is more memory efficient. 1534 | # 1535 | # The suggested value is ~ 3000 in order to have the benefits of 1536 | # the space efficient encoding without slowing down too much PFADD, 1537 | # which is O(N) with the sparse encoding. The value can be raised to 1538 | # ~ 10000 when CPU is not a concern, but space is, and the data set is 1539 | # composed of many HyperLogLogs with cardinality in the 0 - 15000 range. 1540 | hll-sparse-max-bytes 3000 1541 | 1542 | # Streams macro node max size / items. The stream data structure is a radix 1543 | # tree of big nodes that encode multiple items inside. Using this configuration 1544 | # it is possible to configure how big a single node can be in bytes, and the 1545 | # maximum number of items it may contain before switching to a new node when 1546 | # appending new stream entries. If any of the following settings are set to 1547 | # zero, the limit is ignored, so for instance it is possible to set just a 1548 | # max entires limit by setting max-bytes to 0 and max-entries to the desired 1549 | # value. 1550 | stream-node-max-bytes 4096 1551 | stream-node-max-entries 100 1552 | 1553 | # Active rehashing uses 1 millisecond every 100 milliseconds of CPU time in 1554 | # order to help rehashing the main Redis hash table (the one mapping top-level 1555 | # keys to values). The hash table implementation Redis uses (see dict.c) 1556 | # performs a lazy rehashing: the more operation you run into a hash table 1557 | # that is rehashing, the more rehashing "steps" are performed, so if the 1558 | # server is idle the rehashing is never complete and some more memory is used 1559 | # by the hash table. 1560 | # 1561 | # The default is to use this millisecond 10 times every second in order to 1562 | # actively rehash the main dictionaries, freeing memory when possible. 1563 | # 1564 | # If unsure: 1565 | # use "activerehashing no" if you have hard latency requirements and it is 1566 | # not a good thing in your environment that Redis can reply from time to time 1567 | # to queries with 2 milliseconds delay. 1568 | # 1569 | # use "activerehashing yes" if you don't have such hard requirements but 1570 | # want to free memory asap when possible. 1571 | activerehashing yes 1572 | 1573 | # The client output buffer limits can be used to force disconnection of clients 1574 | # that are not reading data from the server fast enough for some reason (a 1575 | # common reason is that a Pub/Sub client can't consume messages as fast as the 1576 | # publisher can produce them). 1577 | # 1578 | # The limit can be set differently for the three different classes of clients: 1579 | # 1580 | # normal -> normal clients including MONITOR clients 1581 | # replica -> replica clients 1582 | # pubsub -> clients subscribed to at least one pubsub channel or pattern 1583 | # 1584 | # The syntax of every client-output-buffer-limit directive is the following: 1585 | # 1586 | # client-output-buffer-limit 1587 | # 1588 | # A client is immediately disconnected once the hard limit is reached, or if 1589 | # the soft limit is reached and remains reached for the specified number of 1590 | # seconds (continuously). 1591 | # So for instance if the hard limit is 32 megabytes and the soft limit is 1592 | # 16 megabytes / 10 seconds, the client will get disconnected immediately 1593 | # if the size of the output buffers reach 32 megabytes, but will also get 1594 | # disconnected if the client reaches 16 megabytes and continuously overcomes 1595 | # the limit for 10 seconds. 1596 | # 1597 | # By default normal clients are not limited because they don't receive data 1598 | # without asking (in a push way), but just after a request, so only 1599 | # asynchronous clients may create a scenario where data is requested faster 1600 | # than it can read. 1601 | # 1602 | # Instead there is a default limit for pubsub and replica clients, since 1603 | # subscribers and replicas receive data in a push fashion. 1604 | # 1605 | # Both the hard or the soft limit can be disabled by setting them to zero. 1606 | client-output-buffer-limit normal 0 0 0 1607 | client-output-buffer-limit replica 256mb 64mb 60 1608 | client-output-buffer-limit pubsub 32mb 8mb 60 1609 | 1610 | # Client query buffers accumulate new commands. They are limited to a fixed 1611 | # amount by default in order to avoid that a protocol desynchronization (for 1612 | # instance due to a bug in the client) will lead to unbound memory usage in 1613 | # the query buffer. However you can configure it here if you have very special 1614 | # needs, such us huge multi/exec requests or alike. 1615 | # 1616 | # client-query-buffer-limit 1gb 1617 | 1618 | # In the Redis protocol, bulk requests, that are, elements representing single 1619 | # strings, are normally limited ot 512 mb. However you can change this limit 1620 | # here. 1621 | # 1622 | # proto-max-bulk-len 512mb 1623 | 1624 | # Redis calls an internal function to perform many background tasks, like 1625 | # closing connections of clients in timeout, purging expired keys that are 1626 | # never requested, and so forth. 1627 | # 1628 | # Not all tasks are performed with the same frequency, but Redis checks for 1629 | # tasks to perform according to the specified "hz" value. 1630 | # 1631 | # By default "hz" is set to 10. Raising the value will use more CPU when 1632 | # Redis is idle, but at the same time will make Redis more responsive when 1633 | # there are many keys expiring at the same time, and timeouts may be 1634 | # handled with more precision. 1635 | # 1636 | # The range is between 1 and 500, however a value over 100 is usually not 1637 | # a good idea. Most users should use the default of 10 and raise this up to 1638 | # 100 only in environments where very low latency is required. 1639 | hz 10 1640 | 1641 | # Normally it is useful to have an HZ value which is proportional to the 1642 | # number of clients connected. This is useful in order, for instance, to 1643 | # avoid too many clients are processed for each background task invocation 1644 | # in order to avoid latency spikes. 1645 | # 1646 | # Since the default HZ value by default is conservatively set to 10, Redis 1647 | # offers, and enables by default, the ability to use an adaptive HZ value 1648 | # which will temporary raise when there are many connected clients. 1649 | # 1650 | # When dynamic HZ is enabled, the actual configured HZ will be used 1651 | # as a baseline, but multiples of the configured HZ value will be actually 1652 | # used as needed once more clients are connected. In this way an idle 1653 | # instance will use very little CPU time while a busy instance will be 1654 | # more responsive. 1655 | dynamic-hz yes 1656 | 1657 | # When a child rewrites the AOF file, if the following option is enabled 1658 | # the file will be fsync-ed every 32 MB of data generated. This is useful 1659 | # in order to commit the file to the disk more incrementally and avoid 1660 | # big latency spikes. 1661 | aof-rewrite-incremental-fsync yes 1662 | 1663 | # When redis saves RDB file, if the following option is enabled 1664 | # the file will be fsync-ed every 32 MB of data generated. This is useful 1665 | # in order to commit the file to the disk more incrementally and avoid 1666 | # big latency spikes. 1667 | rdb-save-incremental-fsync yes 1668 | 1669 | # Redis LFU eviction (see maxmemory setting) can be tuned. However it is a good 1670 | # idea to start with the default settings and only change them after investigating 1671 | # how to improve the performances and how the keys LFU change over time, which 1672 | # is possible to inspect via the OBJECT FREQ command. 1673 | # 1674 | # There are two tunable parameters in the Redis LFU implementation: the 1675 | # counter logarithm factor and the counter decay time. It is important to 1676 | # understand what the two parameters mean before changing them. 1677 | # 1678 | # The LFU counter is just 8 bits per key, it's maximum value is 255, so Redis 1679 | # uses a probabilistic increment with logarithmic behavior. Given the value 1680 | # of the old counter, when a key is accessed, the counter is incremented in 1681 | # this way: 1682 | # 1683 | # 1. A random number R between 0 and 1 is extracted. 1684 | # 2. A probability P is calculated as 1/(old_value*lfu_log_factor+1). 1685 | # 3. The counter is incremented only if R < P. 1686 | # 1687 | # The default lfu-log-factor is 10. This is a table of how the frequency 1688 | # counter changes with a different number of accesses with different 1689 | # logarithmic factors: 1690 | # 1691 | # +--------+------------+------------+------------+------------+------------+ 1692 | # | factor | 100 hits | 1000 hits | 100K hits | 1M hits | 10M hits | 1693 | # +--------+------------+------------+------------+------------+------------+ 1694 | # | 0 | 104 | 255 | 255 | 255 | 255 | 1695 | # +--------+------------+------------+------------+------------+------------+ 1696 | # | 1 | 18 | 49 | 255 | 255 | 255 | 1697 | # +--------+------------+------------+------------+------------+------------+ 1698 | # | 10 | 10 | 18 | 142 | 255 | 255 | 1699 | # +--------+------------+------------+------------+------------+------------+ 1700 | # | 100 | 8 | 11 | 49 | 143 | 255 | 1701 | # +--------+------------+------------+------------+------------+------------+ 1702 | # 1703 | # NOTE: The above table was obtained by running the following commands: 1704 | # 1705 | # redis-benchmark -n 1000000 incr foo 1706 | # redis-cli object freq foo 1707 | # 1708 | # NOTE 2: The counter initial value is 5 in order to give new objects a chance 1709 | # to accumulate hits. 1710 | # 1711 | # The counter decay time is the time, in minutes, that must elapse in order 1712 | # for the key counter to be divided by two (or decremented if it has a value 1713 | # less <= 10). 1714 | # 1715 | # The default value for the lfu-decay-time is 1. A Special value of 0 means to 1716 | # decay the counter every time it happens to be scanned. 1717 | # 1718 | # lfu-log-factor 10 1719 | # lfu-decay-time 1 1720 | 1721 | ########################### ACTIVE DEFRAGMENTATION ####################### 1722 | # 1723 | # What is active defragmentation? 1724 | # ------------------------------- 1725 | # 1726 | # Active (online) defragmentation allows a Redis server to compact the 1727 | # spaces left between small allocations and deallocations of data in memory, 1728 | # thus allowing to reclaim back memory. 1729 | # 1730 | # Fragmentation is a natural process that happens with every allocator (but 1731 | # less so with Jemalloc, fortunately) and certain workloads. Normally a server 1732 | # restart is needed in order to lower the fragmentation, or at least to flush 1733 | # away all the data and create it again. However thanks to this feature 1734 | # implemented by Oran Agra for Redis 4.0 this process can happen at runtime 1735 | # in an "hot" way, while the server is running. 1736 | # 1737 | # Basically when the fragmentation is over a certain level (see the 1738 | # configuration options below) Redis will start to create new copies of the 1739 | # values in contiguous memory regions by exploiting certain specific Jemalloc 1740 | # features (in order to understand if an allocation is causing fragmentation 1741 | # and to allocate it in a better place), and at the same time, will release the 1742 | # old copies of the data. This process, repeated incrementally for all the keys 1743 | # will cause the fragmentation to drop back to normal values. 1744 | # 1745 | # Important things to understand: 1746 | # 1747 | # 1. This feature is disabled by default, and only works if you compiled Redis 1748 | # to use the copy of Jemalloc we ship with the source code of Redis. 1749 | # This is the default with Linux builds. 1750 | # 1751 | # 2. You never need to enable this feature if you don't have fragmentation 1752 | # issues. 1753 | # 1754 | # 3. Once you experience fragmentation, you can enable this feature when 1755 | # needed with the command "CONFIG SET activedefrag yes". 1756 | # 1757 | # The configuration parameters are able to fine tune the behavior of the 1758 | # defragmentation process. If you are not sure about what they mean it is 1759 | # a good idea to leave the defaults untouched. 1760 | 1761 | # Enabled active defragmentation 1762 | # activedefrag no 1763 | 1764 | # Minimum amount of fragmentation waste to start active defrag 1765 | # active-defrag-ignore-bytes 100mb 1766 | 1767 | # Minimum percentage of fragmentation to start active defrag 1768 | # active-defrag-threshold-lower 10 1769 | 1770 | # Maximum percentage of fragmentation at which we use maximum effort 1771 | # active-defrag-threshold-upper 100 1772 | 1773 | # Minimal effort for defrag in CPU percentage, to be used when the lower 1774 | # threshold is reached 1775 | # active-defrag-cycle-min 1 1776 | 1777 | # Maximal effort for defrag in CPU percentage, to be used when the upper 1778 | # threshold is reached 1779 | # active-defrag-cycle-max 25 1780 | 1781 | # Maximum number of set/hash/zset/list fields that will be processed from 1782 | # the main dictionary scan 1783 | # active-defrag-max-scan-fields 1000 -------------------------------------------------------------------------------- /redis-with-command/docker-compose.yaml: -------------------------------------------------------------------------------- 1 | version: '3.5' 2 | 3 | services: 4 | redis: 5 | container_name: redis 6 | image: redis:6 7 | command: redis-server /usr/local/etc/redis/redis.conf 8 | ports: 9 | - 6379:6379 10 | volumes: 11 | - ./config/redis.conf:/usr/local/etc/redis/redis.conf 12 | - ./command:/usr/local/etc/command -------------------------------------------------------------------------------- /redis-with-config/config/redis.conf: -------------------------------------------------------------------------------- 1 | # Redis configuration file example. 2 | # 3 | # Note that in order to read the configuration file, Redis must be 4 | # started with the file path as first argument: 5 | # 6 | # ./redis-server /path/to/redis.conf 7 | 8 | # Note on units: when memory size is needed, it is possible to specify 9 | # it in the usual form of 1k 5GB 4M and so forth: 10 | # 11 | # 1k => 1000 bytes 12 | # 1kb => 1024 bytes 13 | # 1m => 1000000 bytes 14 | # 1mb => 1024*1024 bytes 15 | # 1g => 1000000000 bytes 16 | # 1gb => 1024*1024*1024 bytes 17 | # 18 | # units are case insensitive so 1GB 1Gb 1gB are all the same. 19 | 20 | ################################## INCLUDES ################################### 21 | 22 | # Include one or more other config files here. This is useful if you 23 | # have a standard template that goes to all Redis servers but also need 24 | # to customize a few per-server settings. Include files can include 25 | # other files, so use this wisely. 26 | # 27 | # Notice option "include" won't be rewritten by command "CONFIG REWRITE" 28 | # from admin or Redis Sentinel. Since Redis always uses the last processed 29 | # line as value of a configuration directive, you'd better put includes 30 | # at the beginning of this file to avoid overwriting config change at runtime. 31 | # 32 | # If instead you are interested in using includes to override configuration 33 | # options, it is better to use include as the last line. 34 | # 35 | # include /path/to/local.conf 36 | # include /path/to/other.conf 37 | 38 | ################################## MODULES ##################################### 39 | 40 | # Load modules at startup. If the server is not able to load modules 41 | # it will abort. It is possible to use multiple loadmodule directives. 42 | # 43 | # loadmodule /path/to/my_module.so 44 | # loadmodule /path/to/other_module.so 45 | 46 | ################################## NETWORK ##################################### 47 | 48 | # By default, if no "bind" configuration directive is specified, Redis listens 49 | # for connections from all the network interfaces available on the server. 50 | # It is possible to listen to just one or multiple selected interfaces using 51 | # the "bind" configuration directive, followed by one or more IP addresses. 52 | # 53 | # Examples: 54 | # 55 | # bind 192.168.1.100 10.0.0.1 56 | # bind 127.0.0.1 ::1 57 | # 58 | # ~~~ WARNING ~~~ If the computer running Redis is directly exposed to the 59 | # internet, binding to all the interfaces is dangerous and will expose the 60 | # instance to everybody on the internet. So by default we uncomment the 61 | # following bind directive, that will force Redis to listen only into 62 | # the IPv4 loopback interface address (this means Redis will be able to 63 | # accept connections only from clients running into the same computer it 64 | # is running). 65 | # 66 | # IF YOU ARE SURE YOU WANT YOUR INSTANCE TO LISTEN TO ALL THE INTERFACES 67 | # JUST COMMENT THE FOLLOWING LINE. 68 | # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 69 | bind 127.0.0.1 70 | 71 | # Protected mode is a layer of security protection, in order to avoid that 72 | # Redis instances left open on the internet are accessed and exploited. 73 | # 74 | # When protected mode is on and if: 75 | # 76 | # 1) The server is not binding explicitly to a set of addresses using the 77 | # "bind" directive. 78 | # 2) No password is configured. 79 | # 80 | # The server only accepts connections from clients connecting from the 81 | # IPv4 and IPv6 loopback addresses 127.0.0.1 and ::1, and from Unix domain 82 | # sockets. 83 | # 84 | # By default protected mode is enabled. You should disable it only if 85 | # you are sure you want clients from other hosts to connect to Redis 86 | # even if no authentication is configured, nor a specific set of interfaces 87 | # are explicitly listed using the "bind" directive. 88 | protected-mode yes 89 | 90 | # Accept connections on the specified port, default is 6379 (IANA #815344). 91 | # If port 0 is specified Redis will not listen on a TCP socket. 92 | port 6379 93 | 94 | # TCP listen() backlog. 95 | # 96 | # In high requests-per-second environments you need an high backlog in order 97 | # to avoid slow clients connections issues. Note that the Linux kernel 98 | # will silently truncate it to the value of /proc/sys/net/core/somaxconn so 99 | # make sure to raise both the value of somaxconn and tcp_max_syn_backlog 100 | # in order to get the desired effect. 101 | tcp-backlog 511 102 | 103 | # Unix socket. 104 | # 105 | # Specify the path for the Unix socket that will be used to listen for 106 | # incoming connections. There is no default, so Redis will not listen 107 | # on a unix socket when not specified. 108 | # 109 | # unixsocket /tmp/redis.sock 110 | # unixsocketperm 700 111 | 112 | # Close the connection after a client is idle for N seconds (0 to disable) 113 | timeout 0 114 | 115 | # TCP keepalive. 116 | # 117 | # If non-zero, use SO_KEEPALIVE to send TCP ACKs to clients in absence 118 | # of communication. This is useful for two reasons: 119 | # 120 | # 1) Detect dead peers. 121 | # 2) Take the connection alive from the point of view of network 122 | # equipment in the middle. 123 | # 124 | # On Linux, the specified value (in seconds) is the period used to send ACKs. 125 | # Note that to close the connection the double of the time is needed. 126 | # On other kernels the period depends on the kernel configuration. 127 | # 128 | # A reasonable value for this option is 300 seconds, which is the new 129 | # Redis default starting with Redis 3.2.1. 130 | tcp-keepalive 300 131 | 132 | ################################# TLS/SSL ##################################### 133 | 134 | # By default, TLS/SSL is disabled. To enable it, the "tls-port" configuration 135 | # directive can be used to define TLS-listening ports. To enable TLS on the 136 | # default port, use: 137 | # 138 | # port 0 139 | # tls-port 6379 140 | 141 | # Configure a X.509 certificate and private key to use for authenticating the 142 | # server to connected clients, masters or cluster peers. These files should be 143 | # PEM formatted. 144 | # 145 | # tls-cert-file redis.crt 146 | # tls-key-file redis.key 147 | 148 | # Configure a DH parameters file to enable Diffie-Hellman (DH) key exchange: 149 | # 150 | # tls-dh-params-file redis.dh 151 | 152 | # Configure a CA certificate(s) bundle or directory to authenticate TLS/SSL 153 | # clients and peers. Redis requires an explicit configuration of at least one 154 | # of these, and will not implicitly use the system wide configuration. 155 | # 156 | # tls-ca-cert-file ca.crt 157 | # tls-ca-cert-dir /etc/ssl/certs 158 | 159 | # By default, clients (including replica servers) on a TLS port are required 160 | # to authenticate using valid client side certificates. 161 | # 162 | # It is possible to disable authentication using this directive. 163 | # 164 | # tls-auth-clients no 165 | 166 | # By default, a Redis replica does not attempt to establish a TLS connection 167 | # with its master. 168 | # 169 | # Use the following directive to enable TLS on replication links. 170 | # 171 | # tls-replication yes 172 | 173 | # By default, the Redis Cluster bus uses a plain TCP connection. To enable 174 | # TLS for the bus protocol, use the following directive: 175 | # 176 | # tls-cluster yes 177 | 178 | # Explicitly specify TLS versions to support. Allowed values are case insensitive 179 | # and include "TLSv1", "TLSv1.1", "TLSv1.2", "TLSv1.3" (OpenSSL >= 1.1.1) 180 | # 181 | # tls-protocols TLSv1.2 182 | 183 | # Configure allowed ciphers. See the ciphers(1ssl) manpage for more information 184 | # about the syntax of this string. 185 | # 186 | # Note: this configuration applies only to <= TLSv1.2. 187 | # 188 | # tls-ciphers DEFAULT:!MEDIUM 189 | 190 | # Configure allowed TLSv1.3 ciphersuites. See the ciphers(1ssl) manpage for more 191 | # information about the syntax of this string, and specifically for TLSv1.3 192 | # ciphersuites. 193 | # 194 | # tls-ciphersuites TLS_CHACHA20_POLY1305_SHA256 195 | 196 | # When choosing a cipher, use the server's preference instead of the client 197 | # preference. By default, the server follows the client's preference. 198 | # 199 | # tls-prefer-server-ciphers yes 200 | 201 | ################################# GENERAL ##################################### 202 | 203 | # By default Redis does not run as a daemon. Use 'yes' if you need it. 204 | # Note that Redis will write a pid file in /var/run/redis.pid when daemonized. 205 | daemonize no 206 | 207 | # If you run Redis from upstart or systemd, Redis can interact with your 208 | # supervision tree. Options: 209 | # supervised no - no supervision interaction 210 | # supervised upstart - signal upstart by putting Redis into SIGSTOP mode 211 | # supervised systemd - signal systemd by writing READY=1 to $NOTIFY_SOCKET 212 | # supervised auto - detect upstart or systemd method based on 213 | # UPSTART_JOB or NOTIFY_SOCKET environment variables 214 | # Note: these supervision methods only signal "process is ready." 215 | # They do not enable continuous liveness pings back to your supervisor. 216 | supervised no 217 | 218 | # If a pid file is specified, Redis writes it where specified at startup 219 | # and removes it at exit. 220 | # 221 | # When the server runs non daemonized, no pid file is created if none is 222 | # specified in the configuration. When the server is daemonized, the pid file 223 | # is used even if not specified, defaulting to "/var/run/redis.pid". 224 | # 225 | # Creating a pid file is best effort: if Redis is not able to create it 226 | # nothing bad happens, the server will start and run normally. 227 | pidfile /var/run/redis_6379.pid 228 | 229 | # Specify the server verbosity level. 230 | # This can be one of: 231 | # debug (a lot of information, useful for development/testing) 232 | # verbose (many rarely useful info, but not a mess like the debug level) 233 | # notice (moderately verbose, what you want in production probably) 234 | # warning (only very important / critical messages are logged) 235 | loglevel notice 236 | 237 | # Specify the log file name. Also the empty string can be used to force 238 | # Redis to log on the standard output. Note that if you use standard 239 | # output for logging but daemonize, logs will be sent to /dev/null 240 | logfile "" 241 | 242 | # To enable logging to the system logger, just set 'syslog-enabled' to yes, 243 | # and optionally update the other syslog parameters to suit your needs. 244 | # syslog-enabled no 245 | 246 | # Specify the syslog identity. 247 | # syslog-ident redis 248 | 249 | # Specify the syslog facility. Must be USER or between LOCAL0-LOCAL7. 250 | # syslog-facility local0 251 | 252 | # Set the number of databases. The default database is DB 0, you can select 253 | # a different one on a per-connection basis using SELECT where 254 | # dbid is a number between 0 and 'databases'-1 255 | databases 16 256 | 257 | # By default Redis shows an ASCII art logo only when started to log to the 258 | # standard output and if the standard output is a TTY. Basically this means 259 | # that normally a logo is displayed only in interactive sessions. 260 | # 261 | # However it is possible to force the pre-4.0 behavior and always show a 262 | # ASCII art logo in startup logs by setting the following option to yes. 263 | always-show-logo yes 264 | 265 | ################################ SNAPSHOTTING ################################ 266 | # 267 | # Save the DB on disk: 268 | # 269 | # save 270 | # 271 | # Will save the DB if both the given number of seconds and the given 272 | # number of write operations against the DB occurred. 273 | # 274 | # In the example below the behaviour will be to save: 275 | # after 900 sec (15 min) if at least 1 key changed 276 | # after 300 sec (5 min) if at least 10 keys changed 277 | # after 60 sec if at least 10000 keys changed 278 | # 279 | # Note: you can disable saving completely by commenting out all "save" lines. 280 | # 281 | # It is also possible to remove all the previously configured save 282 | # points by adding a save directive with a single empty string argument 283 | # like in the following example: 284 | # 285 | # save "" 286 | 287 | save 900 1 288 | save 300 10 289 | save 60 10000 290 | 291 | # By default Redis will stop accepting writes if RDB snapshots are enabled 292 | # (at least one save point) and the latest background save failed. 293 | # This will make the user aware (in a hard way) that data is not persisting 294 | # on disk properly, otherwise chances are that no one will notice and some 295 | # disaster will happen. 296 | # 297 | # If the background saving process will start working again Redis will 298 | # automatically allow writes again. 299 | # 300 | # However if you have setup your proper monitoring of the Redis server 301 | # and persistence, you may want to disable this feature so that Redis will 302 | # continue to work as usual even if there are problems with disk, 303 | # permissions, and so forth. 304 | stop-writes-on-bgsave-error yes 305 | 306 | # Compress string objects using LZF when dump .rdb databases? 307 | # For default that's set to 'yes' as it's almost always a win. 308 | # If you want to save some CPU in the saving child set it to 'no' but 309 | # the dataset will likely be bigger if you have compressible values or keys. 310 | rdbcompression yes 311 | 312 | # Since version 5 of RDB a CRC64 checksum is placed at the end of the file. 313 | # This makes the format more resistant to corruption but there is a performance 314 | # hit to pay (around 10%) when saving and loading RDB files, so you can disable it 315 | # for maximum performances. 316 | # 317 | # RDB files created with checksum disabled have a checksum of zero that will 318 | # tell the loading code to skip the check. 319 | rdbchecksum yes 320 | 321 | # The filename where to dump the DB 322 | dbfilename dump.rdb 323 | 324 | # Remove RDB files used by replication in instances without persistence 325 | # enabled. By default this option is disabled, however there are environments 326 | # where for regulations or other security concerns, RDB files persisted on 327 | # disk by masters in order to feed replicas, or stored on disk by replicas 328 | # in order to load them for the initial synchronization, should be deleted 329 | # ASAP. Note that this option ONLY WORKS in instances that have both AOF 330 | # and RDB persistence disabled, otherwise is completely ignored. 331 | # 332 | # An alternative (and sometimes better) way to obtain the same effect is 333 | # to use diskless replication on both master and replicas instances. However 334 | # in the case of replicas, diskless is not always an option. 335 | rdb-del-sync-files no 336 | 337 | # The working directory. 338 | # 339 | # The DB will be written inside this directory, with the filename specified 340 | # above using the 'dbfilename' configuration directive. 341 | # 342 | # The Append Only File will also be created inside this directory. 343 | # 344 | # Note that you must specify a directory here, not a file name. 345 | dir ./ 346 | 347 | ################################# REPLICATION ################################# 348 | 349 | # Master-Replica replication. Use replicaof to make a Redis instance a copy of 350 | # another Redis server. A few things to understand ASAP about Redis replication. 351 | # 352 | # +------------------+ +---------------+ 353 | # | Master | ---> | Replica | 354 | # | (receive writes) | | (exact copy) | 355 | # +------------------+ +---------------+ 356 | # 357 | # 1) Redis replication is asynchronous, but you can configure a master to 358 | # stop accepting writes if it appears to be not connected with at least 359 | # a given number of replicas. 360 | # 2) Redis replicas are able to perform a partial resynchronization with the 361 | # master if the replication link is lost for a relatively small amount of 362 | # time. You may want to configure the replication backlog size (see the next 363 | # sections of this file) with a sensible value depending on your needs. 364 | # 3) Replication is automatic and does not need user intervention. After a 365 | # network partition replicas automatically try to reconnect to masters 366 | # and resynchronize with them. 367 | # 368 | # replicaof 369 | 370 | # If the master is password protected (using the "requirepass" configuration 371 | # directive below) it is possible to tell the replica to authenticate before 372 | # starting the replication synchronization process, otherwise the master will 373 | # refuse the replica request. 374 | # 375 | # masterauth 376 | # 377 | # However this is not enough if you are using Redis ACLs (for Redis version 378 | # 6 or greater), and the default user is not capable of running the PSYNC 379 | # command and/or other commands needed for replication. In this case it's 380 | # better to configure a special user to use with replication, and specify the 381 | # masteruser configuration as such: 382 | # 383 | # masteruser 384 | # 385 | # When masteruser is specified, the replica will authenticate against its 386 | # master using the new AUTH form: AUTH . 387 | 388 | # When a replica loses its connection with the master, or when the replication 389 | # is still in progress, the replica can act in two different ways: 390 | # 391 | # 1) if replica-serve-stale-data is set to 'yes' (the default) the replica will 392 | # still reply to client requests, possibly with out of date data, or the 393 | # data set may just be empty if this is the first synchronization. 394 | # 395 | # 2) if replica-serve-stale-data is set to 'no' the replica will reply with 396 | # an error "SYNC with master in progress" to all the kind of commands 397 | # but to INFO, replicaOF, AUTH, PING, SHUTDOWN, REPLCONF, ROLE, CONFIG, 398 | # SUBSCRIBE, UNSUBSCRIBE, PSUBSCRIBE, PUNSUBSCRIBE, PUBLISH, PUBSUB, 399 | # COMMAND, POST, HOST: and LATENCY. 400 | # 401 | replica-serve-stale-data yes 402 | 403 | # You can configure a replica instance to accept writes or not. Writing against 404 | # a replica instance may be useful to store some ephemeral data (because data 405 | # written on a replica will be easily deleted after resync with the master) but 406 | # may also cause problems if clients are writing to it because of a 407 | # misconfiguration. 408 | # 409 | # Since Redis 2.6 by default replicas are read-only. 410 | # 411 | # Note: read only replicas are not designed to be exposed to untrusted clients 412 | # on the internet. It's just a protection layer against misuse of the instance. 413 | # Still a read only replica exports by default all the administrative commands 414 | # such as CONFIG, DEBUG, and so forth. To a limited extent you can improve 415 | # security of read only replicas using 'rename-command' to shadow all the 416 | # administrative / dangerous commands. 417 | replica-read-only yes 418 | 419 | # Replication SYNC strategy: disk or socket. 420 | # 421 | # New replicas and reconnecting replicas that are not able to continue the 422 | # replication process just receiving differences, need to do what is called a 423 | # "full synchronization". An RDB file is transmitted from the master to the 424 | # replicas. 425 | # 426 | # The transmission can happen in two different ways: 427 | # 428 | # 1) Disk-backed: The Redis master creates a new process that writes the RDB 429 | # file on disk. Later the file is transferred by the parent 430 | # process to the replicas incrementally. 431 | # 2) Diskless: The Redis master creates a new process that directly writes the 432 | # RDB file to replica sockets, without touching the disk at all. 433 | # 434 | # With disk-backed replication, while the RDB file is generated, more replicas 435 | # can be queued and served with the RDB file as soon as the current child 436 | # producing the RDB file finishes its work. With diskless replication instead 437 | # once the transfer starts, new replicas arriving will be queued and a new 438 | # transfer will start when the current one terminates. 439 | # 440 | # When diskless replication is used, the master waits a configurable amount of 441 | # time (in seconds) before starting the transfer in the hope that multiple 442 | # replicas will arrive and the transfer can be parallelized. 443 | # 444 | # With slow disks and fast (large bandwidth) networks, diskless replication 445 | # works better. 446 | repl-diskless-sync no 447 | 448 | # When diskless replication is enabled, it is possible to configure the delay 449 | # the server waits in order to spawn the child that transfers the RDB via socket 450 | # to the replicas. 451 | # 452 | # This is important since once the transfer starts, it is not possible to serve 453 | # new replicas arriving, that will be queued for the next RDB transfer, so the 454 | # server waits a delay in order to let more replicas arrive. 455 | # 456 | # The delay is specified in seconds, and by default is 5 seconds. To disable 457 | # it entirely just set it to 0 seconds and the transfer will start ASAP. 458 | repl-diskless-sync-delay 5 459 | 460 | # ----------------------------------------------------------------------------- 461 | # WARNING: RDB diskless load is experimental. Since in this setup the replica 462 | # does not immediately store an RDB on disk, it may cause data loss during 463 | # failovers. RDB diskless load + Redis modules not handling I/O reads may also 464 | # cause Redis to abort in case of I/O errors during the initial synchronization 465 | # stage with the master. Use only if your do what you are doing. 466 | # ----------------------------------------------------------------------------- 467 | # 468 | # Replica can load the RDB it reads from the replication link directly from the 469 | # socket, or store the RDB to a file and read that file after it was completely 470 | # recived from the master. 471 | # 472 | # In many cases the disk is slower than the network, and storing and loading 473 | # the RDB file may increase replication time (and even increase the master's 474 | # Copy on Write memory and salve buffers). 475 | # However, parsing the RDB file directly from the socket may mean that we have 476 | # to flush the contents of the current database before the full rdb was 477 | # received. For this reason we have the following options: 478 | # 479 | # "disabled" - Don't use diskless load (store the rdb file to the disk first) 480 | # "on-empty-db" - Use diskless load only when it is completely safe. 481 | # "swapdb" - Keep a copy of the current db contents in RAM while parsing 482 | # the data directly from the socket. note that this requires 483 | # sufficient memory, if you don't have it, you risk an OOM kill. 484 | repl-diskless-load disabled 485 | 486 | # Replicas send PINGs to server in a predefined interval. It's possible to 487 | # change this interval with the repl_ping_replica_period option. The default 488 | # value is 10 seconds. 489 | # 490 | # repl-ping-replica-period 10 491 | 492 | # The following option sets the replication timeout for: 493 | # 494 | # 1) Bulk transfer I/O during SYNC, from the point of view of replica. 495 | # 2) Master timeout from the point of view of replicas (data, pings). 496 | # 3) Replica timeout from the point of view of masters (REPLCONF ACK pings). 497 | # 498 | # It is important to make sure that this value is greater than the value 499 | # specified for repl-ping-replica-period otherwise a timeout will be detected 500 | # every time there is low traffic between the master and the replica. 501 | # 502 | # repl-timeout 60 503 | 504 | # Disable TCP_NODELAY on the replica socket after SYNC? 505 | # 506 | # If you select "yes" Redis will use a smaller number of TCP packets and 507 | # less bandwidth to send data to replicas. But this can add a delay for 508 | # the data to appear on the replica side, up to 40 milliseconds with 509 | # Linux kernels using a default configuration. 510 | # 511 | # If you select "no" the delay for data to appear on the replica side will 512 | # be reduced but more bandwidth will be used for replication. 513 | # 514 | # By default we optimize for low latency, but in very high traffic conditions 515 | # or when the master and replicas are many hops away, turning this to "yes" may 516 | # be a good idea. 517 | repl-disable-tcp-nodelay no 518 | 519 | # Set the replication backlog size. The backlog is a buffer that accumulates 520 | # replica data when replicas are disconnected for some time, so that when a 521 | # replica wants to reconnect again, often a full resync is not needed, but a 522 | # partial resync is enough, just passing the portion of data the replica 523 | # missed while disconnected. 524 | # 525 | # The bigger the replication backlog, the longer the time the replica can be 526 | # disconnected and later be able to perform a partial resynchronization. 527 | # 528 | # The backlog is only allocated once there is at least a replica connected. 529 | # 530 | # repl-backlog-size 1mb 531 | 532 | # After a master has no longer connected replicas for some time, the backlog 533 | # will be freed. The following option configures the amount of seconds that 534 | # need to elapse, starting from the time the last replica disconnected, for 535 | # the backlog buffer to be freed. 536 | # 537 | # Note that replicas never free the backlog for timeout, since they may be 538 | # promoted to masters later, and should be able to correctly "partially 539 | # resynchronize" with the replicas: hence they should always accumulate backlog. 540 | # 541 | # A value of 0 means to never release the backlog. 542 | # 543 | # repl-backlog-ttl 3600 544 | 545 | # The replica priority is an integer number published by Redis in the INFO 546 | # output. It is used by Redis Sentinel in order to select a replica to promote 547 | # into a master if the master is no longer working correctly. 548 | # 549 | # A replica with a low priority number is considered better for promotion, so 550 | # for instance if there are three replicas with priority 10, 100, 25 Sentinel 551 | # will pick the one with priority 10, that is the lowest. 552 | # 553 | # However a special priority of 0 marks the replica as not able to perform the 554 | # role of master, so a replica with priority of 0 will never be selected by 555 | # Redis Sentinel for promotion. 556 | # 557 | # By default the priority is 100. 558 | replica-priority 100 559 | 560 | # It is possible for a master to stop accepting writes if there are less than 561 | # N replicas connected, having a lag less or equal than M seconds. 562 | # 563 | # The N replicas need to be in "online" state. 564 | # 565 | # The lag in seconds, that must be <= the specified value, is calculated from 566 | # the last ping received from the replica, that is usually sent every second. 567 | # 568 | # This option does not GUARANTEE that N replicas will accept the write, but 569 | # will limit the window of exposure for lost writes in case not enough replicas 570 | # are available, to the specified number of seconds. 571 | # 572 | # For example to require at least 3 replicas with a lag <= 10 seconds use: 573 | # 574 | # min-replicas-to-write 3 575 | # min-replicas-max-lag 10 576 | # 577 | # Setting one or the other to 0 disables the feature. 578 | # 579 | # By default min-replicas-to-write is set to 0 (feature disabled) and 580 | # min-replicas-max-lag is set to 10. 581 | 582 | # A Redis master is able to list the address and port of the attached 583 | # replicas in different ways. For example the "INFO replication" section 584 | # offers this information, which is used, among other tools, by 585 | # Redis Sentinel in order to discover replica instances. 586 | # Another place where this info is available is in the output of the 587 | # "ROLE" command of a master. 588 | # 589 | # The listed IP and address normally reported by a replica is obtained 590 | # in the following way: 591 | # 592 | # IP: The address is auto detected by checking the peer address 593 | # of the socket used by the replica to connect with the master. 594 | # 595 | # Port: The port is communicated by the replica during the replication 596 | # handshake, and is normally the port that the replica is using to 597 | # listen for connections. 598 | # 599 | # However when port forwarding or Network Address Translation (NAT) is 600 | # used, the replica may be actually reachable via different IP and port 601 | # pairs. The following two options can be used by a replica in order to 602 | # report to its master a specific set of IP and port, so that both INFO 603 | # and ROLE will report those values. 604 | # 605 | # There is no need to use both the options if you need to override just 606 | # the port or the IP address. 607 | # 608 | # replica-announce-ip 5.5.5.5 609 | # replica-announce-port 1234 610 | 611 | ############################### KEYS TRACKING ################################# 612 | 613 | # Redis implements server assisted support for client side caching of values. 614 | # This is implemented using an invalidation table that remembers, using 615 | # 16 millions of slots, what clients may have certain subsets of keys. In turn 616 | # this is used in order to send invalidation messages to clients. Please 617 | # to understand more about the feature check this page: 618 | # 619 | # https://redis.io/topics/client-side-caching 620 | # 621 | # When tracking is enabled for a client, all the read only queries are assumed 622 | # to be cached: this will force Redis to store information in the invalidation 623 | # table. When keys are modified, such information is flushed away, and 624 | # invalidation messages are sent to the clients. However if the workload is 625 | # heavily dominated by reads, Redis could use more and more memory in order 626 | # to track the keys fetched by many clients. 627 | # 628 | # For this reason it is possible to configure a maximum fill value for the 629 | # invalidation table. By default it is set to 1M of keys, and once this limit 630 | # is reached, Redis will start to evict keys in the invalidation table 631 | # even if they were not modified, just to reclaim memory: this will in turn 632 | # force the clients to invalidate the cached values. Basically the table 633 | # maximum size is a trade off between the memory you want to spend server 634 | # side to track information about who cached what, and the ability of clients 635 | # to retain cached objects in memory. 636 | # 637 | # If you set the value to 0, it means there are no limits, and Redis will 638 | # retain as many keys as needed in the invalidation table. 639 | # In the "stats" INFO section, you can find information about the number of 640 | # keys in the invalidation table at every given moment. 641 | # 642 | # Note: when key tracking is used in broadcasting mode, no memory is used 643 | # in the server side so this setting is useless. 644 | # 645 | # tracking-table-max-keys 1000000 646 | 647 | ################################## SECURITY ################################### 648 | 649 | # Warning: since Redis is pretty fast an outside user can try up to 650 | # 1 million passwords per second against a modern box. This means that you 651 | # should use very strong passwords, otherwise they will be very easy to break. 652 | # Note that because the password is really a shared secret between the client 653 | # and the server, and should not be memorized by any human, the password 654 | # can be easily a long string from /dev/urandom or whatever, so by using a 655 | # long and unguessable password no brute force attack will be possible. 656 | 657 | # Redis ACL users are defined in the following format: 658 | # 659 | # user ... acl rules ... 660 | # 661 | # For example: 662 | # 663 | # user worker +@list +@connection ~jobs:* on >ffa9203c493aa99 664 | # 665 | # The special username "default" is used for new connections. If this user 666 | # has the "nopass" rule, then new connections will be immediately authenticated 667 | # as the "default" user without the need of any password provided via the 668 | # AUTH command. Otherwise if the "default" user is not flagged with "nopass" 669 | # the connections will start in not authenticated state, and will require 670 | # AUTH (or the HELLO command AUTH option) in order to be authenticated and 671 | # start to work. 672 | # 673 | # The ACL rules that describe what an user can do are the following: 674 | # 675 | # on Enable the user: it is possible to authenticate as this user. 676 | # off Disable the user: it's no longer possible to authenticate 677 | # with this user, however the already authenticated connections 678 | # will still work. 679 | # + Allow the execution of that command 680 | # - Disallow the execution of that command 681 | # +@ Allow the execution of all the commands in such category 682 | # with valid categories are like @admin, @set, @sortedset, ... 683 | # and so forth, see the full list in the server.c file where 684 | # the Redis command table is described and defined. 685 | # The special category @all means all the commands, but currently 686 | # present in the server, and that will be loaded in the future 687 | # via modules. 688 | # +|subcommand Allow a specific subcommand of an otherwise 689 | # disabled command. Note that this form is not 690 | # allowed as negative like -DEBUG|SEGFAULT, but 691 | # only additive starting with "+". 692 | # allcommands Alias for +@all. Note that it implies the ability to execute 693 | # all the future commands loaded via the modules system. 694 | # nocommands Alias for -@all. 695 | # ~ Add a pattern of keys that can be mentioned as part of 696 | # commands. For instance ~* allows all the keys. The pattern 697 | # is a glob-style pattern like the one of KEYS. 698 | # It is possible to specify multiple patterns. 699 | # allkeys Alias for ~* 700 | # resetkeys Flush the list of allowed keys patterns. 701 | # > Add this passowrd to the list of valid password for the user. 702 | # For example >mypass will add "mypass" to the list. 703 | # This directive clears the "nopass" flag (see later). 704 | # < Remove this password from the list of valid passwords. 705 | # nopass All the set passwords of the user are removed, and the user 706 | # is flagged as requiring no password: it means that every 707 | # password will work against this user. If this directive is 708 | # used for the default user, every new connection will be 709 | # immediately authenticated with the default user without 710 | # any explicit AUTH command required. Note that the "resetpass" 711 | # directive will clear this condition. 712 | # resetpass Flush the list of allowed passwords. Moreover removes the 713 | # "nopass" status. After "resetpass" the user has no associated 714 | # passwords and there is no way to authenticate without adding 715 | # some password (or setting it as "nopass" later). 716 | # reset Performs the following actions: resetpass, resetkeys, off, 717 | # -@all. The user returns to the same state it has immediately 718 | # after its creation. 719 | # 720 | # ACL rules can be specified in any order: for instance you can start with 721 | # passwords, then flags, or key patterns. However note that the additive 722 | # and subtractive rules will CHANGE MEANING depending on the ordering. 723 | # For instance see the following example: 724 | # 725 | # user alice on +@all -DEBUG ~* >somepassword 726 | # 727 | # This will allow "alice" to use all the commands with the exception of the 728 | # DEBUG command, since +@all added all the commands to the set of the commands 729 | # alice can use, and later DEBUG was removed. However if we invert the order 730 | # of two ACL rules the result will be different: 731 | # 732 | # user alice on -DEBUG +@all ~* >somepassword 733 | # 734 | # Now DEBUG was removed when alice had yet no commands in the set of allowed 735 | # commands, later all the commands are added, so the user will be able to 736 | # execute everything. 737 | # 738 | # Basically ACL rules are processed left-to-right. 739 | # 740 | # For more information about ACL configuration please refer to 741 | # the Redis web site at https://redis.io/topics/acl 742 | 743 | # ACL LOG 744 | # 745 | # The ACL Log tracks failed commands and authentication events associated 746 | # with ACLs. The ACL Log is useful to troubleshoot failed commands blocked 747 | # by ACLs. The ACL Log is stored in and consumes memory. There is no limit 748 | # to its length.You can reclaim memory with ACL LOG RESET or set a maximum 749 | # length below. 750 | acllog-max-len 128 751 | 752 | # Using an external ACL file 753 | # 754 | # Instead of configuring users here in this file, it is possible to use 755 | # a stand-alone file just listing users. The two methods cannot be mixed: 756 | # if you configure users here and at the same time you activate the exteranl 757 | # ACL file, the server will refuse to start. 758 | # 759 | # The format of the external ACL user file is exactly the same as the 760 | # format that is used inside redis.conf to describe users. 761 | # 762 | # aclfile /etc/redis/users.acl 763 | 764 | # IMPORTANT NOTE: starting with Redis 6 "requirepass" is just a compatiblity 765 | # layer on top of the new ACL system. The option effect will be just setting 766 | # the password for the default user. Clients will still authenticate using 767 | # AUTH as usually, or more explicitly with AUTH default 768 | # if they follow the new protocol: both will work. 769 | # 770 | # requirepass foobared 771 | 772 | # Command renaming (DEPRECATED). 773 | # 774 | # ------------------------------------------------------------------------ 775 | # WARNING: avoid using this option if possible. Instead use ACLs to remove 776 | # commands from the default user, and put them only in some admin user you 777 | # create for administrative purposes. 778 | # ------------------------------------------------------------------------ 779 | # 780 | # It is possible to change the name of dangerous commands in a shared 781 | # environment. For instance the CONFIG command may be renamed into something 782 | # hard to guess so that it will still be available for internal-use tools 783 | # but not available for general clients. 784 | # 785 | # Example: 786 | # 787 | # rename-command CONFIG b840fc02d524045429941cc15f59e41cb7be6c52 788 | # 789 | # It is also possible to completely kill a command by renaming it into 790 | # an empty string: 791 | # 792 | # rename-command CONFIG "" 793 | # 794 | # Please note that changing the name of commands that are logged into the 795 | # AOF file or transmitted to replicas may cause problems. 796 | 797 | ################################### CLIENTS #################################### 798 | 799 | # Set the max number of connected clients at the same time. By default 800 | # this limit is set to 10000 clients, however if the Redis server is not 801 | # able to configure the process file limit to allow for the specified limit 802 | # the max number of allowed clients is set to the current file limit 803 | # minus 32 (as Redis reserves a few file descriptors for internal uses). 804 | # 805 | # Once the limit is reached Redis will close all the new connections sending 806 | # an error 'max number of clients reached'. 807 | # 808 | # maxclients 10000 809 | 810 | ############################## MEMORY MANAGEMENT ################################ 811 | 812 | # Set a memory usage limit to the specified amount of bytes. 813 | # When the memory limit is reached Redis will try to remove keys 814 | # according to the eviction policy selected (see maxmemory-policy). 815 | # 816 | # If Redis can't remove keys according to the policy, or if the policy is 817 | # set to 'noeviction', Redis will start to reply with errors to commands 818 | # that would use more memory, like SET, LPUSH, and so on, and will continue 819 | # to reply to read-only commands like GET. 820 | # 821 | # This option is usually useful when using Redis as an LRU or LFU cache, or to 822 | # set a hard memory limit for an instance (using the 'noeviction' policy). 823 | # 824 | # WARNING: If you have replicas attached to an instance with maxmemory on, 825 | # the size of the output buffers needed to feed the replicas are subtracted 826 | # from the used memory count, so that network problems / resyncs will 827 | # not trigger a loop where keys are evicted, and in turn the output 828 | # buffer of replicas is full with DELs of keys evicted triggering the deletion 829 | # of more keys, and so forth until the database is completely emptied. 830 | # 831 | # In short... if you have replicas attached it is suggested that you set a lower 832 | # limit for maxmemory so that there is some free RAM on the system for replica 833 | # output buffers (but this is not needed if the policy is 'noeviction'). 834 | # 835 | # maxmemory 836 | 837 | # MAXMEMORY POLICY: how Redis will select what to remove when maxmemory 838 | # is reached. You can select one from the following behaviors: 839 | # 840 | # volatile-lru -> Evict using approximated LRU, only keys with an expire set. 841 | # allkeys-lru -> Evict any key using approximated LRU. 842 | # volatile-lfu -> Evict using approximated LFU, only keys with an expire set. 843 | # allkeys-lfu -> Evict any key using approximated LFU. 844 | # volatile-random -> Remove a random key having an expire set. 845 | # allkeys-random -> Remove a random key, any key. 846 | # volatile-ttl -> Remove the key with the nearest expire time (minor TTL) 847 | # noeviction -> Don't evict anything, just return an error on write operations. 848 | # 849 | # LRU means Least Recently Used 850 | # LFU means Least Frequently Used 851 | # 852 | # Both LRU, LFU and volatile-ttl are implemented using approximated 853 | # randomized algorithms. 854 | # 855 | # Note: with any of the above policies, Redis will return an error on write 856 | # operations, when there are no suitable keys for eviction. 857 | # 858 | # At the date of writing these commands are: set setnx setex append 859 | # incr decr rpush lpush rpushx lpushx linsert lset rpoplpush sadd 860 | # sinter sinterstore sunion sunionstore sdiff sdiffstore zadd zincrby 861 | # zunionstore zinterstore hset hsetnx hmset hincrby incrby decrby 862 | # getset mset msetnx exec sort 863 | # 864 | # The default is: 865 | # 866 | # maxmemory-policy noeviction 867 | 868 | # LRU, LFU and minimal TTL algorithms are not precise algorithms but approximated 869 | # algorithms (in order to save memory), so you can tune it for speed or 870 | # accuracy. For default Redis will check five keys and pick the one that was 871 | # used less recently, you can change the sample size using the following 872 | # configuration directive. 873 | # 874 | # The default of 5 produces good enough results. 10 Approximates very closely 875 | # true LRU but costs more CPU. 3 is faster but not very accurate. 876 | # 877 | # maxmemory-samples 5 878 | 879 | # Starting from Redis 5, by default a replica will ignore its maxmemory setting 880 | # (unless it is promoted to master after a failover or manually). It means 881 | # that the eviction of keys will be just handled by the master, sending the 882 | # DEL commands to the replica as keys evict in the master side. 883 | # 884 | # This behavior ensures that masters and replicas stay consistent, and is usually 885 | # what you want, however if your replica is writable, or you want the replica 886 | # to have a different memory setting, and you are sure all the writes performed 887 | # to the replica are idempotent, then you may change this default (but be sure 888 | # to understand what you are doing). 889 | # 890 | # Note that since the replica by default does not evict, it may end using more 891 | # memory than the one set via maxmemory (there are certain buffers that may 892 | # be larger on the replica, or data structures may sometimes take more memory 893 | # and so forth). So make sure you monitor your replicas and make sure they 894 | # have enough memory to never hit a real out-of-memory condition before the 895 | # master hits the configured maxmemory setting. 896 | # 897 | # replica-ignore-maxmemory yes 898 | 899 | # Redis reclaims expired keys in two ways: upon access when those keys are 900 | # found to be expired, and also in background, in what is called the 901 | # "active expire key". The key space is slowly and interactively scanned 902 | # looking for expired keys to reclaim, so that it is possible to free memory 903 | # of keys that are expired and will never be accessed again in a short time. 904 | # 905 | # The default effort of the expire cycle will try to avoid having more than 906 | # ten percent of expired keys still in memory, and will try to avoid consuming 907 | # more than 25% of total memory and to add latency to the system. However 908 | # it is possible to increase the expire "effort" that is normally set to 909 | # "1", to a greater value, up to the value "10". At its maximum value the 910 | # system will use more CPU, longer cycles (and technically may introduce 911 | # more latency), and will tollerate less already expired keys still present 912 | # in the system. It's a tradeoff betweeen memory, CPU and latecy. 913 | # 914 | # active-expire-effort 1 915 | 916 | ############################# LAZY FREEING #################################### 917 | 918 | # Redis has two primitives to delete keys. One is called DEL and is a blocking 919 | # deletion of the object. It means that the server stops processing new commands 920 | # in order to reclaim all the memory associated with an object in a synchronous 921 | # way. If the key deleted is associated with a small object, the time needed 922 | # in order to execute the DEL command is very small and comparable to most other 923 | # O(1) or O(log_N) commands in Redis. However if the key is associated with an 924 | # aggregated value containing millions of elements, the server can block for 925 | # a long time (even seconds) in order to complete the operation. 926 | # 927 | # For the above reasons Redis also offers non blocking deletion primitives 928 | # such as UNLINK (non blocking DEL) and the ASYNC option of FLUSHALL and 929 | # FLUSHDB commands, in order to reclaim memory in background. Those commands 930 | # are executed in constant time. Another thread will incrementally free the 931 | # object in the background as fast as possible. 932 | # 933 | # DEL, UNLINK and ASYNC option of FLUSHALL and FLUSHDB are user-controlled. 934 | # It's up to the design of the application to understand when it is a good 935 | # idea to use one or the other. However the Redis server sometimes has to 936 | # delete keys or flush the whole database as a side effect of other operations. 937 | # Specifically Redis deletes objects independently of a user call in the 938 | # following scenarios: 939 | # 940 | # 1) On eviction, because of the maxmemory and maxmemory policy configurations, 941 | # in order to make room for new data, without going over the specified 942 | # memory limit. 943 | # 2) Because of expire: when a key with an associated time to live (see the 944 | # EXPIRE command) must be deleted from memory. 945 | # 3) Because of a side effect of a command that stores data on a key that may 946 | # already exist. For example the RENAME command may delete the old key 947 | # content when it is replaced with another one. Similarly SUNIONSTORE 948 | # or SORT with STORE option may delete existing keys. The SET command 949 | # itself removes any old content of the specified key in order to replace 950 | # it with the specified string. 951 | # 4) During replication, when a replica performs a full resynchronization with 952 | # its master, the content of the whole database is removed in order to 953 | # load the RDB file just transferred. 954 | # 955 | # In all the above cases the default is to delete objects in a blocking way, 956 | # like if DEL was called. However you can configure each case specifically 957 | # in order to instead release memory in a non-blocking way like if UNLINK 958 | # was called, using the following configuration directives. 959 | 960 | lazyfree-lazy-eviction no 961 | lazyfree-lazy-expire no 962 | lazyfree-lazy-server-del no 963 | replica-lazy-flush no 964 | 965 | # It is also possible, for the case when to replace the user code DEL calls 966 | # with UNLINK calls is not easy, to modify the default behavior of the DEL 967 | # command to act exactly like UNLINK, using the following configuration 968 | # directive: 969 | 970 | lazyfree-lazy-user-del no 971 | 972 | ################################ THREADED I/O ################################# 973 | 974 | # Redis is mostly single threaded, however there are certain threaded 975 | # operations such as UNLINK, slow I/O accesses and other things that are 976 | # performed on side threads. 977 | # 978 | # Now it is also possible to handle Redis clients socket reads and writes 979 | # in different I/O threads. Since especially writing is so slow, normally 980 | # Redis users use pipelining in order to speedup the Redis performances per 981 | # core, and spawn multiple instances in order to scale more. Using I/O 982 | # threads it is possible to easily speedup two times Redis without resorting 983 | # to pipelining nor sharding of the instance. 984 | # 985 | # By default threading is disabled, we suggest enabling it only in machines 986 | # that have at least 4 or more cores, leaving at least one spare core. 987 | # Using more than 8 threads is unlikely to help much. We also recommend using 988 | # threaded I/O only if you actually have performance problems, with Redis 989 | # instances being able to use a quite big percentage of CPU time, otherwise 990 | # there is no point in using this feature. 991 | # 992 | # So for instance if you have a four cores boxes, try to use 2 or 3 I/O 993 | # threads, if you have a 8 cores, try to use 6 threads. In order to 994 | # enable I/O threads use the following configuration directive: 995 | # 996 | # io-threads 4 997 | # 998 | # Setting io-threads to 1 will just use the main thread as usually. 999 | # When I/O threads are enabled, we only use threads for writes, that is 1000 | # to thread the write(2) syscall and transfer the client buffers to the 1001 | # socket. However it is also possible to enable threading of reads and 1002 | # protocol parsing using the following configuration directive, by setting 1003 | # it to yes: 1004 | # 1005 | # io-threads-do-reads no 1006 | # 1007 | # Usually threading reads doesn't help much. 1008 | # 1009 | # NOTE 1: This configuration directive cannot be changed at runtime via 1010 | # CONFIG SET. Aso this feature currently does not work when SSL is 1011 | # enabled. 1012 | # 1013 | # NOTE 2: If you want to test the Redis speedup using redis-benchmark, make 1014 | # sure you also run the benchmark itself in threaded mode, using the 1015 | # --threads option to match the number of Redis theads, otherwise you'll not 1016 | # be able to notice the improvements. 1017 | 1018 | ############################## APPEND ONLY MODE ############################### 1019 | 1020 | # By default Redis asynchronously dumps the dataset on disk. This mode is 1021 | # good enough in many applications, but an issue with the Redis process or 1022 | # a power outage may result into a few minutes of writes lost (depending on 1023 | # the configured save points). 1024 | # 1025 | # The Append Only File is an alternative persistence mode that provides 1026 | # much better durability. For instance using the default data fsync policy 1027 | # (see later in the config file) Redis can lose just one second of writes in a 1028 | # dramatic event like a server power outage, or a single write if something 1029 | # wrong with the Redis process itself happens, but the operating system is 1030 | # still running correctly. 1031 | # 1032 | # AOF and RDB persistence can be enabled at the same time without problems. 1033 | # If the AOF is enabled on startup Redis will load the AOF, that is the file 1034 | # with the better durability guarantees. 1035 | # 1036 | # Please check http://redis.io/topics/persistence for more information. 1037 | 1038 | appendonly no 1039 | 1040 | # The name of the append only file (default: "appendonly.aof") 1041 | 1042 | appendfilename "appendonly.aof" 1043 | 1044 | # The fsync() call tells the Operating System to actually write data on disk 1045 | # instead of waiting for more data in the output buffer. Some OS will really flush 1046 | # data on disk, some other OS will just try to do it ASAP. 1047 | # 1048 | # Redis supports three different modes: 1049 | # 1050 | # no: don't fsync, just let the OS flush the data when it wants. Faster. 1051 | # always: fsync after every write to the append only log. Slow, Safest. 1052 | # everysec: fsync only one time every second. Compromise. 1053 | # 1054 | # The default is "everysec", as that's usually the right compromise between 1055 | # speed and data safety. It's up to you to understand if you can relax this to 1056 | # "no" that will let the operating system flush the output buffer when 1057 | # it wants, for better performances (but if you can live with the idea of 1058 | # some data loss consider the default persistence mode that's snapshotting), 1059 | # or on the contrary, use "always" that's very slow but a bit safer than 1060 | # everysec. 1061 | # 1062 | # More details please check the following article: 1063 | # http://antirez.com/post/redis-persistence-demystified.html 1064 | # 1065 | # If unsure, use "everysec". 1066 | 1067 | # appendfsync always 1068 | appendfsync everysec 1069 | # appendfsync no 1070 | 1071 | # When the AOF fsync policy is set to always or everysec, and a background 1072 | # saving process (a background save or AOF log background rewriting) is 1073 | # performing a lot of I/O against the disk, in some Linux configurations 1074 | # Redis may block too long on the fsync() call. Note that there is no fix for 1075 | # this currently, as even performing fsync in a different thread will block 1076 | # our synchronous write(2) call. 1077 | # 1078 | # In order to mitigate this problem it's possible to use the following option 1079 | # that will prevent fsync() from being called in the main process while a 1080 | # BGSAVE or BGREWRITEAOF is in progress. 1081 | # 1082 | # This means that while another child is saving, the durability of Redis is 1083 | # the same as "appendfsync none". In practical terms, this means that it is 1084 | # possible to lose up to 30 seconds of log in the worst scenario (with the 1085 | # default Linux settings). 1086 | # 1087 | # If you have latency problems turn this to "yes". Otherwise leave it as 1088 | # "no" that is the safest pick from the point of view of durability. 1089 | 1090 | no-appendfsync-on-rewrite no 1091 | 1092 | # Automatic rewrite of the append only file. 1093 | # Redis is able to automatically rewrite the log file implicitly calling 1094 | # BGREWRITEAOF when the AOF log size grows by the specified percentage. 1095 | # 1096 | # This is how it works: Redis remembers the size of the AOF file after the 1097 | # latest rewrite (if no rewrite has happened since the restart, the size of 1098 | # the AOF at startup is used). 1099 | # 1100 | # This base size is compared to the current size. If the current size is 1101 | # bigger than the specified percentage, the rewrite is triggered. Also 1102 | # you need to specify a minimal size for the AOF file to be rewritten, this 1103 | # is useful to avoid rewriting the AOF file even if the percentage increase 1104 | # is reached but it is still pretty small. 1105 | # 1106 | # Specify a percentage of zero in order to disable the automatic AOF 1107 | # rewrite feature. 1108 | 1109 | auto-aof-rewrite-percentage 100 1110 | auto-aof-rewrite-min-size 64mb 1111 | 1112 | # An AOF file may be found to be truncated at the end during the Redis 1113 | # startup process, when the AOF data gets loaded back into memory. 1114 | # This may happen when the system where Redis is running 1115 | # crashes, especially when an ext4 filesystem is mounted without the 1116 | # data=ordered option (however this can't happen when Redis itself 1117 | # crashes or aborts but the operating system still works correctly). 1118 | # 1119 | # Redis can either exit with an error when this happens, or load as much 1120 | # data as possible (the default now) and start if the AOF file is found 1121 | # to be truncated at the end. The following option controls this behavior. 1122 | # 1123 | # If aof-load-truncated is set to yes, a truncated AOF file is loaded and 1124 | # the Redis server starts emitting a log to inform the user of the event. 1125 | # Otherwise if the option is set to no, the server aborts with an error 1126 | # and refuses to start. When the option is set to no, the user requires 1127 | # to fix the AOF file using the "redis-check-aof" utility before to restart 1128 | # the server. 1129 | # 1130 | # Note that if the AOF file will be found to be corrupted in the middle 1131 | # the server will still exit with an error. This option only applies when 1132 | # Redis will try to read more data from the AOF file but not enough bytes 1133 | # will be found. 1134 | aof-load-truncated yes 1135 | 1136 | # When rewriting the AOF file, Redis is able to use an RDB preamble in the 1137 | # AOF file for faster rewrites and recoveries. When this option is turned 1138 | # on the rewritten AOF file is composed of two different stanzas: 1139 | # 1140 | # [RDB file][AOF tail] 1141 | # 1142 | # When loading Redis recognizes that the AOF file starts with the "REDIS" 1143 | # string and loads the prefixed RDB file, and continues loading the AOF 1144 | # tail. 1145 | aof-use-rdb-preamble yes 1146 | 1147 | ################################ LUA SCRIPTING ############################### 1148 | 1149 | # Max execution time of a Lua script in milliseconds. 1150 | # 1151 | # If the maximum execution time is reached Redis will log that a script is 1152 | # still in execution after the maximum allowed time and will start to 1153 | # reply to queries with an error. 1154 | # 1155 | # When a long running script exceeds the maximum execution time only the 1156 | # SCRIPT KILL and SHUTDOWN NOSAVE commands are available. The first can be 1157 | # used to stop a script that did not yet called write commands. The second 1158 | # is the only way to shut down the server in the case a write command was 1159 | # already issued by the script but the user doesn't want to wait for the natural 1160 | # termination of the script. 1161 | # 1162 | # Set it to 0 or a negative value for unlimited execution without warnings. 1163 | lua-time-limit 5000 1164 | 1165 | ################################ REDIS CLUSTER ############################### 1166 | 1167 | # Normal Redis instances can't be part of a Redis Cluster; only nodes that are 1168 | # started as cluster nodes can. In order to start a Redis instance as a 1169 | # cluster node enable the cluster support uncommenting the following: 1170 | # 1171 | # cluster-enabled yes 1172 | 1173 | # Every cluster node has a cluster configuration file. This file is not 1174 | # intended to be edited by hand. It is created and updated by Redis nodes. 1175 | # Every Redis Cluster node requires a different cluster configuration file. 1176 | # Make sure that instances running in the same system do not have 1177 | # overlapping cluster configuration file names. 1178 | # 1179 | # cluster-config-file nodes-6379.conf 1180 | 1181 | # Cluster node timeout is the amount of milliseconds a node must be unreachable 1182 | # for it to be considered in failure state. 1183 | # Most other internal time limits are multiple of the node timeout. 1184 | # 1185 | # cluster-node-timeout 15000 1186 | 1187 | # A replica of a failing master will avoid to start a failover if its data 1188 | # looks too old. 1189 | # 1190 | # There is no simple way for a replica to actually have an exact measure of 1191 | # its "data age", so the following two checks are performed: 1192 | # 1193 | # 1) If there are multiple replicas able to failover, they exchange messages 1194 | # in order to try to give an advantage to the replica with the best 1195 | # replication offset (more data from the master processed). 1196 | # Replicas will try to get their rank by offset, and apply to the start 1197 | # of the failover a delay proportional to their rank. 1198 | # 1199 | # 2) Every single replica computes the time of the last interaction with 1200 | # its master. This can be the last ping or command received (if the master 1201 | # is still in the "connected" state), or the time that elapsed since the 1202 | # disconnection with the master (if the replication link is currently down). 1203 | # If the last interaction is too old, the replica will not try to failover 1204 | # at all. 1205 | # 1206 | # The point "2" can be tuned by user. Specifically a replica will not perform 1207 | # the failover if, since the last interaction with the master, the time 1208 | # elapsed is greater than: 1209 | # 1210 | # (node-timeout * replica-validity-factor) + repl-ping-replica-period 1211 | # 1212 | # So for example if node-timeout is 30 seconds, and the replica-validity-factor 1213 | # is 10, and assuming a default repl-ping-replica-period of 10 seconds, the 1214 | # replica will not try to failover if it was not able to talk with the master 1215 | # for longer than 310 seconds. 1216 | # 1217 | # A large replica-validity-factor may allow replicas with too old data to failover 1218 | # a master, while a too small value may prevent the cluster from being able to 1219 | # elect a replica at all. 1220 | # 1221 | # For maximum availability, it is possible to set the replica-validity-factor 1222 | # to a value of 0, which means, that replicas will always try to failover the 1223 | # master regardless of the last time they interacted with the master. 1224 | # (However they'll always try to apply a delay proportional to their 1225 | # offset rank). 1226 | # 1227 | # Zero is the only value able to guarantee that when all the partitions heal 1228 | # the cluster will always be able to continue. 1229 | # 1230 | # cluster-replica-validity-factor 10 1231 | 1232 | # Cluster replicas are able to migrate to orphaned masters, that are masters 1233 | # that are left without working replicas. This improves the cluster ability 1234 | # to resist to failures as otherwise an orphaned master can't be failed over 1235 | # in case of failure if it has no working replicas. 1236 | # 1237 | # Replicas migrate to orphaned masters only if there are still at least a 1238 | # given number of other working replicas for their old master. This number 1239 | # is the "migration barrier". A migration barrier of 1 means that a replica 1240 | # will migrate only if there is at least 1 other working replica for its master 1241 | # and so forth. It usually reflects the number of replicas you want for every 1242 | # master in your cluster. 1243 | # 1244 | # Default is 1 (replicas migrate only if their masters remain with at least 1245 | # one replica). To disable migration just set it to a very large value. 1246 | # A value of 0 can be set but is useful only for debugging and dangerous 1247 | # in production. 1248 | # 1249 | # cluster-migration-barrier 1 1250 | 1251 | # By default Redis Cluster nodes stop accepting queries if they detect there 1252 | # is at least an hash slot uncovered (no available node is serving it). 1253 | # This way if the cluster is partially down (for example a range of hash slots 1254 | # are no longer covered) all the cluster becomes, eventually, unavailable. 1255 | # It automatically returns available as soon as all the slots are covered again. 1256 | # 1257 | # However sometimes you want the subset of the cluster which is working, 1258 | # to continue to accept queries for the part of the key space that is still 1259 | # covered. In order to do so, just set the cluster-require-full-coverage 1260 | # option to no. 1261 | # 1262 | # cluster-require-full-coverage yes 1263 | 1264 | # This option, when set to yes, prevents replicas from trying to failover its 1265 | # master during master failures. However the master can still perform a 1266 | # manual failover, if forced to do so. 1267 | # 1268 | # This is useful in different scenarios, especially in the case of multiple 1269 | # data center operations, where we want one side to never be promoted if not 1270 | # in the case of a total DC failure. 1271 | # 1272 | # cluster-replica-no-failover no 1273 | 1274 | # This option, when set to yes, allows nodes to serve read traffic while the 1275 | # the cluster is in a down state, as long as it believes it owns the slots. 1276 | # 1277 | # This is useful for two cases. The first case is for when an application 1278 | # doesn't require consistency of data during node failures or network partitions. 1279 | # One example of this is a cache, where as long as the node has the data it 1280 | # should be able to serve it. 1281 | # 1282 | # The second use case is for configurations that don't meet the recommended 1283 | # three shards but want to enable cluster mode and scale later. A 1284 | # master outage in a 1 or 2 shard configuration causes a read/write outage to the 1285 | # entire cluster without this option set, with it set there is only a write outage. 1286 | # Without a quorum of masters, slot ownership will not change automatically. 1287 | # 1288 | # cluster-allow-reads-when-down no 1289 | 1290 | # In order to setup your cluster make sure to read the documentation 1291 | # available at http://redis.io web site. 1292 | 1293 | ########################## CLUSTER DOCKER/NAT support ######################## 1294 | 1295 | # In certain deployments, Redis Cluster nodes address discovery fails, because 1296 | # addresses are NAT-ted or because ports are forwarded (the typical case is 1297 | # Docker and other containers). 1298 | # 1299 | # In order to make Redis Cluster working in such environments, a static 1300 | # configuration where each node knows its public address is needed. The 1301 | # following two options are used for this scope, and are: 1302 | # 1303 | # * cluster-announce-ip 1304 | # * cluster-announce-port 1305 | # * cluster-announce-bus-port 1306 | # 1307 | # Each instruct the node about its address, client port, and cluster message 1308 | # bus port. The information is then published in the header of the bus packets 1309 | # so that other nodes will be able to correctly map the address of the node 1310 | # publishing the information. 1311 | # 1312 | # If the above options are not used, the normal Redis Cluster auto-detection 1313 | # will be used instead. 1314 | # 1315 | # Note that when remapped, the bus port may not be at the fixed offset of 1316 | # clients port + 10000, so you can specify any port and bus-port depending 1317 | # on how they get remapped. If the bus-port is not set, a fixed offset of 1318 | # 10000 will be used as usually. 1319 | # 1320 | # Example: 1321 | # 1322 | # cluster-announce-ip 10.1.1.5 1323 | # cluster-announce-port 6379 1324 | # cluster-announce-bus-port 6380 1325 | 1326 | ################################## SLOW LOG ################################### 1327 | 1328 | # The Redis Slow Log is a system to log queries that exceeded a specified 1329 | # execution time. The execution time does not include the I/O operations 1330 | # like talking with the client, sending the reply and so forth, 1331 | # but just the time needed to actually execute the command (this is the only 1332 | # stage of command execution where the thread is blocked and can not serve 1333 | # other requests in the meantime). 1334 | # 1335 | # You can configure the slow log with two parameters: one tells Redis 1336 | # what is the execution time, in microseconds, to exceed in order for the 1337 | # command to get logged, and the other parameter is the length of the 1338 | # slow log. When a new command is logged the oldest one is removed from the 1339 | # queue of logged commands. 1340 | 1341 | # The following time is expressed in microseconds, so 1000000 is equivalent 1342 | # to one second. Note that a negative number disables the slow log, while 1343 | # a value of zero forces the logging of every command. 1344 | slowlog-log-slower-than 10000 1345 | 1346 | # There is no limit to this length. Just be aware that it will consume memory. 1347 | # You can reclaim memory used by the slow log with SLOWLOG RESET. 1348 | slowlog-max-len 128 1349 | 1350 | ################################ LATENCY MONITOR ############################## 1351 | 1352 | # The Redis latency monitoring subsystem samples different operations 1353 | # at runtime in order to collect data related to possible sources of 1354 | # latency of a Redis instance. 1355 | # 1356 | # Via the LATENCY command this information is available to the user that can 1357 | # print graphs and obtain reports. 1358 | # 1359 | # The system only logs operations that were performed in a time equal or 1360 | # greater than the amount of milliseconds specified via the 1361 | # latency-monitor-threshold configuration directive. When its value is set 1362 | # to zero, the latency monitor is turned off. 1363 | # 1364 | # By default latency monitoring is disabled since it is mostly not needed 1365 | # if you don't have latency issues, and collecting data has a performance 1366 | # impact, that while very small, can be measured under big load. Latency 1367 | # monitoring can easily be enabled at runtime using the command 1368 | # "CONFIG SET latency-monitor-threshold " if needed. 1369 | latency-monitor-threshold 0 1370 | 1371 | ############################# EVENT NOTIFICATION ############################## 1372 | 1373 | # Redis can notify Pub/Sub clients about events happening in the key space. 1374 | # This feature is documented at http://redis.io/topics/notifications 1375 | # 1376 | # For instance if keyspace events notification is enabled, and a client 1377 | # performs a DEL operation on key "foo" stored in the Database 0, two 1378 | # messages will be published via Pub/Sub: 1379 | # 1380 | # PUBLISH __keyspace@0__:foo del 1381 | # PUBLISH __keyevent@0__:del foo 1382 | # 1383 | # It is possible to select the events that Redis will notify among a set 1384 | # of classes. Every class is identified by a single character: 1385 | # 1386 | # K Keyspace events, published with __keyspace@__ prefix. 1387 | # E Keyevent events, published with __keyevent@__ prefix. 1388 | # g Generic commands (non-type specific) like DEL, EXPIRE, RENAME, ... 1389 | # $ String commands 1390 | # l List commands 1391 | # s Set commands 1392 | # h Hash commands 1393 | # z Sorted set commands 1394 | # x Expired events (events generated every time a key expires) 1395 | # e Evicted events (events generated when a key is evicted for maxmemory) 1396 | # t Stream commands 1397 | # m Key-miss events (Note: It is not included in the 'A' class) 1398 | # A Alias for g$lshzxet, so that the "AKE" string means all the events 1399 | # (Except key-miss events which are excluded from 'A' due to their 1400 | # unique nature). 1401 | # 1402 | # The "notify-keyspace-events" takes as argument a string that is composed 1403 | # of zero or multiple characters. The empty string means that notifications 1404 | # are disabled. 1405 | # 1406 | # Example: to enable list and generic events, from the point of view of the 1407 | # event name, use: 1408 | # 1409 | # notify-keyspace-events Elg 1410 | # 1411 | # Example 2: to get the stream of the expired keys subscribing to channel 1412 | # name __keyevent@0__:expired use: 1413 | # 1414 | # notify-keyspace-events Ex 1415 | # 1416 | # By default all notifications are disabled because most users don't need 1417 | # this feature and the feature has some overhead. Note that if you don't 1418 | # specify at least one of K or E, no events will be delivered. 1419 | notify-keyspace-events "" 1420 | 1421 | ############################### GOPHER SERVER ################################# 1422 | 1423 | # Redis contains an implementation of the Gopher protocol, as specified in 1424 | # the RFC 1436 (https://www.ietf.org/rfc/rfc1436.txt). 1425 | # 1426 | # The Gopher protocol was very popular in the late '90s. It is an alternative 1427 | # to the web, and the implementation both server and client side is so simple 1428 | # that the Redis server has just 100 lines of code in order to implement this 1429 | # support. 1430 | # 1431 | # What do you do with Gopher nowadays? Well Gopher never *really* died, and 1432 | # lately there is a movement in order for the Gopher more hierarchical content 1433 | # composed of just plain text documents to be resurrected. Some want a simpler 1434 | # internet, others believe that the mainstream internet became too much 1435 | # controlled, and it's cool to create an alternative space for people that 1436 | # want a bit of fresh air. 1437 | # 1438 | # Anyway for the 10nth birthday of the Redis, we gave it the Gopher protocol 1439 | # as a gift. 1440 | # 1441 | # --- HOW IT WORKS? --- 1442 | # 1443 | # The Redis Gopher support uses the inline protocol of Redis, and specifically 1444 | # two kind of inline requests that were anyway illegal: an empty request 1445 | # or any request that starts with "/" (there are no Redis commands starting 1446 | # with such a slash). Normal RESP2/RESP3 requests are completely out of the 1447 | # path of the Gopher protocol implementation and are served as usually as well. 1448 | # 1449 | # If you open a connection to Redis when Gopher is enabled and send it 1450 | # a string like "/foo", if there is a key named "/foo" it is served via the 1451 | # Gopher protocol. 1452 | # 1453 | # In order to create a real Gopher "hole" (the name of a Gopher site in Gopher 1454 | # talking), you likely need a script like the following: 1455 | # 1456 | # https://github.com/antirez/gopher2redis 1457 | # 1458 | # --- SECURITY WARNING --- 1459 | # 1460 | # If you plan to put Redis on the internet in a publicly accessible address 1461 | # to server Gopher pages MAKE SURE TO SET A PASSWORD to the instance. 1462 | # Once a password is set: 1463 | # 1464 | # 1. The Gopher server (when enabled, not by default) will still serve 1465 | # content via Gopher. 1466 | # 2. However other commands cannot be called before the client will 1467 | # authenticate. 1468 | # 1469 | # So use the 'requirepass' option to protect your instance. 1470 | # 1471 | # To enable Gopher support uncomment the following line and set 1472 | # the option from no (the default) to yes. 1473 | # 1474 | # gopher-enabled no 1475 | 1476 | ############################### ADVANCED CONFIG ############################### 1477 | 1478 | # Hashes are encoded using a memory efficient data structure when they have a 1479 | # small number of entries, and the biggest entry does not exceed a given 1480 | # threshold. These thresholds can be configured using the following directives. 1481 | hash-max-ziplist-entries 512 1482 | hash-max-ziplist-value 64 1483 | 1484 | # Lists are also encoded in a special way to save a lot of space. 1485 | # The number of entries allowed per internal list node can be specified 1486 | # as a fixed maximum size or a maximum number of elements. 1487 | # For a fixed maximum size, use -5 through -1, meaning: 1488 | # -5: max size: 64 Kb <-- not recommended for normal workloads 1489 | # -4: max size: 32 Kb <-- not recommended 1490 | # -3: max size: 16 Kb <-- probably not recommended 1491 | # -2: max size: 8 Kb <-- good 1492 | # -1: max size: 4 Kb <-- good 1493 | # Positive numbers mean store up to _exactly_ that number of elements 1494 | # per list node. 1495 | # The highest performing option is usually -2 (8 Kb size) or -1 (4 Kb size), 1496 | # but if your use case is unique, adjust the settings as necessary. 1497 | list-max-ziplist-size -2 1498 | 1499 | # Lists may also be compressed. 1500 | # Compress depth is the number of quicklist ziplist nodes from *each* side of 1501 | # the list to *exclude* from compression. The head and tail of the list 1502 | # are always uncompressed for fast push/pop operations. Settings are: 1503 | # 0: disable all list compression 1504 | # 1: depth 1 means "don't start compressing until after 1 node into the list, 1505 | # going from either the head or tail" 1506 | # So: [head]->node->node->...->node->[tail] 1507 | # [head], [tail] will always be uncompressed; inner nodes will compress. 1508 | # 2: [head]->[next]->node->node->...->node->[prev]->[tail] 1509 | # 2 here means: don't compress head or head->next or tail->prev or tail, 1510 | # but compress all nodes between them. 1511 | # 3: [head]->[next]->[next]->node->node->...->node->[prev]->[prev]->[tail] 1512 | # etc. 1513 | list-compress-depth 0 1514 | 1515 | # Sets have a special encoding in just one case: when a set is composed 1516 | # of just strings that happen to be integers in radix 10 in the range 1517 | # of 64 bit signed integers. 1518 | # The following configuration setting sets the limit in the size of the 1519 | # set in order to use this special memory saving encoding. 1520 | set-max-intset-entries 512 1521 | 1522 | # Similarly to hashes and lists, sorted sets are also specially encoded in 1523 | # order to save a lot of space. This encoding is only used when the length and 1524 | # elements of a sorted set are below the following limits: 1525 | zset-max-ziplist-entries 128 1526 | zset-max-ziplist-value 64 1527 | 1528 | # HyperLogLog sparse representation bytes limit. The limit includes the 1529 | # 16 bytes header. When an HyperLogLog using the sparse representation crosses 1530 | # this limit, it is converted into the dense representation. 1531 | # 1532 | # A value greater than 16000 is totally useless, since at that point the 1533 | # dense representation is more memory efficient. 1534 | # 1535 | # The suggested value is ~ 3000 in order to have the benefits of 1536 | # the space efficient encoding without slowing down too much PFADD, 1537 | # which is O(N) with the sparse encoding. The value can be raised to 1538 | # ~ 10000 when CPU is not a concern, but space is, and the data set is 1539 | # composed of many HyperLogLogs with cardinality in the 0 - 15000 range. 1540 | hll-sparse-max-bytes 3000 1541 | 1542 | # Streams macro node max size / items. The stream data structure is a radix 1543 | # tree of big nodes that encode multiple items inside. Using this configuration 1544 | # it is possible to configure how big a single node can be in bytes, and the 1545 | # maximum number of items it may contain before switching to a new node when 1546 | # appending new stream entries. If any of the following settings are set to 1547 | # zero, the limit is ignored, so for instance it is possible to set just a 1548 | # max entires limit by setting max-bytes to 0 and max-entries to the desired 1549 | # value. 1550 | stream-node-max-bytes 4096 1551 | stream-node-max-entries 100 1552 | 1553 | # Active rehashing uses 1 millisecond every 100 milliseconds of CPU time in 1554 | # order to help rehashing the main Redis hash table (the one mapping top-level 1555 | # keys to values). The hash table implementation Redis uses (see dict.c) 1556 | # performs a lazy rehashing: the more operation you run into a hash table 1557 | # that is rehashing, the more rehashing "steps" are performed, so if the 1558 | # server is idle the rehashing is never complete and some more memory is used 1559 | # by the hash table. 1560 | # 1561 | # The default is to use this millisecond 10 times every second in order to 1562 | # actively rehash the main dictionaries, freeing memory when possible. 1563 | # 1564 | # If unsure: 1565 | # use "activerehashing no" if you have hard latency requirements and it is 1566 | # not a good thing in your environment that Redis can reply from time to time 1567 | # to queries with 2 milliseconds delay. 1568 | # 1569 | # use "activerehashing yes" if you don't have such hard requirements but 1570 | # want to free memory asap when possible. 1571 | activerehashing yes 1572 | 1573 | # The client output buffer limits can be used to force disconnection of clients 1574 | # that are not reading data from the server fast enough for some reason (a 1575 | # common reason is that a Pub/Sub client can't consume messages as fast as the 1576 | # publisher can produce them). 1577 | # 1578 | # The limit can be set differently for the three different classes of clients: 1579 | # 1580 | # normal -> normal clients including MONITOR clients 1581 | # replica -> replica clients 1582 | # pubsub -> clients subscribed to at least one pubsub channel or pattern 1583 | # 1584 | # The syntax of every client-output-buffer-limit directive is the following: 1585 | # 1586 | # client-output-buffer-limit 1587 | # 1588 | # A client is immediately disconnected once the hard limit is reached, or if 1589 | # the soft limit is reached and remains reached for the specified number of 1590 | # seconds (continuously). 1591 | # So for instance if the hard limit is 32 megabytes and the soft limit is 1592 | # 16 megabytes / 10 seconds, the client will get disconnected immediately 1593 | # if the size of the output buffers reach 32 megabytes, but will also get 1594 | # disconnected if the client reaches 16 megabytes and continuously overcomes 1595 | # the limit for 10 seconds. 1596 | # 1597 | # By default normal clients are not limited because they don't receive data 1598 | # without asking (in a push way), but just after a request, so only 1599 | # asynchronous clients may create a scenario where data is requested faster 1600 | # than it can read. 1601 | # 1602 | # Instead there is a default limit for pubsub and replica clients, since 1603 | # subscribers and replicas receive data in a push fashion. 1604 | # 1605 | # Both the hard or the soft limit can be disabled by setting them to zero. 1606 | client-output-buffer-limit normal 0 0 0 1607 | client-output-buffer-limit replica 256mb 64mb 60 1608 | client-output-buffer-limit pubsub 32mb 8mb 60 1609 | 1610 | # Client query buffers accumulate new commands. They are limited to a fixed 1611 | # amount by default in order to avoid that a protocol desynchronization (for 1612 | # instance due to a bug in the client) will lead to unbound memory usage in 1613 | # the query buffer. However you can configure it here if you have very special 1614 | # needs, such us huge multi/exec requests or alike. 1615 | # 1616 | # client-query-buffer-limit 1gb 1617 | 1618 | # In the Redis protocol, bulk requests, that are, elements representing single 1619 | # strings, are normally limited ot 512 mb. However you can change this limit 1620 | # here. 1621 | # 1622 | # proto-max-bulk-len 512mb 1623 | 1624 | # Redis calls an internal function to perform many background tasks, like 1625 | # closing connections of clients in timeout, purging expired keys that are 1626 | # never requested, and so forth. 1627 | # 1628 | # Not all tasks are performed with the same frequency, but Redis checks for 1629 | # tasks to perform according to the specified "hz" value. 1630 | # 1631 | # By default "hz" is set to 10. Raising the value will use more CPU when 1632 | # Redis is idle, but at the same time will make Redis more responsive when 1633 | # there are many keys expiring at the same time, and timeouts may be 1634 | # handled with more precision. 1635 | # 1636 | # The range is between 1 and 500, however a value over 100 is usually not 1637 | # a good idea. Most users should use the default of 10 and raise this up to 1638 | # 100 only in environments where very low latency is required. 1639 | hz 10 1640 | 1641 | # Normally it is useful to have an HZ value which is proportional to the 1642 | # number of clients connected. This is useful in order, for instance, to 1643 | # avoid too many clients are processed for each background task invocation 1644 | # in order to avoid latency spikes. 1645 | # 1646 | # Since the default HZ value by default is conservatively set to 10, Redis 1647 | # offers, and enables by default, the ability to use an adaptive HZ value 1648 | # which will temporary raise when there are many connected clients. 1649 | # 1650 | # When dynamic HZ is enabled, the actual configured HZ will be used 1651 | # as a baseline, but multiples of the configured HZ value will be actually 1652 | # used as needed once more clients are connected. In this way an idle 1653 | # instance will use very little CPU time while a busy instance will be 1654 | # more responsive. 1655 | dynamic-hz yes 1656 | 1657 | # When a child rewrites the AOF file, if the following option is enabled 1658 | # the file will be fsync-ed every 32 MB of data generated. This is useful 1659 | # in order to commit the file to the disk more incrementally and avoid 1660 | # big latency spikes. 1661 | aof-rewrite-incremental-fsync yes 1662 | 1663 | # When redis saves RDB file, if the following option is enabled 1664 | # the file will be fsync-ed every 32 MB of data generated. This is useful 1665 | # in order to commit the file to the disk more incrementally and avoid 1666 | # big latency spikes. 1667 | rdb-save-incremental-fsync yes 1668 | 1669 | # Redis LFU eviction (see maxmemory setting) can be tuned. However it is a good 1670 | # idea to start with the default settings and only change them after investigating 1671 | # how to improve the performances and how the keys LFU change over time, which 1672 | # is possible to inspect via the OBJECT FREQ command. 1673 | # 1674 | # There are two tunable parameters in the Redis LFU implementation: the 1675 | # counter logarithm factor and the counter decay time. It is important to 1676 | # understand what the two parameters mean before changing them. 1677 | # 1678 | # The LFU counter is just 8 bits per key, it's maximum value is 255, so Redis 1679 | # uses a probabilistic increment with logarithmic behavior. Given the value 1680 | # of the old counter, when a key is accessed, the counter is incremented in 1681 | # this way: 1682 | # 1683 | # 1. A random number R between 0 and 1 is extracted. 1684 | # 2. A probability P is calculated as 1/(old_value*lfu_log_factor+1). 1685 | # 3. The counter is incremented only if R < P. 1686 | # 1687 | # The default lfu-log-factor is 10. This is a table of how the frequency 1688 | # counter changes with a different number of accesses with different 1689 | # logarithmic factors: 1690 | # 1691 | # +--------+------------+------------+------------+------------+------------+ 1692 | # | factor | 100 hits | 1000 hits | 100K hits | 1M hits | 10M hits | 1693 | # +--------+------------+------------+------------+------------+------------+ 1694 | # | 0 | 104 | 255 | 255 | 255 | 255 | 1695 | # +--------+------------+------------+------------+------------+------------+ 1696 | # | 1 | 18 | 49 | 255 | 255 | 255 | 1697 | # +--------+------------+------------+------------+------------+------------+ 1698 | # | 10 | 10 | 18 | 142 | 255 | 255 | 1699 | # +--------+------------+------------+------------+------------+------------+ 1700 | # | 100 | 8 | 11 | 49 | 143 | 255 | 1701 | # +--------+------------+------------+------------+------------+------------+ 1702 | # 1703 | # NOTE: The above table was obtained by running the following commands: 1704 | # 1705 | # redis-benchmark -n 1000000 incr foo 1706 | # redis-cli object freq foo 1707 | # 1708 | # NOTE 2: The counter initial value is 5 in order to give new objects a chance 1709 | # to accumulate hits. 1710 | # 1711 | # The counter decay time is the time, in minutes, that must elapse in order 1712 | # for the key counter to be divided by two (or decremented if it has a value 1713 | # less <= 10). 1714 | # 1715 | # The default value for the lfu-decay-time is 1. A Special value of 0 means to 1716 | # decay the counter every time it happens to be scanned. 1717 | # 1718 | # lfu-log-factor 10 1719 | # lfu-decay-time 1 1720 | 1721 | ########################### ACTIVE DEFRAGMENTATION ####################### 1722 | # 1723 | # What is active defragmentation? 1724 | # ------------------------------- 1725 | # 1726 | # Active (online) defragmentation allows a Redis server to compact the 1727 | # spaces left between small allocations and deallocations of data in memory, 1728 | # thus allowing to reclaim back memory. 1729 | # 1730 | # Fragmentation is a natural process that happens with every allocator (but 1731 | # less so with Jemalloc, fortunately) and certain workloads. Normally a server 1732 | # restart is needed in order to lower the fragmentation, or at least to flush 1733 | # away all the data and create it again. However thanks to this feature 1734 | # implemented by Oran Agra for Redis 4.0 this process can happen at runtime 1735 | # in an "hot" way, while the server is running. 1736 | # 1737 | # Basically when the fragmentation is over a certain level (see the 1738 | # configuration options below) Redis will start to create new copies of the 1739 | # values in contiguous memory regions by exploiting certain specific Jemalloc 1740 | # features (in order to understand if an allocation is causing fragmentation 1741 | # and to allocate it in a better place), and at the same time, will release the 1742 | # old copies of the data. This process, repeated incrementally for all the keys 1743 | # will cause the fragmentation to drop back to normal values. 1744 | # 1745 | # Important things to understand: 1746 | # 1747 | # 1. This feature is disabled by default, and only works if you compiled Redis 1748 | # to use the copy of Jemalloc we ship with the source code of Redis. 1749 | # This is the default with Linux builds. 1750 | # 1751 | # 2. You never need to enable this feature if you don't have fragmentation 1752 | # issues. 1753 | # 1754 | # 3. Once you experience fragmentation, you can enable this feature when 1755 | # needed with the command "CONFIG SET activedefrag yes". 1756 | # 1757 | # The configuration parameters are able to fine tune the behavior of the 1758 | # defragmentation process. If you are not sure about what they mean it is 1759 | # a good idea to leave the defaults untouched. 1760 | 1761 | # Enabled active defragmentation 1762 | # activedefrag no 1763 | 1764 | # Minimum amount of fragmentation waste to start active defrag 1765 | # active-defrag-ignore-bytes 100mb 1766 | 1767 | # Minimum percentage of fragmentation to start active defrag 1768 | # active-defrag-threshold-lower 10 1769 | 1770 | # Maximum percentage of fragmentation at which we use maximum effort 1771 | # active-defrag-threshold-upper 100 1772 | 1773 | # Minimal effort for defrag in CPU percentage, to be used when the lower 1774 | # threshold is reached 1775 | # active-defrag-cycle-min 1 1776 | 1777 | # Maximal effort for defrag in CPU percentage, to be used when the upper 1778 | # threshold is reached 1779 | # active-defrag-cycle-max 25 1780 | 1781 | # Maximum number of set/hash/zset/list fields that will be processed from 1782 | # the main dictionary scan 1783 | # active-defrag-max-scan-fields 1000 -------------------------------------------------------------------------------- /redis-with-config/docker-compose.yaml: -------------------------------------------------------------------------------- 1 | version: '3.5' 2 | 3 | services: 4 | redis: 5 | container_name: redis 6 | image: redis:6 7 | command: redis-server /usr/local/etc/redis/redis.conf 8 | ports: 9 | - 6379:6379 10 | volumes: 11 | - ./config/redis.conf:/usr/local/etc/redis/redis.conf -------------------------------------------------------------------------------- /redis-with-security/docker-compose.yaml: -------------------------------------------------------------------------------- 1 | version: '3.5' 2 | 3 | services: 4 | redis: 5 | container_name: redis 6 | image: redis:6 7 | command: redis-server /usr/local/etc/redis/redis.conf 8 | ports: 9 | - 6379:6379 10 | volumes: 11 | - ./config/redis.conf:/usr/local/etc/redis/redis.conf 12 | redis-client: 13 | container_name: redis-client 14 | image: redis:6 15 | -------------------------------------------------------------------------------- /redis/docker-compose.yaml: -------------------------------------------------------------------------------- 1 | version: '3.5' 2 | 3 | services: 4 | redis: 5 | container_name: redis 6 | image: redis:6 7 | ports: 8 | - 6379:6379 --------------------------------------------------------------------------------