yuyuyu1

举报
yd_219475889 发表于 2024/12/13 18:48:39 2024/12/13
【摘要】 将mongodb-linux-x86_64-4.0.4.tgz复制到chinaskill-sql-1和chinaskill-sql-2[root@chinaskill-sql-1 ~]# tar -zxf mongodb-linux-x86_64-4.0.4.tgz -C /usr/local[root@chinaskill-sql-1 ~]# cd /usr/local[root@chin...
将mongodb-linux-x86_64-4.0.4.tgz复制到chinaskill-sql-1和chinaskill-sql-2
[root@chinaskill-sql-1 ~]# tar -zxf mongodb-linux-x86_64-4.0.4.tgz -C /usr/local
[root@chinaskill-sql-1 ~]# cd /usr/local
[root@chinaskill-sql-1 local]# mv mongodb-linux-x86_64-4.0.4/ mongodb
[root@chinaskill-sql-1 local]# vi /etc/profile
export PATH=$PATH:/usr/local/mongodb/bin
[root@chinaskill-sql-1 local]# source /etc/profile
[root@chinaskill-sql-1 local]# mkdir -p /data/db
[root@chinaskill-sql-1 local]# mongo --version

[root@chinaskill-sql-2 ~]# tar -zxf mongodb-linux-x86_64-4.0.4.tgz -C /usr/local
[root@chinaskill-sql-2 ~]# cd /usr/local
[root@chinaskill-sql-2 local]# mv mongodb-linux-x86_64-4.0.4/ mongodb
[root@chinaskill-sql-2 local]# vi /etc/profile
export PATH=$PATH:/usr/local/mongodb/bin
[root@chinaskill-sql-2 local]# source /etc/profile
[root@chinaskill-sql-2 local]# mkdir -p /data/db
[root@chinaskill-sql-2 local]# mongo --version

[root@chinaskill-sql-1 local]# vi /usr/local/mongodb/mongod.conf
bind_ip=0.0.0.0
replSet=rs
[root@chinaskill-sql-1 local]# mongod -f /usr/local/mongodb/mongod.conf &

[root@chinaskill-sql-2 local]# vi /usr/local/mongodb/mongod.conf
bind_ip=0.0.0.0
replSet=rs
[root@chinaskill-sql-2 local]# mongod -f /usr/local/mongodb/mongod.conf &

[root@chinaskill-sql-1 local]# mongo
> rs.status()
{
        "operationTime" : Timestamp(0, 0),
        "ok" : 0,
        "errmsg" : "no replset config has been received",
        "code" : 94,
        "codeName" : "NotYetInitialized",
        "$clusterTime" : {
                "clusterTime" : Timestamp(0, 0),
                "signature" : {
                        "hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="),
                        "keyId" : NumberLong(0)
                }
        }
}
> var config={_id:"rs",members:[{_id:0,host:"172.16.2.76:27017"},{_id:1,host:"172.16.2.45:27017"}]}
> rs.initiate(config)
……
rs:PRIMARY> rs.status()

bye

[root@chinaskill-node-1 ~]# mkdir /usr/local/nodejs
[root@chinaskill-node-1 ~]# tar -Jxf node-v12.16.1-linux-x64.tar.xz -C /usr/local/nodejs
[root@chinaskill-node-1 ~]# vi /etc/profile
export NODE_PATH=/usr/local/nodejs/node-v12.16.1-linux-x64
export PATH=$PATH:$NODE_PATH/bin
[root@chinaskill-node-1 ~]# source /etc/profile
[root@chinaskill-node-1 ~]# node -v
v12.16.1

[root@chinaskill-node-1 ~]# yum install gcc-c++
[root@chinaskill-node-1 ~]# yum groupinstall 'Development Tools'
[root@chinaskill-node-1 ~]# tar -zxf rocket.chat.tgz -C /tmp
[root@chinaskill-node-1 ~]# cd /tmp/bundle/programs/server
[root@chinaskill-node-1 server]# npm install
[root@chinaskill-node-1 server]# mv /tmp/bundle /opt/Rocket.Chat
[root@chinaskill-node-1 server]# cd /opt/Rocket.Chat/
[root@chinaskill-node-1 Rocket.Chat]# useradd -M rocketchat
[root@chinaskill-node-1 Rocket.Chat]# usermod -L rocketchat
[root@chinaskill-node-1 Rocket.Chat]# chown -R rocketchat:rocketchat /opt/Rocket.Chat
[root@chinaskill-node-1 Rocket.Chat]# vi /lib/systemd/system/rocketchat.service
[Unit]
Description=The Rocket.Chat server running on Linux
After=network.target remote-fs.target nss-lookup.target nginx.service mongod.service
[Service]
ExecStart=/usr/local/nodejs/node-v12.16.1-linux-x64/bin/node /opt/Rocket.Chat/main.js
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=rocketchat
User=rocketchat
Environment=ROOT_URL=http://localhost:3000
Environment=PORT=3000
Environment=MONGO_URL=mongodb://172.16.2.76:27017/rocketchat?replicaSet=rs
Environment=MONGO_OPLOG_URL=mongodb://172.16.2.76:27017/local?replicaSet=rs
[Install]
WantedBy=multi-user.target

[root@chinaskill-node-1 Rocket.Chat]# systemctl enable rocketchat
[root@chinaskill-node-1 Rocket.Chat]# systemctl start rocketchat
[root@chinaskill-node-1 Rocket.Chat]# systemctl status rocketchat
【版权声明】本文为华为云社区用户原创内容,未经允许不得转载,如需转载请自行联系原作者进行授权。如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱: cloudbbs@huaweicloud.com
  • 点赞
  • 收藏
  • 关注作者

评论(0

0/1000
抱歉,系统识别当前为高风险访问,暂不支持该操作

全部回复

上滑加载中

设置昵称

在此一键设置昵称,即可参与社区互动!

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。