- What do Etcd, Consul, and Zookeeper do?
- Service Registration:
- Host, port number, and sometimes authentication credentials, protocols, versions numbers, and/or environment details.
- Service Discovery:
- Ability for client application to query the central registry to learn of service location.
- Consistent and durable general-purpose K/V store across distributed system.
- Some solutions support this better than others.
- Based on Paxos or some derivative (i.e. Raft) algorithm to quickly converge to a consistent state.
- Service Registration:
- Centralized locking can be based on this K/V store.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SET @history_interval = 3; | |
SET @trends_interval = 90; | |
DELETE FROM alerts WHERE (UNIX_TIMESTAMP(NOW()) - clock) > (@history_interval * 24 * 60 * 60); | |
ALTER TABLE alerts ENGINE=INNODB; | |
DELETE FROM acknowledges WHERE (UNIX_TIMESTAMP(NOW()) - clock) > (@history_interval * 24 * 60 * 60); | |
ALTER TABLE acknowledges ENGINE=INNODB; | |
DELETE FROM events WHERE (UNIX_TIMESTAMP(NOW()) - clock) > (@history_interval * 24 * 60 * 60); | |
ALTER TABLE events ENGINE=INNODB; |
Здесь я собираю годное чтиво, которое можно кинуть в случае чего в качестве ответа на какие-либо сложные вопросы
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class DefaultMyStuffMaker implements MyStuffMaker | |
{ | |
private $dependency; | |
public function __construct(SomeDependency $dependency) | |
{ | |
$this->dependency = $dependency; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Use in the "Post-Receive URLs" section of your GitHub repo. | |
if ( $_POST['payload'] ) { | |
shell_exec( 'cd /srv/www/git-repo/ && git reset --hard HEAD && git pull' ); | |
} | |
?>hi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
ignore_user_abort(true); | |
function syscall ($cmd, $cwd) { | |
$descriptorspec = array( | |
1 => array('pipe', 'w'), // stdout is a pipe that the child will write to | |
2 => array('pipe', 'w') // stderr |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo mkdir -m 0700 /var/www/.ssh | |
sudo chown -R apache:apache /var/www/.ssh | |
sudo -u apache ssh-keygen (empty passphrase) | |
paste public key into repo manager | |
(git-repo) sudo -u apache git pull origin branch (this will create /var/www/.ssh/known_hosts) | |
call git_hook.php?branch=xxx |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Sample code for sending MailChimp Email Campaigns from a Rails App using Gibbon API wrapper v0.3.5 | |
# All recipients must already be on the associated MailChimp list (list_id), for this app we add those via another | |
# API call every few minutes. | |
# | |
# Member function of EmailCampaign.rb model | |
# See http://labs.saidigital.co/using-mailchimp-api-to-send-email-campaigns-to-a-dynamic-set-of-email-addresses-425/ | |
# for explanation. | |
def send_campaign(api_key, gb, list_id, template_id, from_name, from_email) | |
self.reset_unique_id | |
segment_id = gb.list_static_segment_add(:id => list_id, :name => self.safe_name) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace common\traits; | |
/** | |
* Soft delete behavior for Yii2 ActiveRecord | |
* | |
* @copyright (c) 2015, Oleg Poludnenko | |
* @license https://opensource.org/licenses/MIT MIT | |
* |